| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 | 
							- using System;
 
- using System.Collections.Generic;
 
- using ET;
 
- using GFGGame;
 
- namespace GFGGame
 
- {
 
-     public class StudioDataManager : SingletonBase<StudioDataManager>
 
-     {
 
-         private Dictionary<int, StudioData> _StudioInfoById = new Dictionary<int, StudioData>();
 
-         public int TYPE_SELECT_INDEX = 0;//界面类型0无属性选择,1有属性选择
 
-         public int PROPERTY_SELECT_INDEX = 0;//属性类型
 
-         public string VIEW_NAME = "";//界面名称
 
-         public int filingChapterId;//查阅建档副本Id
 
-         public List<StudioCfg> FilingDatas
 
-         {
 
-             get
 
-             {
 
-                 return StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioFilingView).Name);
 
-             }
 
-         }
 
-         public void Clear()
 
-         {
 
-             _StudioInfoById.Clear();
 
-         }
 
-         public void RspStudioInfos(StudioData studioData)
 
-         {
 
-             if (!_StudioInfoById.ContainsKey(studioData.ChapterId))
 
-             {
 
-                 _StudioInfoById.Add(studioData.ChapterId, studioData);
 
-             }
 
-             _StudioInfoById[studioData.ChapterId] = studioData;
 
-         }
 
-         public void RspBuyStudioPlayTimes(int chapterId, int buyTimes, int totalPlayTimes)
 
-         {
 
-             _StudioInfoById[chapterId].BuyTimes = buyTimes;
 
-             _StudioInfoById[chapterId].TotalPlayTimes = totalPlayTimes;
 
-         }
 
-         public void RspFilingScoreReward(int chapterId, int index)
 
-         {
 
-             _StudioInfoById[chapterId].RewardsStatus[index] = ConstBonusStatus.GOT;
 
-         }
 
-         public void NoticeStudioPlayTimes(int chapterId, int PlayTimes)
 
-         {
 
-             _StudioInfoById[chapterId].PlayTimes = PlayTimes;
 
-         }
 
-         public void NoticeFilingScoreBonusChanged(int chapterId, int chapterScore, List<int> rewardsStatus)
 
-         {
 
-             _StudioInfoById[chapterId].ChapterScore = chapterScore;
 
-             _StudioInfoById[chapterId].RewardsStatus = rewardsStatus;
 
-         }
 
-         public StudioData GetStudioDataById(int id)
 
-         {
 
-             if (_StudioInfoById.ContainsKey(id))
 
-             {
 
-                 return _StudioInfoById[id];
 
-             }
 
-             else
 
-             {
 
-                 int totalPlayTimes = 0;
 
-                 // if (type == ConstInstanceZonesType.Studio)
 
-                 // {
 
-                 totalPlayTimes = StudioCfgArray.Instance.GetCfg(id).num;
 
-                 // }
 
-                 StudioData studioData = new StudioData() { ChapterId = id, BuyTimes = 0, PlayTimes = 0, TotalPlayTimes = totalPlayTimes };
 
-                 RspStudioInfos(studioData);
 
-                 return studioData;
 
-             }
 
-         }
 
-         public void IsCanFight(List<StoryLevelCfg> storyLevelCfgs, int index, out bool canFight, out string content)
 
-         {
 
-             StoryLevelCfg storyLevelCfg = storyLevelCfgs[index];
 
-             bool isPass = InstanceZonesDataManager.CheckLevelPass(storyLevelCfg.needStoryLevelId);
 
-             bool isRoleLv = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) >= storyLevelCfg.needRoleLv;
 
-             bool isLastPast = true;
 
-             if (index > 0 && index < storyLevelCfgs.Count)
 
-             {
 
-                 isLastPast = InstanceZonesDataManager.CheckLevelPass(storyLevelCfgs[index - 1].id);
 
-             }
 
-             content = "";
 
-             if (!isRoleLv) content = string.Format("主角等级达到{0}级解锁", storyLevelCfg.needRoleLv);
 
-             if (!isLastPast) content = string.Format("需通关{0}", storyLevelCfgs[index - 1].name);
 
-             StoryLevelCfg needStoryLevelCfg = StoryLevelCfgArray.Instance.GetCfg(storyLevelCfg.needStoryLevelId);
 
