| | |
| | | |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | | LoadPrefab().Forget(); |
| | | } |
| | | |
| | | //showState 0:不显示 1:新增 2:提升 |
| | | //giftID 0 :代表灰色需升星激活 -1:代表棕色需觉醒激活,其他根据配表,没有天赋的外层控制显隐 |
| | | public void Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0) |
| | | public async UniTask Init(int giftID, int lv, int showState = 0, int heroID = 0, int index = 0, int awakeLevel = 0) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | if (this == null) return; |
| | | if (HeroTalentConfig.HasKey(giftID)) |
| | | { |
| | | var config = HeroTalentConfig.Get(giftID); |
| | |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell"); |
| | | var inst = await UIUtility.CreateWidget("GiftBaseCell", "Container_GiftCell"); |
| | | |
| | | if (this == null) |
| | | { |
| | | if (null != cellContainer) |
| | | { |
| | | GameObject.DestroyImmediate(cellContainer); |
| | | } |
| | | if (null != inst) GameObject.DestroyImmediate(inst); |
| | | return; |
| | | } |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | | GameObject.DestroyImmediate(inst); |
| | | return; |
| | | } |
| | | cellContainer = inst; |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | | cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | cellContainer.transform.SetAsFirstSibling(); |
| | | } |