| | |
| | | public async UniTask Init(int heroID, bool _gray = false, UnityAction onclick = null) |
| | | { |
| | | await LoadPrefab(); |
| | | clickBtn.AddListener(onclick); |
| | | if (this == null) return; |
| | | if (onclick != null) |
| | | clickBtn.AddListener(onclick); |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | qualityBG.SetSprite("heroheadBG" + heroConfig.Quality); |
| | | |
| | |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = await UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell"); |
| | | var inst = await UIUtility.CreateWidget("HeroHeadBaseNoTrainCell", "Container_HeadCell"); |
| | | |
| | | if (this == null) |
| | | { |
| | | if (cellContainer != null) |
| | | { |
| | | DestroyImmediate(cellContainer); |
| | | } |
| | | if (inst != null) DestroyImmediate(inst); |
| | | return; |
| | | } |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | | DestroyImmediate(inst); |
| | | return; |
| | | } |
| | | cellContainer = inst; |
| | | |
| | | if (cellContainer != null) |
| | | { |
| | | cellContainer.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | cellContainer.transform.SetAsFirstSibling(); |
| | | } |