using UnityEngine; using System.Collections; using System.Collections.Generic; using System; public class WelfareLevelSubNodeInfo { public int _NodeId; public int _SubNodeId; public List _DescList; public List _RewList; public int _SubNodeState; public WelfareLevelSubNodeInfo(int nodeId, int subNodeId, List descList, List rewList, int subNodeState) { _NodeId = nodeId; _SubNodeId = subNodeId; _DescList = new List(); _DescList.AddRange(descList); _RewList = new List(); _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 infoList = new List(); 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); } } }