WindowPartsEffectBase.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using UnityEngine;
  3. public abstract class WindowPartsEffectBase : MonoBehaviour
  4. {
  5. public virtual void Awake()
  6. {
  7. this.EnabledCheckBox.onClick.Add(new Action<WFCheckBox>(this.OnClickBaseEnabledCheckBox));
  8. }
  9. public virtual void Start()
  10. {
  11. }
  12. public virtual void OnDestroy()
  13. {
  14. }
  15. public virtual void Update()
  16. {
  17. }
  18. public abstract void Init();
  19. public abstract void OnSerializeEvent();
  20. public abstract void OnDeserializeEvent();
  21. public virtual void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  22. {
  23. }
  24. public virtual void OnClickEnabledCheckBox(WFCheckBox check_box)
  25. {
  26. this.effect_enabled = check_box.check;
  27. this.OnChangeEffectEnabled(check_box.check);
  28. }
  29. public virtual void OnChangeEffectEnabled(bool enabled)
  30. {
  31. }
  32. public void SetEffectWindow(EffectWindow effect_window)
  33. {
  34. this.effect_window_ = effect_window;
  35. }
  36. public bool visible
  37. {
  38. get
  39. {
  40. return base.gameObject.activeSelf;
  41. }
  42. set
  43. {
  44. base.gameObject.SetActive(value);
  45. }
  46. }
  47. public bool effect_enabled
  48. {
  49. get
  50. {
  51. return !GameMain.Instance.VRMode && this.effect_object != null && this.effect_object.enabled;
  52. }
  53. set
  54. {
  55. if (!GameMain.Instance.VRMode && this.effect_object != null)
  56. {
  57. this.effect_object.enabled = value;
  58. }
  59. }
  60. }
  61. protected abstract MonoBehaviour effect_object { get; }
  62. private void OnClickBaseEnabledCheckBox(WFCheckBox check_box)
  63. {
  64. this.OnClickEnabledCheckBox(check_box);
  65. }
  66. public WFCheckBox EnabledCheckBox;
  67. protected EffectWindow effect_window_;
  68. }