| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | //武将模型站台模块 |
| | | public class HeroShowBaseCell : MonoBehaviour |
| | |
| | | |
| | | void Awake() |
| | | { |
| | | LoadPrefab(); |
| | | LoadPrefab().Forget(); |
| | | } |
| | | |
| | | // 武将模型站台显示 |
| | | public void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false) |
| | | public async void Init(int heroID, int skinID, int breakLevel = 0, int star = 0, int awakelv = 0, int lv = 0, bool isShowLock = false) |
| | | { |
| | | LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | await LoadPrefab(); //存在被卸载的可能,重新加载 |
| | | var heroConfig = HeroConfig.Get(heroID); |
| | | qualityBG.SetSprite("herodz" + heroConfig.Quality); |
| | | // int skinID = 0; |
| | |
| | | // skinID = heroConfig.SkinIDList[0]; |
| | | // } |
| | | |
| | | heroModel.Create(skinID, heroConfig.UIScale); |
| | | heroModel.Create(skinID, heroConfig.UIScale).Forget(); |
| | | |
| | | if (star == 0) |
| | | { |
| | |
| | | { |
| | | SmallTipWin.showText = Language.Get("HeroGift14", star); |
| | | SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition); |
| | | UIManager.Instance.OpenWindow<SmallTipWin>(); |
| | | UIManager.Instance.OpenWindowAsync<SmallTipWin>().Forget(); |
| | | }); |
| | | } |
| | | |
| | | GameObject cellContainer; |
| | | protected void LoadPrefab() |
| | | protected async UniTask LoadPrefab() |
| | | { |
| | | if (cellContainer != null) |
| | | return; |
| | |
| | | } |
| | | if (cellContainer == null) |
| | | { |
| | | cellContainer = UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow"); |
| | | cellContainer = await UIUtility.CreateWidget("HeroShowBaseCell", "Container_HeroShow"); |
| | | |
| | | if (this == null) |
| | | { |
| | | if (cellContainer != null) |
| | | { |
| | | DestroyImmediate(cellContainer); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (cellContainer != null) |
| | | { |