GuidePanel.cs 3.4 KB

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