12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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)
- {
- Button_ok_onClick();
- }
- TimerComponent.Instance.Remove(_timerEntity);
- _timerEntity = null;
- });
- }
- }
- }
|