188 lines
5.4 KiB
C#
188 lines
5.4 KiB
C#
|
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using GCGame.Table;
|
|||
|
using GCGame;
|
|||
|
|
|||
|
public class RedPacketDetailRoot : UIControllerBase<RedPacketDetailRoot>
|
|||
|
{
|
|||
|
void OnEnable()
|
|||
|
{
|
|||
|
SetInstance(this);
|
|||
|
}
|
|||
|
|
|||
|
void OnDisable()
|
|||
|
{
|
|||
|
SetInstance(null);
|
|||
|
}
|
|||
|
|
|||
|
public void CloseWindow()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.RedPacketDetailRoot);
|
|||
|
}
|
|||
|
|
|||
|
#region static
|
|||
|
|
|||
|
public static void ShowRedPacketDetail(GC_RET_RED_PACKET_DETAIL_INFO packet)
|
|||
|
{
|
|||
|
Hashtable hash = new Hashtable();
|
|||
|
hash.Add("Packet", packet);
|
|||
|
UIManager.ShowUI(UIInfo.RedPacketDetailRoot, OnRedPacketDetailShow, hash);
|
|||
|
}
|
|||
|
|
|||
|
static void OnRedPacketDetailShow(bool bSuccess, object param)
|
|||
|
{
|
|||
|
Hashtable hash = param as Hashtable;
|
|||
|
if (!bSuccess)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (hash == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (RedPacketDetailRoot.Instance() != null)
|
|||
|
{
|
|||
|
RedPacketDetailRoot.Instance().Show((GC_RET_RED_PACKET_DETAIL_INFO)hash["Packet"]);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region
|
|||
|
|
|||
|
public Image _Icon;
|
|||
|
public Text _Name;
|
|||
|
public Text _Message;
|
|||
|
public GameObject _PickFinish;
|
|||
|
public GameObject _Picked;
|
|||
|
public GameObject _OnlyVipCanPick;
|
|||
|
public GameObject _OverTime;
|
|||
|
public UICurrencyItem _PickValue;
|
|||
|
public Text _PacketCnt;
|
|||
|
public UICurrencyItem _PacketValue;
|
|||
|
public UIContainerBase _PickPlayers;
|
|||
|
|
|||
|
public void Show(GC_RET_RED_PACKET_DETAIL_INFO packet)
|
|||
|
{
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(_Icon, Utils.GetProfessionSpriteName(packet.Profession));
|
|||
|
_Name.text = packet.SenderName;
|
|||
|
_Message.text = packet.PacketInfo;
|
|||
|
if (packet.SelfPickNum > 0)
|
|||
|
{
|
|||
|
_PickFinish.SetActive(false);
|
|||
|
_Picked.SetActive(true);
|
|||
|
|
|||
|
//if (VipData.GetVipLv() > 0)
|
|||
|
//{
|
|||
|
// MessageBoxLogic.OpenOKBox(StrDictionary.GetClientDictionaryString("#{40109}", packet.SelfPickNum));
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// string msg = StrDictionary.GetClientDictionaryString("#{40109}", packet.SelfPickNum) + "\n" + StrDictionary.GetClientDictionaryString("#{40110}");
|
|||
|
// MessageBoxLogic.OpenOKCancelBox(msg, "", OnVipOkClick, OnVipCancelClick);
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
_PacketCnt.text = packet.pickUserInfoCount + "/" + packet.PacketNum;
|
|||
|
_PacketValue.SetColor("<color=#B441B2FF>");
|
|||
|
_PacketValue.ShowCurrency(MONEYTYPE.MONEYTYPE_COIN, packet.MoneyNum);
|
|||
|
|
|||
|
List<RedPacketPickInfo> pickInfos = new List<RedPacketPickInfo>();
|
|||
|
RedPacketPickInfo bestPick = null;
|
|||
|
RedPacketPickInfo worsePick = null;
|
|||
|
RedPacketPickInfo myPick = null;
|
|||
|
for (int i = 0; i < packet.pickUserInfoList.Count; ++i)
|
|||
|
{
|
|||
|
RedPacketPickInfo pickInfo = new RedPacketPickInfo();
|
|||
|
pickInfos.Add(pickInfo);
|
|||
|
|
|||
|
pickInfo.Name = packet.pickUserInfoList[i].Names;
|
|||
|
pickInfo.Value = packet.pickUserInfoList[i].Num;
|
|||
|
|
|||
|
if (packet.pickUserInfoList.Count > 2)
|
|||
|
{
|
|||
|
if (bestPick == null)
|
|||
|
{
|
|||
|
bestPick = pickInfo;
|
|||
|
}
|
|||
|
else if(pickInfo.Value > bestPick.Value)
|
|||
|
{
|
|||
|
bestPick = pickInfo;
|
|||
|
}
|
|||
|
|
|||
|
if (worsePick == null)
|
|||
|
{
|
|||
|
worsePick = pickInfo;
|
|||
|
}
|
|||
|
else if (pickInfo.Value < worsePick.Value)
|
|||
|
{
|
|||
|
worsePick = pickInfo;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if (packet.pickUserInfoList[i].Names == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.RoleName)
|
|||
|
{
|
|||
|
myPick = pickInfo;
|
|||
|
}
|
|||
|
}
|
|||
|
if(bestPick != null)
|
|||
|
bestPick.IsBest = true;
|
|||
|
|
|||
|
if (worsePick != null)
|
|||
|
worsePick.IsWorse = true;
|
|||
|
|
|||
|
pickInfos.Reverse();
|
|||
|
_PickPlayers.InitContentItem(pickInfos);
|
|||
|
|
|||
|
if (myPick != null)
|
|||
|
{
|
|||
|
_PickFinish.SetActive(false);
|
|||
|
_Picked.SetActive(true);
|
|||
|
_OnlyVipCanPick.SetActive(false);
|
|||
|
_OverTime.SetActive(false);
|
|||
|
|
|||
|
_PickValue.SetColor("<color=#865d1b>");
|
|||
|
_PickValue.ShowCurrency(MONEYTYPE.MONEYTYPE_COIN, myPick.Value);
|
|||
|
}
|
|||
|
else if ((int)RedPacketBriefInfo.ERedPacketState.EOutofTM == packet.PacketState)
|
|||
|
{
|
|||
|
_PickFinish.SetActive(false);
|
|||
|
_Picked.SetActive(false);
|
|||
|
_OnlyVipCanPick.SetActive(false);
|
|||
|
_OverTime.SetActive(true);
|
|||
|
}
|
|||
|
else if (myPick == null/* && VipData.GetVipLv() > 0*/)
|
|||
|
{
|
|||
|
_PickFinish.SetActive(true);
|
|||
|
_Picked.SetActive(false);
|
|||
|
_OnlyVipCanPick.SetActive(false);
|
|||
|
_OverTime.SetActive(false);
|
|||
|
}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// _PickFinish.SetActive(false);
|
|||
|
// _Picked.SetActive(false);
|
|||
|
// _OnlyVipCanPick.SetActive(true);
|
|||
|
// _OverTime.SetActive(false);
|
|||
|
//}
|
|||
|
}
|
|||
|
|
|||
|
public void OnVipOkClick()
|
|||
|
{
|
|||
|
YuanBaoShopLogic.OpenChargePage();
|
|||
|
}
|
|||
|
|
|||
|
public void OnVipCancelClick()
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{40117}"));
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|