123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- 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;
- }
-
- HeroUITools.OpenSpecificProfessionEquipmentPanel(1);
- }
- private void OnclickFS()
- {
- if (curZy == 2)
- {
- return;
- }
- HeroUITools.OpenSpecificProfessionEquipmentPanel(2);
- }
- private void OnclickMS()
- {
- if (curZy == 3)
- {
- return;
- }
-
- HeroUITools.OpenSpecificProfessionEquipmentPanel(3);
- }
- private void OnclickYX()
- {
- if (curZy == 4)
- {
- return;
- }
-
- 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<WidgetItem>(poolName : SpecificEqsPoolName);
- HeroUITools.UpdateZyEqIcon(curZy, eqs, poolName : SpecificEqsPoolName);
-
- altertRed.SetActive(false);
- }
- }
- private void SendWearEvent()
- {
- // ProfessionEquipmentPanel professionEquipmentPanel = UIManager.Instance.GetComponent<ProfessionEquipmentPanel>();
- //
- // 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<WidgetItem>(SpecificEqsPoolName);
- if (isClickOnce)
- {
- // UIManager.Instance.DormancyAllGComponent<WidgetItem>("eq");
- }
- }
- private string SpecificEqsPoolName = "eq2";
- private Action closeAction;
-
- public void InitPanel(int zy, Action action = null)
- {
- isClickOnce = false;
- curZy = zy;
- closeAction = action;
- SetZyInfo();
- UIManager.Instance.DormancyAllGComponent<WidgetItem>(SpecificEqsPoolName);
- HeroUITools.UpdateZyEqIcon(zy, eqs, poolName : SpecificEqsPoolName);
- 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)
- {
- }
- }
- }
|