123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using ET;
- namespace GFGGame
- {
- public class TimeTracingDataManager : SingletonBase<TimeTracingDataManager>
- {
- public List<int> IdList = new List<int>() { 5017, 5018, 5019 };
- public List<int> chapterIdList = new List<int>();
- //时光回溯,关卡编号
- public static int _currentChapterId = 62001;
- //时光回溯,合成套装副本当前展示套装
- public static int SuitID = 201027;
- //时光回溯刷新时间
- public static long RefreshTime = 0;
- //章节积分奖励列表
- public static List<int> ChapterRewardDic = new List<int>();
- //关卡评分奖励列表
- public static Dictionary<int , Dictionary<int, int>> LevelRewardDic = new Dictionary<int, Dictionary<int, int>>();
- //关卡信息
- public static Dictionary<int, Dictionary<int, LevelRoleInfoProto>> _LevelMaxInfoDic = new Dictionary<int, Dictionary<int, LevelRoleInfoProto>>();
- public SuitCollectRankProto mySuitRankInfo;
- public LevelRankProto myLevelRankInfo;
- //套装排行榜数据
- public Dictionary<int, List<SuitCollectRankProto>> SuitRankDatasDic = new Dictionary<int, List<SuitCollectRankProto>>()
- {
- {0,new List<SuitCollectRankProto>() },
- {1,new List<SuitCollectRankProto>() },
- };
- //关卡排行榜数据
- public Dictionary<int, List<LevelRankProto>> LevelRankDatasDic = new Dictionary<int, List<LevelRankProto>>()
- {
- {0,new List<LevelRankProto>()},
- {1,new List<LevelRankProto>()},
- };
- public void InitRewardDic()
- {
- chapterIdList.Clear();
- if (chapterIdList.Count > 0)
- {
- return;
- }
- foreach (int i in IdList)
- {
- chapterIdList.Add(ActivityOpenCfgArray.Instance.GetCfg(i).params3Arr[0]);
- }
- }
- //获取关卡奖励状态
- public bool GetLevelRewardStatus(int levelID = 0)
- {
- if(levelID == 0)
- {
- return GetAllLevelRewardStatus(true);
- }
- else
- {
- if(!LevelRewardDic.ContainsKey(levelID))
- {
- return false;
- }
- foreach (var status in LevelRewardDic[levelID])
- {
- if (status.Value == ConstBonusStatus.CAN_GET)
- {
- return true;
- }
- }
- }
- return false;
- }
- //获取套装奖励状态
- public bool GetChapterRewardStatus(int levelID,int rewardID,int itemID)
- {
- //这里对已领取的id进行判断
- if (levelID != 0)
- {
- foreach (var item in ChapterRewardDic)
- {
- if(rewardID == item)
- {
- return false;
- }
- }
- }
- return true;
- }
- //获取对应id奖励状态
- public int GetChapterRewardIDStatus(int rewardID, int itemID)
- {
- long num = 0;
- ItemData itemdata;
- CompositebonusCfg comCfg = CompositebonusCfgArray.Instance.GetCfg(rewardID);
- if (BagDataManager.Instance.GetBagData().TryGetValue(itemID, out itemdata))
- {
- num = itemdata.num;
- }
- else
- {
- num = 0;
- }
- if(num < comCfg.count)
- {
- return ConstBonusStatus.CAN_NOT_GET;
- }
- //这里对已领取的id进行判断
- foreach (var item in ChapterRewardDic)
- {
- if (rewardID == item)
- {
- return ConstBonusStatus.GOT;
- }
- }
- return ConstBonusStatus.CAN_GET;
- }
- //获取所有奖励(只用于红点判断)
- public bool GetAllLevelRewardStatus(bool isLevel = true)
- {
- if (isLevel)
- {
- foreach (var item in LevelRewardDic)
- {
- Dictionary<int, int> rewardStatusDic = new Dictionary<int, int>(0);
- int key = item.Key;
- rewardStatusDic = item.Value;
- foreach (var id in rewardStatusDic)
- {
- if (id.Value == ConstBonusStatus.CAN_GET)
- {
- return true;
- }
- }
- }
- return false;
- }
- else
- {
- return false;
- }
- }
- //通过章节id判断所有奖励状态
- public bool GetChapterIDRewardStatus(int chapID)
- {
- List<CompositebonusCfg> comBonusList = CompositebonusCfgArray.Instance.GetCfgsBychapterId(chapID);
- foreach(CompositebonusCfg item in comBonusList)
- {
- if (GetChapterRewardIDStatus(item.id, item.paramsArr[0]) == 1)
- {
- return true;
- }
- }
- List<StoryLevelCfg> levelList = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(6, 2, chapID);
- foreach(StoryLevelCfg levelItem in levelList)
- {
- if(GetLevelRewardStatus(levelItem.id))
- {
- return true;
- }
- }
- return false;
- }
- public bool GetAllChapterReward()
- {
- foreach(int i in chapterIdList)
- {
- if(GetChapterIDRewardStatus(i))
- {
- return true;
- }
- }
- return false;
- }
- public string ChangeTime(long totalSeconds)
- {
- string timeStr = "";
- TimeSpan t = TimeSpan.FromSeconds(totalSeconds);
- if(t.Days != 0)
- {
- timeStr = string.Format("{0}天{1}时", t.Days, t.Hours);
- }
- else if(t.Hours != 0)
- {
- timeStr = string.Format("{0}时{1}分", t.Hours, t.Minutes);
- }
- else
- {
- timeStr = string.Format("{0}分{1}秒", t.Minutes, t.Seconds);
- }
- return timeStr;
- }
- }
- }
|