Files
JJBB/Assets/Project/Script/GUI/RedPacket/RedPacketLogRoot.cs
2024-08-23 15:49:34 +08:00

97 lines
2.5 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using Games.GlobeDefine;
using GCGame.Table;
using GCGame;
public class RedPacketLogRoot : UIControllerBase<RedPacketLogRoot>
{
void OnEnable()
{
SetInstance(this);
}
void OnDisable()
{
SetInstance(null);
}
public void CloseWindow()
{
UIManager.CloseUI(UIInfo.RedPacketLogRoot);
}
#region static
public static void ShowRedPacketLog(GC_RET_PICK_RED_PACKET_INFO packet)
{
Hashtable hash = new Hashtable();
hash.Add("Packet", packet);
UIManager.ShowUI(UIInfo.RedPacketLogRoot, OnRedPacketLogShow, hash);
}
static void OnRedPacketLogShow(bool bSuccess, object param)
{
Hashtable hash = param as Hashtable;
if (!bSuccess)
{
return;
}
if (hash == null)
{
return;
}
if (RedPacketLogRoot.Instance() != null)
{
RedPacketLogRoot.Instance().Show((GC_RET_PICK_RED_PACKET_INFO)hash["Packet"]);
}
}
#endregion
#region
public Text _GetTotalCnt;
public Text _SendTotalCnt;
public UICurrencyItem _GetTotalValue;
public UICurrencyItem _SendTotalValue;
public UIContainerBase _RedPacketLogContainer;
public void Show(GC_RET_PICK_RED_PACKET_INFO packet)
{
List<PickRedPacketMsg> pickLog = new List<PickRedPacketMsg>(packet.pickRedPacketInfoList);
pickLog.Reverse();
_RedPacketLogContainer.InitContentItem(pickLog);
int totalGetCnt = 0;
int totalGetValue = 0;
int totalSendCnt = 0;
int totalSendValue = 0;
for (int i = 0; i < packet.pickRedPacketInfoCount; ++i)
{
if (packet.pickRedPacketInfoList[i].Type == (int)PickRedPacketMsg.EHandlePacketType.PacketOut)
{
totalSendValue += packet.pickRedPacketInfoList[i].Num;
++totalSendCnt;
}
else
{
totalGetValue += packet.pickRedPacketInfoList[i].Num;
++totalGetCnt;
}
}
_GetTotalCnt.text = StrDictionary.GetClientDictionaryString("{#40108}", totalGetCnt);
_SendTotalCnt.text = StrDictionary.GetClientDictionaryString("{#40108}", totalSendCnt);
_GetTotalValue.ShowCurrency(MONEYTYPE.MONEYTYPE_COIN, totalGetValue);
_SendTotalValue.ShowCurrency(MONEYTYPE.MONEYTYPE_COIN, totalSendValue);
}
#endregion
}