using UnityEngine; using UnityEngine.UI; using TEngine; using Cysharp.Threading.Tasks; using TMPro; namespace GameLogic { [Window(UILayer.UI)] class UIVipItem : UIWindow { #region 脚本工具生成的代码 private RawImage m_rimg_HeadIcon; private RectTransform m_rect01; private RectTransform m_rect02; private RectTransform m_rect03; private RectTransform m_rect04; private TextMeshProUGUI m_tmp_Rank; private TextMeshProUGUI m_tmp_TeamName; private TextMeshProUGUI m_tmp_PlayerName; private RectTransform m_rect_TimeLine01; private RectTransform m_rect_TimeLine02; private RectTransform m_rect_TimeLine03; private RectTransform m_rect_TimeLine04; protected override void ScriptGenerator() { m_rimg_HeadIcon = FindChildComponent("SJRC/TX/m_rimg_HeadIcon"); m_rect01 = FindChildComponent("SJRC/m_rect01"); m_rect02 = FindChildComponent("SJRC/m_rect02"); m_rect03 = FindChildComponent("SJRC/m_rect03"); m_rect04 = FindChildComponent("SJRC/m_rect04"); m_tmp_Rank = FindChildComponent("SJRC/m_tmp_Rank"); m_tmp_TeamName = FindChildComponent("SJRC/m_tmp_TeamName"); m_tmp_PlayerName = FindChildComponent("SJRC/m_tmp_PlayerName"); m_rect_TimeLine01 = FindChildComponent("SJRC/Timeline/m_rect_TimeLine01"); m_rect_TimeLine02 = FindChildComponent("SJRC/Timeline/m_rect_TimeLine02"); m_rect_TimeLine03 = FindChildComponent("SJRC/Timeline/m_rect_TimeLine03"); m_rect_TimeLine04 = FindChildComponent("SJRC/Timeline/m_rect_TimeLine04"); } #endregion #region 事件 #endregion protected async override void OnCreate() { base.OnCreate(); Canvas.sortingLayerName = "UI02"; VipItemData giftItemData = UserData as VipItemData; if (giftItemData == null) { GameModule.UI.CloseUI(); return; } if (giftItemData.m_ProtCustMessageData.imgURL != string.Empty) { AsyncImageDownload.Instance.SetAsyncImage(giftItemData.m_ProtCustMessageData.imgURL, m_rimg_HeadIcon); } m_tmp_PlayerName.text = UITool.ConvertName(giftItemData.m_ProtCustMessageData.nickName); m_tmp_Rank.text = giftItemData.m_RankNum.ToString(); var data = DataGameSceneManager.Instance.GetUnitPlayerData(giftItemData.m_ProtCustMessageData.openId); if (data != null) { m_tmp_TeamName.text = DataGameSceneManager.Instance.GetStrs(int.Parse(data.teamId) - 1); } m_rect01.gameObject.SetActive(false); m_rect02.gameObject.SetActive(false); m_rect03.gameObject.SetActive(false); m_rect04.gameObject.SetActive(false); m_rect_TimeLine01.gameObject.SetActive(false); m_rect_TimeLine02.gameObject.SetActive(false); m_rect_TimeLine03.gameObject.SetActive(false); m_rect_TimeLine04.gameObject.SetActive(false); if (giftItemData.m_RankNum == 1) { m_rect01.gameObject.SetActive(true); m_rect_TimeLine01.gameObject.SetActive(true); } else if (giftItemData.m_RankNum == 2) { m_rect02.gameObject.SetActive(true); m_rect_TimeLine02.gameObject.SetActive(true); } else if (giftItemData.m_RankNum == 3) { m_rect03.gameObject.SetActive(true); m_rect_TimeLine03.gameObject.SetActive(true); } else { m_rect04.gameObject.SetActive(true); m_rect_TimeLine04.gameObject.SetActive(true); } await UniTask.Delay(4000); GameModule.UI.CloseUI(); } } }