123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using Core.Audio;
- using Fort23.Core;
- using GameLogic.Combat.CombatTool;
- using GameLogic.Combat.CombatType;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "CombatHeroDiePanel")]
- public partial class CombatHeroDiePanel : UIPanel
- {
- private int time;
- private TimerEntity _timerEntity;
- public static async void OpenCombatHeroDiePanel()
- {
- CombatHeroDiePanel combatHeroDiePanel =
- await UIManager.Instance.LoadAndOpenPanel<CombatHeroDiePanel>(null, layer: UILayer.Top);
- combatHeroDiePanel.ShowCombatHeroDiePanel();
- }
- private void Init()
- {
- }
- protected override void AddEvent()
- {
- }
- protected override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- Button_ok.onClick.AddListener(Button_ok_onClick);
- }
- private void Button_ok_onClick()
- {
- LevelBattleCombatType levelBattleCombatType =
- CombatController.currActiveCombat.CombatTypeBasic as LevelBattleCombatType;
- levelBattleCombatType.Resume();
- TimerComponent.Instance.Remove(_timerEntity);
- _timerEntity = null;
- UIManager.Instance.HideUIUIPanel(this);
- }
- public void ShowCombatHeroDiePanel()
- {
- AudioManager.Instance.PauseBGM();
- AudioManager.Instance.PlayAudio("shibai.wav");
- time = 30;
- clickTime.text = time.ToString();
- _timerEntity = TimerComponent.Instance.AddTimer(1000, delegate { }, 10000, delegate
- {
- if (_timerEntity == null)
- {
- return;
- }
- time--;
- clickTime.text = time.ToString();
- if (time <= 0)
- {
- TimerComponent.Instance.Remove(_timerEntity);
- _timerEntity = null;
- Button_ok_onClick();
- }
- });
- }
- }
- }
|