using System.Collections.Generic; using System.Linq; using Excel2Json; using Fort23.Core; using Fort23.UTool; using GameLogic.Combat; using GameLogic.Combat.CombatTool; namespace Fort23.Mono { [UIBinding(prefab = "AppBarPanel")] public partial class AppBarPanel : UIPanel { UIPanel currentOpenUIPanel; private void Init() { isAddStack = false; } protected override void AddEvent() { EventManager.Instance.AddEventListener(CustomEventType.DivineSensePointChange, DivineSensePointChange); } protected override void DelEvent() { EventManager.Instance.RemoveEventListener(CustomEventType.DivineSensePointChange, DivineSensePointChange); } private void DivineSensePointChange(IEventData e) { Text_divineSensePoint.text = $"{AccountFileInfo.Instance.playerData.divineSensePoint}/{PlayerManager.Instance.gameConstantConfig.DetectEventCount}"; } public override void AddButtonEvent() { bnt_shengShi.onClick.AddListener(() => { DivineSenceInfoPanel.OpenPanel(() => { Bnt_shengShi_onClick(); }); }); Btn_GongFa.onClick.AddListener(async () => { if (currentOpenUIPanel is SkillSelectPanel) { return; } UIManager.Instance.HideUIUIPanel(currentOpenUIPanel); SkillSelectPanel skillSelectPanel = await SkillSelectPanel.OpenSkillSelectPanel(); currentOpenUIPanel = skillSelectPanel; }); Btn_HeroInfomation.onClick.AddListener(async () => { if (currentOpenUIPanel is MainHeroPanel) { return; } UIManager.Instance.HideUIUIPanel(currentOpenUIPanel); EventSystemManager.Instance.isOpenUi = true; MainHeroPanel mainHeroPanel = await MainHeroPanel.OpenPanel(); currentOpenUIPanel = mainHeroPanel; await mainHeroPanel.UIClosed(); EventSystemManager.Instance.isOpenUi = false; }); Btn_DongFu.onClick.AddListener(async () => { if (currentOpenUIPanel is HeroInformationPanel) { return; } UIManager.Instance.HideUIUIPanel(currentOpenUIPanel); EventSystemManager.Instance.isOpenUi = true; CombatDrive.Instance.CombatController.isUpdate = false; HeroInformationPanel heroInformationPanel = await HeroInformationPanel.OpenPanel(); currentOpenUIPanel = heroInformationPanel; await heroInformationPanel.UIClosed(); CombatDrive.Instance.CombatController.isUpdate = true; EventSystemManager.Instance.isOpenUi = false; }); Btn_Back.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(currentOpenUIPanel); currentOpenUIPanel = null; // UIManager.Instance.GetComponent().Show(); // MainPanel.OpenPanel(); }); } private async void Bnt_shengShi_onClick() { // EventSystemManager.Instance.DetectRandomEvents(); if (AccountFileInfo.Instance.playerData.divineSensePoint < PlayerManager.Instance.gameConstantConfig.DetectEventCount) { TipMessagePanel.OpenTipMessagePanel("神识值不够!"); return; } if (EventSystemManager.Instance.isTriggerEvent) return; EventSystemManager.Instance.isTriggerEvent = true; CombatDrive.Instance.CombatController.ChangeState(CombatController.idle); CombatController.currActiveCombat.CombatSenceController.StartPayShengShi(CombatController.currActiveCombat .playerHeroEntity.GameObject.transform); List eventLists = EventSystemManager.Instance.UseDivinesense(1); await TimerComponent.Instance.WaitAsync(800); EventSystemManager.Instance.isTriggerEvent = false; if (eventLists == null || eventLists.Count == 0) { CombatDrive.Instance.CombatController.ChangeState(CombatController.update); return; } if (eventLists != null && eventLists.Count > 0) { EventSystemManager.Instance.isOpenUi = true; DivineSenceEventResultPanel divineSenceEventResultPanel = await DivineSenceEventResultPanel.OpenPanel(eventLists); await divineSenceEventResultPanel.UIClosed(); EventSystemManager.Instance.isOpenUi = false; } CombatDrive.Instance.CombatController.ChangeState(CombatController.update); AccountFileInfo.Instance.playerData.eventList.AddRange(eventLists); AccountFileInfo.Instance.SavePlayerData(); EventManager.Instance.Dispatch(CustomEventType.ShengShiOnClick, null); } public void CustomInit(UIPanel uiPanel) { if (uiPanel is MainPanel) { Btn_Back.gameObject.SetActive(false); bnt_shengShi.gameObject.SetActive(true); } else { Btn_Back.gameObject.SetActive(true); bnt_shengShi.gameObject.SetActive(false); } } public async static CTask OpenPanel(UIPanel uiPanel) { AppBarPanel appBarPanel = null; if (UIManager.Instance.GetComponent() == null) { appBarPanel = await UIManager.Instance.LoadAndOpenPanel(null, UILayer.Top); } else { appBarPanel = UIManager.Instance.GetComponent(); await appBarPanel.Show(); } appBarPanel.CustomInit(uiPanel); } public async static CTask ClosePanel() { // UIManager.Instance.HideUIUIPanel(); UIManager.Instance.GetComponent()?.Hide(); } } }