StartDailyMgr.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System;
  2. using UnityEngine;
  3. public class StartDailyMgr : BaseCreatePanel
  4. {
  5. public override void Init()
  6. {
  7. this.m_goPanel = base.GetPanel("StartDailyPanel");
  8. this.m_ctrl = base.GetCtrl<StartDailyCtrl>();
  9. this.m_ctrl.Init(this, this.m_goPanel);
  10. this.m_api = new StartDailyAPI();
  11. this.m_goPanel.SetActive(false);
  12. this.ExecuteRelatedAPI();
  13. }
  14. private void ExecuteRelatedAPI()
  15. {
  16. }
  17. public void OpenStartDailyPanel()
  18. {
  19. this.m_enableClick = (this.m_Click = false);
  20. if (GameMain.Instance.IsForceSkip())
  21. {
  22. base.SetDurationToFadeIn(0.001f);
  23. }
  24. this.m_api.SceneStart(this, new StartDailyAPI.dgOnSceneStartCallBack(this.OpenStartDailyCallBack));
  25. }
  26. public void OpenStartDailyCallBack()
  27. {
  28. base.BaseOpenPanel();
  29. }
  30. protected override void OpenPanel()
  31. {
  32. int data = this.LoadGamePlayDays();
  33. this.m_ctrl.CreateViewer(data);
  34. }
  35. private int LoadGamePlayDays()
  36. {
  37. return GameMain.Instance.CharacterMgr.status.days + 1;
  38. }
  39. protected override void AfterOpen()
  40. {
  41. this.m_enableClick = true;
  42. }
  43. public void CloseStartDailyPanel()
  44. {
  45. base.BaseClosePanel();
  46. }
  47. protected override void AfterClose()
  48. {
  49. if (this.sceneMgr != null)
  50. {
  51. this.m_api.EndNextScene(new StartDailyAPI.dgOnSceneFinalCallBack(this.sceneMgr.CloseScene));
  52. }
  53. }
  54. protected override void SetFadeTargetPanel()
  55. {
  56. this.fadeTargetPanel = this.m_goPanel;
  57. }
  58. private void Update()
  59. {
  60. if (((Input.anyKey && !NInput.GetMouseButton(1) && !NInput.GetMouseButton(2)) || NInput.GetMouseButtonUp(0)) && (this.m_enableClick || (this.m_goPanel != null && this.m_goPanel.GetComponent<UIPanel>().alpha == 1f)) && !UICamera.isOverUI)
  61. {
  62. if (GameMain.Instance.IsForceSkip())
  63. {
  64. base.SetDurationToFadeOut(0.001f);
  65. }
  66. if (!this.m_Click)
  67. {
  68. this.CloseStartDailyPanel();
  69. }
  70. this.m_Click = true;
  71. }
  72. }
  73. [SerializeField]
  74. private int dummyDays;
  75. private StartDailyCtrl m_ctrl;
  76. private StartDailyAPI m_api;
  77. private bool m_enableClick;
  78. private bool m_Click;
  79. }