132 lines
4.2 KiB
C#
132 lines
4.2 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using System;
|
||
using GCGame.Table;
|
||
using Games.GlobeDefine;
|
||
|
||
// 福利大厅-离线经验
|
||
// 字典
|
||
// 44072 - 可领高倍提示
|
||
// 44073 - 点击未开启项提示
|
||
// ????? - 离线经验为0,不可领取奖励提示
|
||
public class WelfareOffLineExpCtr : WelfarePageBaseCS {
|
||
|
||
private static WelfareOffLineExpCtr instance;
|
||
public static WelfareOffLineExpCtr Instance
|
||
{
|
||
get { return instance; }
|
||
}
|
||
|
||
private void Awake()
|
||
{
|
||
if(instance == null)
|
||
{
|
||
instance = this;
|
||
}
|
||
}
|
||
|
||
public override void OnPacketRec(NodePageInfoRet packet)
|
||
{
|
||
_NodeId = packet._NodeId;
|
||
_Packet = packet;
|
||
|
||
ShowInfo();
|
||
}
|
||
|
||
private void ShowInfo()
|
||
{
|
||
if(_Packet == null)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(_Packet._NodeDescList.Count > 0)
|
||
{
|
||
_DescLists[0].gameObject.SetActive(true);
|
||
_DescLists[0].text = StrDictionary.GetServerDictionaryFormatString(_Packet._NodeDescList[0]);
|
||
}
|
||
else
|
||
{
|
||
_DescLists[0].gameObject.SetActive(false);
|
||
}
|
||
|
||
_SubNodeContainer.InitContentItem(_Packet._SubNodeList);
|
||
}
|
||
|
||
// 领取离线奖励
|
||
public void OnTagGetBtnClick(int tagIndex)
|
||
{
|
||
if(_Packet == null || tagIndex >= _Packet._SubNodeList.Count)
|
||
{
|
||
return;
|
||
}
|
||
|
||
int betterAwardIndex = -1;
|
||
for(int i = _Packet._SubNodeList.Count - 1; i > tagIndex; --i)
|
||
{
|
||
if(_Packet._SubNodeList[i]._SubNodeState == 1)
|
||
{
|
||
betterAwardIndex = i;
|
||
break;
|
||
}
|
||
}
|
||
|
||
int resultTagIndex = betterAwardIndex == -1 ? tagIndex : betterAwardIndex;
|
||
string rawStr_Type = _Packet._SubNodeList[resultTagIndex]._SubNodeDescList[0];
|
||
string rawStr_Lv = _Packet._SubNodeList[resultTagIndex]._SubNodeDescList[1];
|
||
int privilegeLv = Convert.ToInt32(rawStr_Lv.Substring(rawStr_Lv.IndexOf("*") + 1));
|
||
string rawStr_Multiple = _Packet._SubNodeList[resultTagIndex]._SubNodeDescList[2];
|
||
int privilegeMultiple = Convert.ToInt32(rawStr_Multiple.Substring(rawStr_Multiple.IndexOf("*") + 1));
|
||
|
||
// 存在更好的奖品,弹出提示框,并不允许领取该档位奖品
|
||
if (betterAwardIndex != -1)
|
||
{
|
||
string result = StrDictionary.GetClientDictionaryString("#{44072}", privilegeLv, privilegeMultiple);
|
||
MessageBoxLogic.OpenOKBox(result, null, null);
|
||
}
|
||
// 不存在更好的奖品
|
||
else
|
||
{
|
||
// 可领取
|
||
if(_Packet._SubNodeList[tagIndex]._SubNodeState == 1)
|
||
{
|
||
ReqGetWelfareRew req = new ReqGetWelfareRew();
|
||
req._NodeId = _Packet._NodeId;
|
||
req._SubNodeId = tagIndex;
|
||
req.SendMsg();
|
||
}
|
||
// 不可领取,给出升级vip提示
|
||
else
|
||
{
|
||
// 先判断是否可以有经验可领取
|
||
string rawStr_Exp = _Packet._SubNodeList[resultTagIndex]._SubNodeDescList[3];
|
||
int privilegeExp = Convert.ToInt32(rawStr_Exp.Substring(rawStr_Exp.IndexOf("*") + 1));
|
||
if(privilegeExp <= 0)
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{44075}"));
|
||
}
|
||
else
|
||
{
|
||
int vipLevel = GameManager.gameManager.PlayerDataPool.VipCost;
|
||
|
||
if (vipLevel < privilegeLv)
|
||
{
|
||
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{44076}"));
|
||
}
|
||
else
|
||
{
|
||
string result = StrDictionary.GetClientDictionaryString("#{44073}", privilegeLv, privilegeMultiple);
|
||
MessageBoxLogic.OpenOKCancelBox(result, null,
|
||
()=>
|
||
{
|
||
// 点击确认,跳转vip
|
||
YuanBaoShopLogic.OpenVipPage();
|
||
}, null);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|