-             if (!isPass) content = string.Format("完成主线{0}-{1}解锁", needStoryLevelCfg.chapterId, needStoryLevelCfg.order);
 
-             canFight = isPass && isRoleLv && isLastPast;
 
-         }
 
-         public void IsCanFight(int levelId, out bool canFight, out string content)
 
-         {
 
-             StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(levelId);
 
-             StudioCfg cfg = StudioCfgArray.Instance.GetCfg(storyLevelCfg.chapterId);
 
-             int needStoryLevelId = 0;
 
-             if (cfg.funId == typeof(StudioFilingView).Name)
 
-             {
 
-                 needStoryLevelId = cfg.storyLevelId;
 
-             }
 
-             else
 
-             {
 
-                 needStoryLevelId = storyLevelCfg.needStoryLevelId;
 
-             }
 
-             bool isPass = InstanceZonesDataManager.CheckLevelPass(needStoryLevelId);
 
-             StoryLevelCfg needStoryLevelCfg = StoryLevelCfgArray.Instance.GetCfg(needStoryLevelId);
 
-             if (!isPass && needStoryLevelCfg != null) content = string.Format("完成主线{0}-{1}解锁", needStoryLevelCfg.chapterId, needStoryLevelCfg.order);
 
-             bool isRoleLv = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) >= storyLevelCfg.needRoleLv;
 
-             if (!isRoleLv) content = string.Format("主角等级达到{0}级解锁", storyLevelCfg.needRoleLv);
 
-             bool isLastPast = true;
 
-             int lastIndex = storyLevelCfg.order - 1 - 1;
 
-             List<StoryLevelCfg> storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(storyLevelCfg.type, storyLevelCfg.subType, storyLevelCfg.chapterId);
 
-             if (lastIndex >= 0)
 
-             {
 
-                 isLastPast = InstanceZonesDataManager.CheckLevelPass(storyLevelCfgs[lastIndex].id);
 
-             }
 
-             if (!isLastPast) content = string.Format("需通关{0}", storyLevelCfgs[lastIndex].name);
 
-             content = "";
 
-             canFight = isPass && isRoleLv && isLastPast;
 
-         }
 
-         public void OnFinishStudioStoryLevel(int levelCfgId, bool firstPass, bool success)
 
-         {
 
-             ViewManager.Show(VIEW_NAME, new object[] { TYPE_SELECT_INDEX, PROPERTY_SELECT_INDEX }, ViewManager.GetGoBackDatas(VIEW_NAME));
 
-         }
 
-         public void OnFinishFilingStoryLevel(int levelCfgId, bool firstPass, bool success)
 
-         {
 
-             ViewManager.Show<StudioFilingView>(MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName), true);
 
-         }
 
-         public float GetAdditionBySuitId(int suitId)
 
-         {
 
-             float addition = 0;
 
-             SuitCfg cfg = SuitCfgArray.Instance.GetCfg(suitId);
 
-             for (int i = 0; i < cfg.partsArr.Length; i++)
 
-             {
 
-                 if (ItemDataManager.GetItemNum(cfg.partsArr[i]) > 0)
 
-                 {
 
-                     ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.partsArr[i]);
 
-                     addition += itemCfg.addition;
 
-                 }
 
-             }
 
-             return addition;
 
-         }
 
-         public bool GetFilingRewardState(int chapterId)
 
-         {
 
-             StudioData studioData = GetStudioDataById(chapterId);
 
-             if (studioData.RewardsStatus.Count == 0) return false;
 
-             for (int i = 0; i < studioData.RewardsStatus.Count; i++)
 
-             {
 
-                 if (studioData.RewardsStatus[i] == ConstBonusStatus.CAN_GET)
 
-                 {
 
-                     return true;
 
-                 }
 
-                 else if (studioData.RewardsStatus[i] == ConstBonusStatus.CAN_NOT_GET)
 
-                 {
 
-                     return false;//奖励按顺序领取,第一个不可领则没有可领奖励
 
-                 }
 
-             }
 
-             return false;
 
-         }
 
-         public int GetFilingRewardStateByIndex(int chapterId, int index)
 
-         {
 
-             StudioData studioData = GetStudioDataById(chapterId);
 
-             return studioData.RewardsStatus[index];
 
-         }
 
-     }
 
- }
 
 
  |