79 lines
1.8 KiB
C#
79 lines
1.8 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2021-05-02
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "GemAttributeItem" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
namespace G.UI
|
|
{
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class GemAttributeItem : KUIWidget
|
|
{
|
|
[KUIFlag]
|
|
KUIImage _imgFrame;
|
|
[KUIFlag]
|
|
Image _imgIcon;
|
|
[KUIFlag]
|
|
KUIImage _imgLevel;
|
|
[KUIFlag]
|
|
TextMeshProUGUI _tmpLevel;
|
|
[KUIFlag]
|
|
TextMeshProUGUI _tmpName;
|
|
[KUIFlag]
|
|
TextMeshProUGUI _tmpValue;
|
|
|
|
private void Awake()
|
|
{
|
|
SetViewData();
|
|
_imgFrame.GetComponent<Button>().onClick.AddListener(this.OnFrameBtnClick);
|
|
}
|
|
|
|
public override void Refresh()
|
|
{
|
|
if (this.data is EntityItemGem gem)
|
|
{
|
|
_tmpName.text = gem.propItem.name;
|
|
_tmpLevel.text = gem.level.ToString();
|
|
|
|
_imgLevel.gameObject.SetActive(true);
|
|
_tmpValue.text = gem.ToString();
|
|
|
|
_imgFrame.ShowSprite(-1);
|
|
_imgIcon.color = Color.white;
|
|
IconProxy.Instance.SetSprite(_imgIcon, gem.propItem.icon);
|
|
}
|
|
else if (this.data is string text)
|
|
{
|
|
_tmpName.text = text;
|
|
_tmpValue.text = "";
|
|
_imgIcon.overrideSprite = null;
|
|
_imgLevel.gameObject.SetActive(false);
|
|
|
|
_imgIcon.color = Color.clear;
|
|
if (text == "可镶嵌宝石")
|
|
{
|
|
_imgFrame.ShowSprite(0);
|
|
}
|
|
else
|
|
{
|
|
_imgFrame.ShowSprite(1);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnFrameBtnClick()
|
|
{
|
|
var gemProp = ItemProxy.Instance.GetStaticItem<ItemProp>(10000);
|
|
KUIWindow.OpenWindow<GainwayBox>(gemProp);
|
|
}
|
|
}
|
|
}
|