106 lines
2.5 KiB
C#
Raw Permalink Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2021-04-12
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "BeautySimpleWidget" company="Kunpo"></copyright>
// <summary></summary>
// ***********************************************************************
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace G.UI
{
/// <summary>
///
/// </summary>
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<StarWidget>().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
/// <summary>
///
/// </summary>
private void Awake()
{
SetViewData();
__listFriend.AddTemplate<StarWidget>(true);
}
#endregion
}
}