| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using GameLogic.Hero;
- using UnityEngine;
- namespace Fort23.Mono
- {
- [UIBinding(prefab = "BtnFaBaoWidget")]
- public partial class BtnFaBaoWidget : ItemWidgetBasic
- {
- public int index;
- private FaBaoWidget faBaoWidget;
- private void Init()
- {
- }
- public override void AddEvent()
- {
- }
- public override void DelEvent()
- {
- }
- public override void AddButtonEvent()
- {
- base.AddButtonEvent();
- }
- public async void CustomInit(int index)
- {
- own.name = "BtnFaBaoWidget" + index;
- UIManager.Instance.DormancyGComponent(faBaoWidget);
- faBaoWidget = null;
- this.index = index;
- FaBaoInfo faBaoInfo = PlayerManager.Instance.FaBaoControl.FightFaBao[index];
- if (faBaoInfo != null)
- {
- faBaoWidget = await UIManager.Instance.CreateGComponent<FaBaoWidget>(null, FaBaoRoot);
- faBaoWidget.CustomInit(faBaoInfo, false);
- faBaoWidget.transform.anchorMin = new Vector2(0.5f, 0.5f);
- faBaoWidget.transform.anchorMax = new Vector2(0.5f, 0.5f);
- faBaoWidget.transform.pivot = new Vector2(0.5f, 0.5f);
- faBaoWidget.transform.anchoredPosition = Vector2.zero;
- }
- else
- {
- UIManager.Instance.DormancyGComponent(faBaoWidget);
- faBaoWidget = null;
- }
- RedDotComType01.CustomInit(9, new object[] { faBaoInfo, index });
- if (index > PlayerManager.Instance.myHero.powerUpConfig.MaxFabaoNum - 1)
- {
- reorderableListElement.isNoCalculation = true;
- reorderableListElement.IsGrabbable = false;
- }
- else
- {
- reorderableListElement.isNoCalculation = false;
- reorderableListElement.IsGrabbable = true;
- }
- }
- public override void DormancyObj()
- {
- UIManager.Instance.DormancyGComponent(faBaoWidget);
- faBaoWidget = null;
- base.DormancyObj();
- }
- }
- }
|