using System; using System.Collections.Generic; using Common.Utility.CombatEvent; using Core.Language; using Fort23.Core; using Fort23.UTool; using GameLogic.Bag; using UnityEngine; namespace Fort23.Mono { [UIBinding(prefab = "SpecificProfessionEquipmentPanel" )] public partial class SpecificProfessionEquipmentPanel : UIPanel { private void Init() { } protected override void AddEvent() { } protected override void DelEvent() { } public override void AddButtonEvent() { btnBack.onClick.AddListener(OnclickClose); btnOnce.onClick.AddListener(OnclickOnce); btnZs.onClick.AddListener(OnclickZS); btnFs.onClick.AddListener(OnclickFS); btnMs.onClick.AddListener(OnclickMS); btnYx.onClick.AddListener(OnclickYX); } private void OnclickZS() { if (curZy == 1) { return; } // HighLight(curZy); HeroUITools.OpenSpecificProfessionEquipmentPanel(1); } private void OnclickFS() { if (curZy == 2) { return; } // HighLight(curZy); HeroUITools.OpenSpecificProfessionEquipmentPanel(2); } private void OnclickMS() { if (curZy == 3) { return; } // HighLight(curZy); HeroUITools.OpenSpecificProfessionEquipmentPanel(3); } private void OnclickYX() { if (curZy == 4) { return; } // HighLight(curZy); HeroUITools.OpenSpecificProfessionEquipmentPanel(4); } private bool isClickOnce = false; public int curZy; //流光溢彩 别出心裁 千篇一律 呕心沥血 private void OnclickOnce() { isClickOnce = PlayerManager.Instance.eqController.QuickEquip(curZy); if (isClickOnce) { SendWearEvent(); UIManager.Instance.DormancyAllGComponent(poolName : SpecificEqsPoolName); HeroUITools.UpdateZyEqIcon(curZy, eqs, poolName : SpecificEqsPoolName); // altertRed.SetActive(false); SetRedPoints(true); } } private void HighLight(int zy) { for (int i = 0; i < highLights.Count; i++) { GameObject obj = highLights[i] as GameObject; if (zy > 0 && zy == i + 1) { obj.SetActive(true); } else { obj.SetActive(false); } } } private void SendWearEvent() { // ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent(); // // professionEquipmentPanel.UpdateAllEq(); HeroEquipEventData data = new HeroEquipEventData(); data.zy = curZy; // EventManager.Instance.Dispatch(CustomEventType.HeroPowerUp, data); EventManager.Instance.Dispatch(CustomEventType.HeroEquip, data); } private async void OnclickClose() { UIManager.Instance.HideUIUIPanel(this); closeAction?.Invoke(); UIManager.Instance.DormancyAllGComponent(SpecificEqsPoolName); if (isClickOnce) { // UIManager.Instance.DormancyAllGComponent("eq"); } } private string SpecificEqsPoolName = "eq2"; private Action closeAction; public void InitPanel(int zy, Action action = null) { isClickOnce = false; curZy = zy; closeAction = action; HighLight(curZy); SetZyInfo(); UIManager.Instance.DormancyAllGComponent(SpecificEqsPoolName); HeroUITools.UpdateZyEqIcon(zy, eqs, poolName : SpecificEqsPoolName); SetRedPoints(); } private void SetRedPoints(bool reCal = false) { for (int i = 1; i <= 4; i++) { GameObject obj = zyRedPoints[i - 1] as GameObject; if (PlayerManager.Instance.eqController.IsBetterEqs4OneZy(i, reCal)) { obj.SetActive(true); } else { obj.SetActive(false); } } if (PlayerManager.Instance.eqController.IsBetterEqs4OneZy(curZy)) { altertRed.SetActive(true); } else { altertRed.SetActive(false); } } private void SetZyInfo() { switch (curZy) { // case 1: SetZyTxt(97); zyBg.icon_name = "bg_warrior"; colorBg.color = new Color(255, 215, 0); break; case 2: SetZyTxt(98); zyBg.icon_name = "bg_priest"; colorBg.color = new Color(128, 0, 128); break; case 3: SetZyTxt(99); zyBg.icon_name = "bg_Mage"; colorBg.color = new Color(255, 255, 204); break; case 4: SetZyTxt(100); zyBg.icon_name = "bg_Archer"; colorBg.color = new Color(0, 128, 0); break; default: break; } } private void SetZyTxt(int languageId) { zyTitle.text = LanguageManager.Instance.Text(languageId); miniTitle.text = LanguageManager.Instance.Text(languageId); } private void SetZyBg(int zy) { } } }