12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using Core.Language;
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using GameLogic.Bag;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "SelectBreakthroughItemPanel")]
- public partial class SelectBreakthroughItemPanel : UIPanel
- {
- ItemConfig itemConfig;
- private Action callBack;
- private void Init()
- {
- }
- protected override void AddEvent()
- {
- }
- protected override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- Btn_Affirm.onClick.AddListener(() =>
- {
- this.callBack?.Invoke();
- EventManager.Instance.Dispatch(CustomEventType.RefenceBreakthrough, null);
- UIManager.Instance.HideUIUIPanel(this);
- });
- Btn_Cancel.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel(this); });
- }
- public void CustomInit(int itemId, Action callBack)
- {
- this.callBack = callBack;
- itemConfig = ConfigComponent.Instance.Get<ItemConfig>(itemId);
- Text_ItemName.text = LanguageManager.Instance.Text(itemConfig.itemName);
- Text_ItemDesc.text = LanguageManager.Instance.Text(itemConfig.itemDesc);
- Icon_ItemIcon.icon_name = itemConfig.icon;
- if (itemConfig.itemTag == 3)
- {
- Text_SucceedDesc.text = $"+{itemConfig.associateVlaue[2]}%";
- // Text_FailDesc.text = $"-{itemConfig.associateVlaue[3]}%";
- }
- else
- {
- Text_SucceedDesc.text = $"+{itemConfig.associateVlaue[2]}%";
- }
- if (PlayerManager.Instance.BagController.IsEnough(itemId, 1))
- {
- Btn_Affirm.gameObject.SetActive(true);
- Btn_Cancel.gameObject.SetActive(true);
- Text_NoEnough.gameObject.SetActive(false);
- }
- else
- {
- Btn_Affirm.gameObject.SetActive(false);
- Btn_Cancel.gameObject.SetActive(true);
- Text_NoEnough.gameObject.SetActive(true);
- }
- }
- public async static CTask<SelectBreakthroughItemPanel> OpenPanel(int itemId, Action callBack)
- {
- SelectBreakthroughItemPanel selectBreakthroughItemPanel = await UIManager.Instance.LoadAndOpenPanel<SelectBreakthroughItemPanel>(null);
- selectBreakthroughItemPanel.CustomInit(itemId, callBack);
- return selectBreakthroughItemPanel;
- }
- }
- }
|