79 lines
2.4 KiB
C#
79 lines
2.4 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
|
|
public class WelfareLevelSubNodeInfo
|
|
{
|
|
public int _NodeId;
|
|
public int _SubNodeId;
|
|
public List<string> _DescList;
|
|
public List<WelfareRew> _RewList;
|
|
public int _SubNodeState;
|
|
public WelfareLevelSubNodeInfo(int nodeId, int subNodeId, List<string> descList, List<WelfareRew> rewList, int subNodeState)
|
|
{
|
|
_NodeId = nodeId;
|
|
_SubNodeId = subNodeId;
|
|
_DescList = new List<string>();
|
|
_DescList.AddRange(descList);
|
|
_RewList = new List<WelfareRew>();
|
|
_RewList.AddRange(rewList);
|
|
_SubNodeState = subNodeState;
|
|
}
|
|
}
|
|
|
|
public class WelfareLevelCtr : WelfarePageBaseCS{
|
|
|
|
public static WelfareLevelCtr Instance;
|
|
void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
|
|
public override void OnPacketRec(NodePageInfoRet packet)
|
|
{
|
|
base.OnPacketRec(packet);
|
|
|
|
List<WelfareLevelSubNodeInfo> infoList = new List<WelfareLevelSubNodeInfo>();
|
|
for (int index = 0; index < packet._SubNodeList.Count; index++)
|
|
{
|
|
WelfareLevelSubNodeInfo info = new WelfareLevelSubNodeInfo(
|
|
packet._NodeId,
|
|
packet._SubNodeList[index]._SubNodeId,
|
|
packet._SubNodeList[index]._SubNodeDescList,
|
|
packet._SubNodeList[index]._RewList,
|
|
packet._SubNodeList[index]._SubNodeState);
|
|
|
|
infoList.Add(info);
|
|
}
|
|
_SubNodeContainer.InitContentItem(infoList);
|
|
|
|
// 特殊处理,需要本地存储最高领取等级
|
|
// 每次在本地存储已经获得的最高等级奖励
|
|
int maxLevel = 1;
|
|
for(int i = 0; i < packet._SubNodeList.Count; ++i)
|
|
{
|
|
if(packet._SubNodeList[i]._SubNodeState == 2)
|
|
{
|
|
string[] descWithLevel = packet._SubNodeList[i]._SubNodeDescList[0].Split('*');
|
|
int tempLevel = Convert.ToInt16(descWithLevel[1]);
|
|
if (tempLevel > maxLevel)
|
|
{
|
|
maxLevel = tempLevel;
|
|
}
|
|
}
|
|
}
|
|
|
|
string guid = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid.ToString();
|
|
PlayerPrefs.SetInt("MaxGiftLevel" + guid, maxLevel);
|
|
if(LevelGiftBagTip.Instance != null)
|
|
{
|
|
LevelGiftBagTip.Instance.TryClose(maxLevel);
|
|
}
|
|
}
|
|
} |