110 lines
3.0 KiB
C#
110 lines
3.0 KiB
C#
|
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using GCGame.Table;
|
|||
|
using GCGame;
|
|||
|
using Games.Item;
|
|||
|
|
|||
|
public class AnalyzeGameItem : UIItemBase
|
|||
|
{
|
|||
|
public const float MOVETIME = 0.6f;
|
|||
|
|
|||
|
public class BackItemInfo
|
|||
|
{
|
|||
|
public int ItemType;
|
|||
|
public int ItemSubType;
|
|||
|
public int ItemNum;
|
|||
|
public bool IsFrenzy;
|
|||
|
public GameItem gameItem;
|
|||
|
|
|||
|
public BackItemInfo()
|
|||
|
{
|
|||
|
Clear();
|
|||
|
}
|
|||
|
|
|||
|
public bool IsVaild()
|
|||
|
{
|
|||
|
return ItemType != -1 && ItemSubType != -1;
|
|||
|
}
|
|||
|
|
|||
|
public void Clear()
|
|||
|
{
|
|||
|
ItemType = -1;
|
|||
|
ItemSubType = -1;
|
|||
|
ItemNum = 0;
|
|||
|
gameItem = null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public Image QuilityIcon;
|
|||
|
public Image ImageIcon;
|
|||
|
public Text NumText;
|
|||
|
public RectTransform InfoObj;
|
|||
|
|
|||
|
private BackItemInfo m_gameItem;
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
m_gameItem = (BackItemInfo)hash["InitObj"];
|
|||
|
InfoObj.localPosition = Vector3.one;
|
|||
|
InfoObj.localScale = Vector3.one;
|
|||
|
|
|||
|
Refresh();
|
|||
|
base.Show(hash);
|
|||
|
}
|
|||
|
|
|||
|
public override void Refresh(Hashtable hash)
|
|||
|
{
|
|||
|
base.Refresh(hash);
|
|||
|
if(hash.ContainsKey("Move") && gameObject.activeInHierarchy)
|
|||
|
{
|
|||
|
if(BackPackLogic.Instance()!=null && BackPackLogic.Instance()._AnalyzeGame!=null)
|
|||
|
{
|
|||
|
BackPackLogic.Instance()._AnalyzeGame.AddAnimationItem(ImageIcon);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override void Refresh()
|
|||
|
{
|
|||
|
if (m_gameItem == null || m_gameItem.IsVaild() == false || m_gameItem.ItemNum<=0)
|
|||
|
{
|
|||
|
InfoObj.gameObject.SetActive(false);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
InfoObj.gameObject.SetActive(true);
|
|||
|
if(m_gameItem.ItemType == 3)
|
|||
|
{
|
|||
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(m_gameItem.ItemSubType, 0);
|
|||
|
if (commonItem == null)
|
|||
|
return;
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(QuilityIcon, Utils.GetItemQualityFrame((int)commonItem.Quality,commonItem.SuperEquipment>0,m_gameItem.IsFrenzy));
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(ImageIcon, commonItem.Icon);
|
|||
|
}
|
|||
|
else if(m_gameItem.ItemType == 4)
|
|||
|
{
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(QuilityIcon, Utils.GetItemQualityFrame(3));
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(ImageIcon, UICurrencyItem.GetMoneyItemIcon((MONEYTYPE)m_gameItem.ItemSubType));
|
|||
|
}
|
|||
|
if (m_gameItem.ItemNum <= 1)
|
|||
|
NumText.text = "";
|
|||
|
else
|
|||
|
{
|
|||
|
if (m_gameItem.ItemNum > 10000)
|
|||
|
{
|
|||
|
NumText.text = StrDictionary.GetClientDictionaryString("#{2972}",string.Format("{0}", Math.Round( m_gameItem.ItemNum*1.0f/10000,1)));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
NumText.text = m_gameItem.ItemNum.ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
base.Refresh();
|
|||
|
}
|
|||
|
|
|||
|
}
|