123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using Common.Utility.CombatEvent;
- using Core.Language;
- using Core.Utility;
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using GameLogic.Bag;
- using UnityEngine;
- using Utility;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "EnergyWidget")]
- public partial class EnergyWidget : UIComponent
- {
- public ItemConfig _itemConfig;
- private void Init()
- {
- }
- public override void AddEvent()
- {
- EventManager.Instance.AddEventListener(CustomEventType.ItemUpdate, Itemupdate);
- }
- private void Itemupdate(IEventData e)
- {
- ItemUpdateData data = e as ItemUpdateData;
- if (data.ItemInfo.itemID == _itemConfig.ID)
- {
- Text_Count.text = PlayerManager.Instance.BagController.GetItemCount(_itemConfig.ID).ToStringEx();
- }
- }
- public override void DelEvent()
- {
- EventManager.Instance.RemoveEventListener(CustomEventType.ItemUpdate, Itemupdate);
- }
- public override void AddButtonEvent()
- {
- Btn_Coin.onClick.AddListener(() =>
- {
-
- if (_itemConfig.associateID == 3)
- {
- GongFaDetailsPanel.Open(new ItemInfo(_itemConfig.ID));
- }
- else if (_itemConfig.associateID == 4)
- {
- FaBaoDetailsPanel.OpenPanel(new ItemInfo(_itemConfig.ID));
- }
- else
- {
- ItemDetailsPanel.OpenPanel(new ItemInfo(_itemConfig.ID));
- }
- });
- }
-
- public void CustomInit(int id)
- {
- _itemConfig = ConfigComponent.Instance.Get<ItemConfig>(id);
- Icon_Energy.icon_name = _itemConfig.icon;
- Text_Count.text = PlayerManager.Instance.BagController.GetItemCount(id).ToString();
- }
- }
- }
|