WindowPartsWindowVisible.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. using UnityEngine;
  3. public class WindowPartsWindowVisible : WFCheckBox
  4. {
  5. public bool windowVisible
  6. {
  7. get
  8. {
  9. return this.TargetWindow.visible;
  10. }
  11. set
  12. {
  13. this.TargetWindow.visible = value;
  14. if (this.TargetWindow.visible && !base.check)
  15. {
  16. base.check = true;
  17. }
  18. else if (!this.TargetWindow.visible && base.check)
  19. {
  20. base.check = false;
  21. }
  22. }
  23. }
  24. public override void Awake()
  25. {
  26. base.Awake();
  27. }
  28. public void Start()
  29. {
  30. if (this.TargetWindow != null)
  31. {
  32. this.TargetWindow.SetButtonEnabled(BasePhotoWindow.BtnType.Min, true, false);
  33. this.TargetWindow.GetButtonOnClickEventList(BasePhotoWindow.BtnType.Min).Add(delegate
  34. {
  35. if (this.TargetWindow.visible)
  36. {
  37. this.OnClockEvent();
  38. }
  39. });
  40. }
  41. }
  42. protected override void OnClockEvent()
  43. {
  44. this.TargetWindow.visible = !base.check;
  45. if (this.TargetWindow.visible)
  46. {
  47. this.TargetWindow.ActiveWindow();
  48. }
  49. base.OnClockEvent();
  50. }
  51. public virtual void Update()
  52. {
  53. if (this.overRideStartVisible != WindowPartsWindowVisible.OverRideStartVisible.Non)
  54. {
  55. bool flag = this.overRideStartVisible == WindowPartsWindowVisible.OverRideStartVisible.Visible;
  56. this.TargetWindow.visible = flag;
  57. base.check = flag;
  58. if (this.TargetWindow.visible)
  59. {
  60. this.TargetWindow.ActiveWindow();
  61. }
  62. }
  63. this.overRideStartVisible = WindowPartsWindowVisible.OverRideStartVisible.Non;
  64. if (this.TargetWindow.visible && !base.check)
  65. {
  66. base.check = true;
  67. }
  68. else if (!this.TargetWindow.visible && base.check)
  69. {
  70. base.check = false;
  71. }
  72. }
  73. [SerializeField]
  74. public BasePhotoWindow TargetWindow;
  75. [SerializeField]
  76. public WindowPartsWindowVisible.OverRideStartVisible overRideStartVisible;
  77. public enum OverRideStartVisible
  78. {
  79. Non,
  80. Visible,
  81. Invisible
  82. }
  83. }