123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using Excel2Json;
- using Mono.UI.Core;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- namespace Mono
- {
- [UIBinding(prefab = "ShowTextPanel")]
- public class ShowTextPanel : UIPanel
- {
- public Typewriter Text_ShowTIP;
- public Button Btn_Next;
- public int Index;
- public Animator ShowTextAni;
- public Image BG;
- public override void GetUIData()
- {
- Text_ShowTIP = UIData.Get<Typewriter>("Text_ShowTIP");
- Btn_Next = UIData.Get<Button>("Btn_Next");
- ShowTextAni = UIData.Get<Animator>("ShowTextAni");
- BG = UIData.Get<Image>("BG");
- }
- public override void Show()
- {
- base.Show();
- }
- public override void AddButtonEvent()
- {
- Btn_Next.onClick.AddListener(ChangeScene);
- }
- public void ShowText(int id)
- {
- ShowTextAni.Play("open");
- TimeComponent.Instance.AddTimer(0.5f, () =>
- {
- ShowTextAni.Play("idle");
- ShowTextConfig showTextConfig = ConfigComponent.Instance.Get<ShowTextConfig>(id);
- Text_ShowTIP.StringContent = showTextConfig.name;
- Text_ShowTIP.SetContent();
- Index = id;
- });
- }
- public void ChangeScene()
- {
- if (!Text_ShowTIP.IsOver)
- {
- return;
- }
- switch (Index)
- {
- case 1:
- SceneManager.LoadScene("baidicheng");
- UIManager.Instance.PlayBGM("Scene04");
- TimeComponent.Instance.AddTimer(22f, () => { UIManager.Instance.LoadAndOpenPanel<ChatPanel>(UIManager.UILayer.Middle); });
- break;
- }
- TimeComponent.Instance.AddTimer(0.2f, () => { ShowTextAni.Play("close"); });
- TimeComponent.Instance.AddTimer(1f, () =>
- {
- Color color = BG.color;
- color.a = 0;
- BG.color = color;
- Color color1 = Text_ShowTIP.Showtext.color;
- color.a = 0;
- Text_ShowTIP.Showtext.color = color1;
- Text_ShowTIP.Showtext.text = "";
- Text_ShowTIP.StringContent = "";
- UIManager.Instance.HideUIPanel<ShowTextPanel>();
- // switch (Index)
- // {
- // case 1:
- // UIManager.Instance.HideUIPanel<ShowTextPanel>();
- // break;
- // case 2:
- // UIManager.Instance.HideUIPanel<ShowTextPanel>();
- // break;
- // case 3:
- // UIManager.Instance.HideUIPanel<ShowTextPanel>();
- // break;
- // }
- });
- }
- }
- }
|