GuidePanel.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using Excel2Json;
  2. using Fort23.Core;
  3. using Fort23.UTool;
  4. using GameLogic.Combat;
  5. using UnityEngine;
  6. using UnityEngine.Events;
  7. using UnityEngine.UI;
  8. namespace Fort23.Mono
  9. {
  10. [UIBinding(prefab = "GuidePanel")]
  11. public partial class GuidePanel : UIPanel
  12. {
  13. private void Init()
  14. {
  15. isAddStack = false;
  16. }
  17. protected override void AddEvent()
  18. {
  19. }
  20. private void SkipGuide()
  21. {
  22. PlayerGuideManager.Instance.guideLogic.SkipGuide();
  23. }
  24. protected override void DelEvent()
  25. {
  26. }
  27. public override void AddButtonEvent()
  28. {
  29. Btn_Skip.onClick.AddListener(async () =>
  30. {
  31. // bool isKip = await UIManager.Instance.ShowTips("是否确认跳过引导");
  32. // if (isKip)
  33. SkipGuide();
  34. });
  35. Btn_Bg.onClick.AddListener(() =>
  36. {
  37. if (PlayerGuideManager.Instance.guideConfig.desc == -1)
  38. {
  39. if (PlayerGuideManager.Instance.guideConfig.ForceOnclick == 0)
  40. {
  41. PlayerGuideManager.Instance.NextGuide();
  42. }
  43. }
  44. else
  45. {
  46. PlayerGuideManager.Instance.dialogBox.OnClickScreen();
  47. }
  48. });
  49. Btn_MessageBG.onClick.AddListener(() => { PlayerGuideManager.Instance.dialogBox.OnClickScreen(); });
  50. }
  51. [CustomMethod(customMethodType: CustomMethodType.Update)]
  52. public void Update()
  53. {
  54. // if (UIManager.Instance.currOpenPanel == null || UIManager.Instance.currOpenPanel.GetType() != typeof(MainPanel) || UIManager.Instance.popUIPanels.Count > 0)
  55. // {
  56. // return;
  57. // }
  58. Vector3 worldPos = CombatDrive.Instance.CombatController.playerHeroEntity.combatHeroGameObject.hpTransform
  59. .position;
  60. Vector3 p = UIManager.Instance.CurrCustomCameraStack.camera.WorldToScreenPoint(worldPos);
  61. Vector3 p2 = UIManager.Instance.UICamera.ScreenToWorldPoint(p);
  62. dotPoint.transform.position = p2;
  63. }
  64. public void SetTarget(GameObject gameObject)
  65. {
  66. MyGuideMask.SetTargetImage(gameObject);
  67. }
  68. /// <summary>
  69. /// 设置点击屏蔽
  70. /// </summary>
  71. /// <param name="value"></param>
  72. public void SetOnClickMask(bool value)
  73. {
  74. OnClickMask.gameObject.SetActive(value);
  75. }
  76. /// <summary>
  77. /// 设置蒙版点击事件
  78. /// </summary>
  79. /// <param name="unityAction"></param>
  80. public void SetOnClickMaskOnClickAction(UnityAction unityAction)
  81. {
  82. OnClickMask.onClick.RemoveAllListeners();
  83. OnClickMask.onClick.AddListener(unityAction);
  84. }
  85. /// <summary>
  86. /// 设置蒙版大小
  87. /// </summary>
  88. /// <param name="size"></param>
  89. public void SetOnClickMaskSize(Vector2 size)
  90. {
  91. OnClickMask.GetComponent<RectTransform>().sizeDelta = size;
  92. }
  93. public override void Close()
  94. {
  95. base.Close();
  96. PlayerGuideManager.Instance._timerEntity?.Dispose();
  97. PlayerGuideManager.Instance._timerEntity = null;
  98. }
  99. public override void Hide()
  100. {
  101. base.Hide();
  102. }
  103. }
  104. }