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() { } 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(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); if (eventLists == null || eventLists.Count == 0) { EventSystemManager.Instance.isTriggerEvent = false; CombatDrive.Instance.CombatController.ChangeState(CombatController.update); return; } List reeultEventLists = new List(); reeultEventLists = eventLists.Where((el) => { EventConfig eventConfig = ConfigComponent.Instance.Get(el.eventID); return eventConfig.EventType == 2; }).ToList(); int count = eventLists.Count; if (reeultEventLists != null && reeultEventLists.Count > 0) { foreach (var reeultEventList in reeultEventLists) { EventSystemManager.Instance.CompleteEvent(reeultEventList, true); eventLists.Remove(reeultEventList); } DivineSenceEventResultPanel divineSenceEventResultPanel = await DivineSenceEventResultPanel.OpenPanel(reeultEventLists, count); await divineSenceEventResultPanel.UIClosed(); } EventSystemManager.Instance.isTriggerEvent = false; CombatDrive.Instance.CombatController.ChangeState(CombatController.update); AccountFileInfo.Instance.playerData.eventList.AddRange(eventLists); AccountFileInfo.Instance.SavePlayerData(); EventManager.Instance.Dispatch(CustomEventType.ShengShiOnClick, null); // Text_EventNum.text = AccountFileInfo.Instance.playerData.eventList.Count.ToString(); // ChagneShenshiBtnActive(); // CreatShengShiEvent(); } 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 = await UIManager.Instance.LoadAndOpenPanel(null, UILayer.Top); appBarPanel.CustomInit(uiPanel); } public async static CTask ClosePanel() { UIManager.Instance.HideUIUIPanel(); } } }