| | |
| | | |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | | LoadPrefab().Forget(); |
| | | } |
| | | |
| | | // 武将小头像,(职业和名称不再此管理,各个界面排版不同) |
| | | public void Init(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null) |
| | | public async UniTask Init(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | if (this == null) return; |
| | | if (onclick != null) |
| | | { |
| | | clickBtn.AddListener(onclick); |
| | |
| | | // 武将小头像 Async版本 |
| | | public async UniTask InitAsync(int heroID, int skinID, int star = 0, int awakelv = 0, int lv = 0, UnityAction onclick = null) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | if (this == null) return; |
| | | if (onclick != null) |
| | | { |
| | | clickBtn.AddListener(onclick); |
| | |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = await UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell"); |
| | | var inst = await UIUtility.CreateWidget("HeroHeadBaseCell", "Container_HeadCell"); |
| | | |
| | | if (this == null) |
| | | { |
| | | if (cellContainer != null) |
| | | { |
| | | DestroyImmediate(cellContainer); |
| | | return; |
| | | } |
| | | 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(); |
| | | } |