// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2021-04-12 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** using TMPro; using UnityEngine; using UnityEngine.UI; namespace G.UI { /// /// /// public class BeautySimpleWidget : KUIWidget { #region Field #pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null [KUIFlag] Image _imgPicture; [KUIFlag] TextMeshProUGUI _tmpName; //[KUIFlag] //TextMeshProUGUI _tmpDescription; [KUIFlag] TextMeshProUGUI _tmpGainway; [KUIFlag] TextMeshProUGUI _tmpMeet; [KUIFlag] KUIList __listFriend; [KUIFlag] GameObject _goActived; #pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null #endregion #region Method public override void Refresh() { if (this.data is BeautyProxy.BeautyInfo beautyInfo) { var beautyItem = beautyInfo.item; _tmpName.text = beautyItem.name; IconProxy.Instance.SetSprite(_imgPicture, beautyItem.icon); if (beautyInfo.isFriend) { _tmpMeet.gameObject.SetActive(true); _tmpMeet.text = beautyItem.location; _goActived.SetActive(true); __listFriend.Clear(); _tmpGainway.gameObject.SetActive(false); } else if (beautyInfo.isUnlock) { __listFriend.Clear(); for (int i = 0; i < beautyInfo.friendMax; i++) { __listFriend.GetItem().SetGray(i >= beautyInfo.friend); } //_tmpDescription.gameObject.SetActive(false); _tmpGainway.gameObject.SetActive(false); _goActived.SetActive(false); _tmpMeet.gameObject.SetActive(true); _tmpMeet.text = beautyItem.location; } else { //_tmpDescription.gameObject.SetActive(true); //_tmpDescription.text = beautyItem.description; _tmpGainway.gameObject.SetActive(true); _tmpGainway.text = beautyInfo.gainWayText; _goActived.SetActive(false); __listFriend.Clear(); _tmpMeet.gameObject.SetActive(false); } } } #endregion #region Unity /// /// /// private void Awake() { SetViewData(); __listFriend.AddTemplate(true); } #endregion } }