| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using cfg.GfgCfg;
- using UnityEngine;
- using ET;
- namespace GFGGame
- {
- public class TimeTracingDataManager : SingletonBase<TimeTracingDataManager>
- {
- public List<int> IdList = new List<int>() { 5017, 5018 };
- public List<int> chapterIdList = new List<int>();
- //时光回溯,关卡编号
- public static int _currentChapterId = 62001;
- //时光回溯,合成套装副本当前展示套装
- public static int SuitID = 201030;
- //时光回溯刷新时间
- 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 Dictionary<int, SuitCollectRankProto> mySuitRankInfo = new Dictionary<int, SuitCollectRankProto>()
- {
- { 0, new SuitCollectRankProto() },
- { 1, new SuitCollectRankProto() },
- };
- public Dictionary<int, LevelRankProto> myLevelRankInfo = new Dictionary<int, LevelRankProto>()
- {
- { 0, new LevelRankProto() },
- { 1, new LevelRankProto() },
- };
- //套装排行榜数据
- 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(CommonDataManager.Tables.TblActivityOpenCfg.GetOrDefault(i).Params3[0]);
- }
- }
- //获取关卡奖励状态
- public bool GetLevelRewardStatus(int levelID = 0)
- {
- if (ActivityDataManager.Instance.GetCurOpenActiveByType(21) == 0)
- {
- return false;
- }
- 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 = CommonDataManager.Tables.TblCompositebonusCfg.GetOrDefault(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 =
- CommonDataManager.Tables.TblCompositebonusCfg.DataList.Where(a => a.ChapterId == chapID).ToList();
- foreach (CompositebonusCfg item in comBonusList)
- {
- if (GetChapterRewardIDStatus(item.Id, item.Params1[0]) == 1)
- {
- return true;
- }
- }
- List<StoryLevelCfg> levelList = CommonDataManager.Tables.TblStoryLevelCfg.DataList.Where(a =>
- a.Type == 6 && a.SubType == 2 &&
- a.ChapterId == chapID).ToList();
- foreach (StoryLevelCfg levelItem in levelList)
- {
- if (GetLevelRewardStatus(levelItem.Id))
- {
- return true;
- }
- }
- return false;
- }
- public bool GetAllChapterReward()
- {
- if (ActivityDataManager.Instance.GetCurOpenActiveByType(21) == 0)
- {
- return false;
- }
- 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;
- }
- }
- }
|