| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 | 
							- using System;
 
- using System.Text;
 
- using Common.Utility.CombatEvent;
 
- using Core.Language;
 
- using Excel2Json;
 
- using Fort23.Core;
 
- using Fort23.UTool;
 
- using GameLogic.Combat;
 
- using UnityEngine;
 
- namespace Fort23.Mono
 
- {
 
-     [UIBinding(prefab = "DialogueBubblePanel")]
 
-     public partial class DialogueBubblePanel : UIPanel
 
-     {
 
-         private int[] dialogueMessaga;
 
-         private ShowDialogueEventData.MessageShowType messageShowType = ShowDialogueEventData.MessageShowType.Verbatim;
 
-         private Action<int?> finish;
 
-         private int index;
 
-         private char[] _currShowMessage;
 
-         private float _showTime = 0.05f;
 
-         private float _currShowTime = 0;
 
-         protected StringBuilder _sb = new StringBuilder();
 
-         private int _currShowIndex;
 
-         private bool _isUpdate;
 
-         private bool _isShowNextButton;
 
-         private EventLinkConfig eventConditionConfig;
 
-         private bool _skipTyping;
 
-         private bool _isShowingOptions;
 
-         public static async CTask OpenDialoguePanel(int id, Action<int?> finish)
 
-         {
 
-             DialogueBubblePanel dialoguePanel = await UIManager.Instance.LoadAndOpenPanel<DialogueBubblePanel>(null, UILayer.Bottom, isFocus: false);
 
-             dialoguePanel.ShowPanel(id, finish);
 
-         }
 
-         private void Init()
 
-         {
 
-             isAddStack = false;
 
-             _skipTyping = false;
 
-             _isShowingOptions = false;
 
-         }
 
-         protected override void AddEvent()
 
-         {
 
-             StaticUpdater.Instance.AddRenderUpdateCallBack(Update);
 
-         }
 
-         protected override void DelEvent()
 
-         {
 
-             StaticUpdater.Instance.RemoveRenderUpdateCallBack(Update);
 
-         }
 
-         public override void AddButtonEvent()
 
-         {
 
-             button_bg.onClick.AddListener(NextShow);
 
-         }
 
-         private void SkipTyping()
 
-         {
 
-             _skipTyping = true;
 
-             _timerEntity?.Dispose();
 
-             _timerEntity = null;
 
-             if (_isUpdate)
 
-             {
 
-                 _sb.Clear();
 
-                 _sb.Append(_currShowMessage);
 
-                 message.text = _sb.ToString();
 
-                 _currShowIndex = _currShowMessage.Length;
 
-                 _isUpdate = false;
 
-             }
 
-         }
 
-         private void NextShow()
 
-         {
 
-             if (_isShowingOptions)
 
-                 return;
 
-             if (_isUpdate)
 
-             {
 
-                 SkipTyping();
 
-             }
 
-             else
 
-             {
 
-                 StartShowMassge();
 
-             }
 
-         }
 
-         public void ShowPanel(int id,
 
-             Action<int?> finish)
 
-         {
 
-             eventConditionConfig = ConfigComponent.Instance.Get<EventLinkConfig>(id);
 
-             this.dialogueMessaga = eventConditionConfig.LanID;
 
-             this.finish = finish;
 
-             index = 0;
 
-             StartShowMassge();
 
-         }
 
-         private void StartShowMassge()
 
-         {
 
-             _timerEntity?.Dispose();
 
-             _timerEntity = null;
 
-             if (index >= dialogueMessaga.Length)
 
-             {
 
-                 UIManager.Instance.HideUIUIPanel(this);
 
-                 finish?.Invoke(null);
 
-                 return;
 
-             }
 
-             _isShowNextButton = false;
 
-             string m = LanguageManager.Instance.Text(dialogueMessaga[index]);
 
-             index++;
 
-             switch (messageShowType)
 
-             {
 
-                 case ShowDialogueEventData.MessageShowType.Default:
 
-                     message.text = m;
 
-                     break;
 
-                 case ShowDialogueEventData.MessageShowType.Verbatim:
 
-                     _sb.Clear();
 
-                     _currShowMessage = m.ToCharArray();
 
-                     if (_currShowMessage.Length > 0)
 
-                         _sb.Append(_currShowMessage[0]);
 
-                     message.text = _sb.ToString();
 
-                     _isUpdate = true;
 
-                     _currShowIndex = 1;
 
-                     _skipTyping = false;
 
-                     break;
 
-             }
 
-         }
 
-         public override void Hide()
 
-         {
 
-             base.Hide();
 
-         }
 
-         private TimerEntity _timerEntity;
 
-         public void Update()
 
-         {
 
-             if (UIManager.Instance.currOpenPanel == null || UIManager.Instance.currOpenPanel.GetType() != typeof(MainPanel) || UIManager.Instance.popUIPanels.Count > 0)
 
-             {
 
-                 return;
 
-             }
 
-             Vector3 worldPos = CombatDrive.Instance.CombatController.playerHeroEntity.combatHeroGameObject.hpTransform.position;
 
-             Vector3 p = UIManager.Instance.CurrCustomCameraStack.camera.WorldToScreenPoint(worldPos);
 
-             Vector3 p2 = UIManager.Instance.UICamera.ScreenToWorldPoint(p);
 
-             dotPoint.transform.position = p2;
 
-             if (!_isUpdate) return;
 
-             if (messageShowType == ShowDialogueEventData.MessageShowType.Verbatim)
 
-             {
 
-                 if (_currShowIndex >= _currShowMessage.Length)
 
-                 {
 
-                     _isUpdate = false;
 
-                     _timerEntity?.Dispose();
 
-                     _timerEntity = null;
 
-                     _timerEntity = TimerComponent.Instance.AddTimer(800, () =>
 
-                     {
 
-                         _timerEntity?.Dispose();
 
-                         _timerEntity = null;
 
-                         StartShowMassge();
 
-                     });
 
-                     return;
 
-                 }
 
-                 _currShowTime += Time.deltaTime;
 
-                 if (_currShowTime > _showTime)
 
-                 {
 
-                     _currShowTime -= _showTime;
 
-                     _sb.Append(_currShowMessage[_currShowIndex]);
 
-                     _currShowIndex++;
 
-                     message.text = _sb.ToString();
 
-                 }
 
-             }
 
-         }
 
-         public async override CTask Close()
 
-         {
 
-             UIManager.Instance.DormancyAllGComponent<DialogueOptionWidget>();
 
-             _isShowingOptions = false;
 
-             _skipTyping = false;
 
-             _timerEntity?.Dispose();
 
-             _timerEntity = null;
 
-             await base.Close();
 
-         }
 
-     }
 
- }
 
 
  |