109 lines
3.5 KiB
C#
109 lines
3.5 KiB
C#
using Games.LogicObj;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
using System.Collections;
|
|
using GCGame;
|
|
using Module.Log;
|
|
using Games.GlobeDefine;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using System;
|
|
|
|
public class FreightItemData
|
|
{
|
|
public int Index;
|
|
public ulong Guid;
|
|
public int Freightid;
|
|
public int IsActive;
|
|
public int IsSeekHelp;
|
|
}
|
|
|
|
public class GuildTransPortItem : UIItemSelect
|
|
{
|
|
public Text Num;
|
|
public GameObject MaskImage;
|
|
public GameObject FinishImage;
|
|
public Image Icon;
|
|
public Image Quility;
|
|
|
|
FreightItemData m_FreightItem;
|
|
Tab_GuildFreightPool m_table = null;
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
m_FreightItem = hash["InitObj"] as FreightItemData;
|
|
if (m_FreightItem == null)
|
|
return;
|
|
Tab_GuildFreightPool table = TableManager.GetGuildFreightPoolByID(m_FreightItem.Freightid, 0);
|
|
if (table == null)
|
|
return;
|
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(table.ItemId, 0);
|
|
if (commonItem == null)
|
|
return;
|
|
m_table = table;
|
|
bool isSelfadd = (Singleton<ObjManager>.Instance.MainPlayer.GUID == m_FreightItem.Guid);
|
|
|
|
int hasNum = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(table.ItemId);
|
|
if (hasNum < table.ItemNum && (isSelfadd && m_FreightItem.IsActive != 1))
|
|
{
|
|
Num.text = string.Format("{2}{0}</color>/{1}", hasNum, table.ItemNum, StrDictionary.GetClientDictionaryString("#{5526}"));
|
|
}
|
|
else
|
|
{
|
|
Num.text = string.Format("{0}/{1}", hasNum, table.ItemNum);
|
|
}
|
|
if(isSelfadd && m_FreightItem.IsActive != 1)
|
|
SysShopController.AddNeed((int)SysShopController.ItemNeedSys.GuildTransport, table.ItemId, table.ItemNum);
|
|
if (m_FreightItem.IsActive == 1)
|
|
Num.text = StrDictionary.GetClientDictionaryString("#{27030}");
|
|
if (isSelfadd == false)
|
|
{
|
|
if (m_FreightItem.IsSeekHelp != 1)
|
|
Num.gameObject.SetActive(false);
|
|
}
|
|
|
|
MaskImage.gameObject.SetActive(false);
|
|
if (isSelfadd == false)
|
|
{
|
|
if (m_FreightItem.IsSeekHelp != 1)
|
|
MaskImage.gameObject.SetActive(true);
|
|
}
|
|
FinishImage.gameObject.SetActive(isSelfadd && m_FreightItem.IsActive == 1);
|
|
LoadAssetBundle.Instance.SetImageSprite(Icon, commonItem.Icon);
|
|
LoadAssetBundle.Instance.SetImageSprite(Quility, Utils.GetItemQualityFrame(commonItem));
|
|
if (commonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, Icon.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, Icon.transform);
|
|
}
|
|
|
|
base.Show();
|
|
}
|
|
|
|
public override void Refresh()
|
|
{
|
|
base.Refresh();
|
|
if (m_FreightItem.IsActive == 1)
|
|
return;
|
|
int hasNum = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(m_table.ItemId);
|
|
if (Num.gameObject.activeSelf)
|
|
{
|
|
if (hasNum < m_table.ItemNum)
|
|
{
|
|
Num.text = string.Format("<color=#ff0000ff>{0}</color>/{1}", hasNum, m_table.ItemNum);
|
|
}
|
|
else
|
|
{
|
|
Num.text = string.Format("{0}/{1}", hasNum, m_table.ItemNum);
|
|
}
|
|
}
|
|
|
|
SysShopController.AddNeed((int)SysShopController.ItemNeedSys.GuildTransport, m_table.ItemId,m_table.ItemNum);
|
|
|
|
}
|
|
}
|