| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 | using System.Collections.Generic;using System.Linq;using Core.Audio;using Excel2Json;using Fort23.Core;using Fort23.UTool;using GameLogic.Bag;using GameLogic.Combat;using GameLogic.Combat.CombatTool;namespace Fort23.Mono{    [UIBinding(prefab = "AppBarPanel")]    public partial class AppBarPanel : UIPanel    {        public UIPanel currentOpenUIPanel;        int useCount = 0;        private void Init()        {            isAddStack = false;        }        private BackgroundCom _backgroundCom;        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 =                $"{(int)AccountFileInfo.Instance.playerData.divineSensePoint}/{PlayerManager.Instance.myHero.powerUpConfig.ShenshiMax}";        }        public override void AddButtonEvent()        {            Btn_Shop.onClick.AddListener(async () => { Btn_Shop_Click(); });            bnt_shengShi.onClick.AddListener(() => { Bnt_ShengShi_Click(); });            Btn_GongFa.onClick.AddListener(async () => { Btn_GongFa_Click(); });            Btn_HeroInfomation.onClick.AddListener(async () => { Btn_HeroInfomation_Click(); });            Btn_DongFu.onClick.AddListener(async () => { Bne_dongfu_Click(); });            Btn_Back.onClick.AddListener(() =>            {                CloseMenu();                if (!(currentOpenUIPanel is MainPanel))                    UIManager.Instance.HideUIUIPanel(currentOpenUIPanel);                else                {                    UpdateUitoggleState();                }                AudioManager.Instance.PlayAudio("ui_fanhui.wav");                // currentOpenUIPanel = null;            });            Btn_Menu.onClick.AddListener(async () =>            {                if (MenuRoot.activeSelf)                    return;                _backgroundCom = await UIManager.Instance.CreateGComponent<BackgroundCom>(null, root: MenuBgRoot);                Icon_Di.gameObject.SetActive(true);                Btn_Back.gameObject.SetActive(true);                bnt_shengShi.gameObject.SetActive(false);                BtnRoot.gameObject.SetActive(true);                MenuRoot.SetActive(true);                Toggle_BtnRoot.ShowTargetIndex(4);            });            Btn_Back1.onClick.AddListener(() =>            {                CloseMenu();                UpdateUitoggleState();            });            Btn_DaoYou.onClick.AddListener(() =>            {                DaoYouPanel.OpenPanel();                CloseMenu();            });            Btn_Tower.onClick.AddListener(() =>            {                TowerPanel.OpenPanel(1);                CloseMenu();            });        }        private void CloseMenu()        {            UIManager.Instance.DormancyGComponent(_backgroundCom);            _backgroundCom = null;            MenuRoot.SetActive(false);        }        public async void Bnt_ShengShi_Click()        {                  await DivineSenceInfoPanel.OpenPanel((count, useItems) => { Bnt_shengShi_onClick(count, useItems); });        }        public async void Btn_Shop_Click(int shopId = 0)        {            CloseMenu();            if (currentOpenUIPanel is ShopPanel)            {                return;            }            UIPanel uiPanel = currentOpenUIPanel;            CombatDrive.Instance.CombatController.isUpdate = false;            ShopPanel shopPanel = await ShopPanel.OpenPanel(shopId);            if (uiPanel is CaveMainPanel || uiPanel is SkillSelectPanel || uiPanel is ShopPanel ||                uiPanel is MainHeroPanel)            {                UIManager.Instance.HideUIUIPanel(uiPanel, isBreadcrumbBarPanel: false);            }            if (!shopPanel.IsClose)                await shopPanel.UIClosed();            CombatDrive.Instance.CombatController.isUpdate = true;        }        public async void Btn_GongFa_Click()        {            CloseMenu();            if (currentOpenUIPanel is SkillSelectPanel)            {                return;            }            UIPanel uiPanel = currentOpenUIPanel;            SkillSelectPanel skillSelectPanel = await SkillSelectPanel.OpenSkillSelectPanel();            if (uiPanel is CaveMainPanel || uiPanel is SkillSelectPanel || uiPanel is ShopPanel ||                uiPanel is MainHeroPanel)            {                UIManager.Instance.HideUIUIPanel(uiPanel, isBreadcrumbBarPanel: false);            }        }        public async void Btn_HeroInfomation_Click()        {            CloseMenu();            if (currentOpenUIPanel is MainHeroPanel)            {                return;            }            UIPanel uiPanel = currentOpenUIPanel;            MainHeroPanel mainHeroPanel = await MainHeroPanel.OpenPanel();            if (uiPanel is CaveMainPanel || uiPanel is SkillSelectPanel || uiPanel is ShopPanel ||                uiPanel is MainHeroPanel)            {                UIManager.Instance.HideUIUIPanel(uiPanel, isBreadcrumbBarPanel: false);            }            if (!mainHeroPanel.IsClose)                await mainHeroPanel.UIClosed();        }        public async void Bne_dongfu_Click()        {            CloseMenu();            if (currentOpenUIPanel is CaveMainPanel)            {                return;            }            UIPanel uiPanel = currentOpenUIPanel;            CombatDrive.Instance.CombatController.isUpdate = false;            CaveMainPanel heroInformationPanel = await CaveMainPanel.OpenPanel();            if (uiPanel is CaveMainPanel || uiPanel is SkillSelectPanel || uiPanel is ShopPanel ||                uiPanel is MainHeroPanel)            {                UIManager.Instance.HideUIUIPanel(uiPanel, isBreadcrumbBarPanel: false);            }            if (!heroInformationPanel.IsClose)                await heroInformationPanel.UIClosed();            CombatDrive.Instance.CombatController.isUpdate = true;        }        private async CTask OpenSelectSkillPanel()        {        }        private async void Bnt_shengShi_onClick(int count, List<ItemInfo> useItems)        {            if (count == 0)            {                return;            }            EventSystemManager.Instance.CancelEvent();            if (EventSystemManager.Instance.isTriggerEvent)                return;            AudioManager.Instance.PlayAudio("ui_shengshitansuo.wav");            if (PlayerGuideManager.Instance.curPhase == 2)                PlayerGuideManager.Instance.StepInit();            if (PlayerGuideManager.Instance.curPhase == 3)                PlayerGuideManager.Instance.StepInit();            EventSystemManager.Instance.isTriggerEvent = true;            CombatDrive.Instance.CombatController.ChangeState(CombatController.idle);            CombatController.currActiveCombat.CombatSenceController.StartPayShengShi(CombatController.currActiveCombat                .playerHeroEntity.GameObject.transform);            List<AccountFileInfo.EventList> eventLists = EventSystemManager.Instance.UseDivinesense(count, useItems);            await TimerComponent.Instance.WaitAsync(1200);            EventSystemManager.Instance.isTriggerEvent = false;            if (eventLists == null || eventLists.Count == 0)            {                CombatDrive.Instance.CombatController.ChangeState(CombatController.update);                // if (PlayerGuideManager.Instance.GuideIsCanDo(1, 2))                // {                //     PlayerGuideManager.Instance.NextGuide();                // }                return;            }            if (eventLists != null && eventLists.Count > 0)            {                await DivineSenceEventPreviewPanel.OpenPanel();            }            // if (PlayerGuideManager.Instance.GuideIsCanDo(1, 2))            // {            //     PlayerGuideManager.Instance.NextGuide();            // }            CombatDrive.Instance.CombatController.ChangeState(CombatController.update);            EventManager.Instance.Dispatch(CustomEventType.ShengShiOnClick, null);        }        public void CustomInit(UIPanel uiPanel)        {            currentOpenUIPanel = uiPanel;            UpdateUitoggleState();        }        private void UpdateUitoggleState()        {            if (currentOpenUIPanel is MainPanel)            {                Icon_Di.gameObject.SetActive(true);                Btn_Back.gameObject.SetActive(false);                bnt_shengShi.gameObject.SetActive(true);                BtnRoot.gameObject.SetActive(true);            }            else if (currentOpenUIPanel is CaveMainPanel || currentOpenUIPanel is SkillSelectPanel ||                     currentOpenUIPanel is ShopPanel ||                     currentOpenUIPanel is MainHeroPanel)            {                Icon_Di.gameObject.SetActive(true);                Btn_Back.gameObject.SetActive(true);                bnt_shengShi.gameObject.SetActive(false);                BtnRoot.gameObject.SetActive(true);            }            else            {                Icon_Di.gameObject.SetActive(false);                BtnRoot.gameObject.SetActive(false);                Btn_Back.gameObject.SetActive(true);                bnt_shengShi.gameObject.SetActive(false);            }            if (currentOpenUIPanel is CaveMainPanel)            {                Toggle_BtnRoot.ShowTargetIndex(2);            }            else if (currentOpenUIPanel is SkillSelectPanel)            {                Toggle_BtnRoot.ShowTargetIndex(1);            }            else if (currentOpenUIPanel is ShopPanel)            {                Toggle_BtnRoot.ShowTargetIndex(3);            }            else if (currentOpenUIPanel is MainHeroPanel)            {                Toggle_BtnRoot.ShowTargetIndex(0);            }            else            {                Toggle_BtnRoot.Hide();            }        }        public async static CTask OpenPanel(UIPanel uiPanel)        {            AppBarPanel appBarPanel = null;            if (UIManager.Instance.GetComponent<AppBarPanel>() == null)            {                appBarPanel = await UIManager.Instance.LoadAndOpenPanel<AppBarPanel>(null, UILayer.Top, isFocus: false);            }            else            {                appBarPanel = UIManager.Instance.GetComponent<AppBarPanel>();                await appBarPanel.Show();            }            appBarPanel.CustomInit(uiPanel);            RedDotManager.Instance.AllRedDotUpDate();        }        public async static CTask ClosePanel()        {            // UIManager.Instance.HideUIUIPanel<AppBarPanel>();            UIManager.Instance.GetComponent<AppBarPanel>()?.Hide();        }    }}
 |