134 lines
4.4 KiB
C#
134 lines
4.4 KiB
C#
|
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using GCGame.Table;
|
|||
|
using Games.Mission;
|
|||
|
using Games.Events;
|
|||
|
|
|||
|
public class RoleViewJifenItem : UIItemBase
|
|||
|
{
|
|||
|
#region
|
|||
|
|
|||
|
public class JifenInfo
|
|||
|
{
|
|||
|
public int IntegralShopId;
|
|||
|
public string name;
|
|||
|
public long value;
|
|||
|
public int dayValue;
|
|||
|
public int dayMax;
|
|||
|
public string icon;
|
|||
|
public int shopId;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
public Text _NameTx;
|
|||
|
public Text _Value;
|
|||
|
public Text _DayValue;
|
|||
|
public Image _Icon;
|
|||
|
public int shopId;
|
|||
|
private JifenInfo _JifenInfo;
|
|||
|
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
base.Show();
|
|||
|
|
|||
|
var jifen = (JifenInfo)hash["InitObj"];
|
|||
|
InitItem(jifen);
|
|||
|
}
|
|||
|
|
|||
|
private int curIntegralShopId = -1;
|
|||
|
protected void InitItem(JifenInfo itemParam)
|
|||
|
{
|
|||
|
if (itemParam == null)
|
|||
|
return;
|
|||
|
|
|||
|
_JifenInfo = itemParam;
|
|||
|
_NameTx.text = _JifenInfo.name;
|
|||
|
_Value.text = _JifenInfo.value.ToString();
|
|||
|
_DayValue.text = _JifenInfo.dayValue.ToString() + "/" + _JifenInfo.dayMax.ToString();
|
|||
|
curIntegralShopId = _JifenInfo.IntegralShopId;
|
|||
|
shopId = itemParam.shopId;
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, _JifenInfo.icon);
|
|||
|
}
|
|||
|
|
|||
|
public override void Awake()
|
|||
|
{
|
|||
|
base.Awake();
|
|||
|
GUIData.delMoneyChanged += UpdateOwnValue;
|
|||
|
}
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
GUIData.delMoneyChanged -= UpdateOwnValue;
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateOwnValue()
|
|||
|
{
|
|||
|
Tab_SystemShop shop = TableManager.GetSystemShopByID(curIntegralShopId, 0);
|
|||
|
if (shop != null)
|
|||
|
{
|
|||
|
int curConsumeType = shop.GetMoneyTypebyIndex(0);
|
|||
|
int consumeSubType = shop.GetMoneySubTypebyIndex(0);
|
|||
|
switch (curConsumeType)
|
|||
|
{
|
|||
|
case (int)CONSUM_TYPE.MONEY:
|
|||
|
{
|
|||
|
switch (consumeSubType)
|
|||
|
{
|
|||
|
case (int)MONEYTYPE.MONEYTYPE_COIN:
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.Money.GetMoney_Coin()).ToString();
|
|||
|
break;
|
|||
|
case (int)MONEYTYPE.MONEYTYPE_YUANBAO:
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBao()).ToString();
|
|||
|
break;
|
|||
|
case (int)MONEYTYPE.MONEYTYPE_YUANBAO_BIND:
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.Money.GetMoney_YuanBaoBind()).ToString();
|
|||
|
break;
|
|||
|
case (int)MONEYTYPE.MONEYTYPE_COIN_BIND:
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.Money.GetMoney_CoinBind()).ToString();
|
|||
|
break;
|
|||
|
case (int)MONEYTYPE.MONEYTYPE_USERCHALLENGE:
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.Money.GetMoney_ChallengeScore()).ToString();
|
|||
|
break;
|
|||
|
case (int)MONEYTYPE.MONEYTYPE_SNATCHSCORE:
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.Money.GetMoney_SnatchScore()).ToString();
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
case (int)CONSUM_TYPE.PROPVAL:
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.GetPropInt((PropID.PropertyID)consumeSubType)).ToString();
|
|||
|
break;
|
|||
|
case (int)CONSUM_TYPE.SCORE:
|
|||
|
if ((int)SCORE_TYPE.GUILD_SCORE == consumeSubType)
|
|||
|
{
|
|||
|
_Value.text = (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildContribute).ToString();
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_Value.text = "0";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override void OnItemClick()
|
|||
|
{
|
|||
|
SysShopController.ShowShop(shopId);
|
|||
|
//UIManager.ShowUI(UIInfo.SysShop, delegate (bool bSucess, object param)
|
|||
|
//{
|
|||
|
// if (bSucess)
|
|||
|
// {
|
|||
|
// if (SysShopController.Instance() != null)
|
|||
|
// {
|
|||
|
// SysShopController.Instance().InitShop(shopId, true);
|
|||
|
// }
|
|||
|
// }
|
|||
|
//});
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|