12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using GameLogic.Bag;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "DivineSenceInfoBtnWidget")]
- public partial class DivineSenceInfoBtnWidget : ItemWidgetBasic
- {
- public ItemInfo ItemInfo;
- public int type;
- private void Init()
- {
- }
- public override void AddEvent()
- {
- }
- public override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- base.AddButtonEvent();
- }
- public void CustomInit(int id, int type)
- {
- this.type = type;
- if (type == 1)
- {
- Icon_ItemIcon.gameObject.SetActive(false);
- Icon_ShenIcon.gameObject.SetActive(true);
- // Icon_ItemIcon.icon_name = ItemInfo.config.icon;
- Text_ItemCount.text =
- $"<color=#EF9F32>{100 * 1}</color>/{AccountFileInfo.Instance.playerData.divineSensePoint}";
- }
- else
- {
- if (id == -1)
- {
- ItemInfo = null;
- Icon_ItemIcon.gameObject.SetActive(false);
- Icon_ShenIcon.gameObject.SetActive(false);
- Text_ItemCount.text = "";
- icon_Jia.gameObject.SetActive(true);
- }
- else
- {
- icon_Jia.gameObject.SetActive(false);
- ItemInfo = PlayerManager.Instance.BagController.GetItemInfo(id);
- Icon_ItemIcon.gameObject.SetActive(transform);
- Icon_ShenIcon.gameObject.SetActive(false);
- Text_ItemCount.text = $"{1}/{ItemInfo.count.Value.ToString()}";
- if (ItemInfo.config.associateID == 7)
- {
- Icon_ItemIcon.icon_name = "icon_shenshitishengfu";
- Icon_ItemIcon2.icon_name = ItemInfo.config.icon;
- Icon_ItemIcon2.gameObject.SetActive(true);
- }
- else
- {
- Icon_ItemIcon.icon_name = ItemInfo.config.icon;
- Icon_ItemIcon2.gameObject.SetActive(false);
- }
- }
- }
- }
- public void UpdateItermCount(int selectCount)
- {
- if (type == 1)
- {
- Text_ItemCount.text =
- $"<color=#EF9F32>{100 * selectCount}</color>/{AccountFileInfo.Instance.playerData.divineSensePoint}";
- }
- else
- {
- if (ItemInfo != null)
- {
- selectCount = selectCount > ItemInfo.count.Value ? (int)ItemInfo.count.Value : selectCount;
- Text_ItemCount.text = $"<color=#EF9F32>{selectCount}</color>/{ItemInfo.count.Value.ToString()}";
- }
- }
- }
- }
- }
|