123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- using System;
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class LeagueDataManager : SingletonBase<LeagueDataManager>
- {
- public int Type = 2;// 1:已经加入军团 2:未加入军团
- public int MaxFinishType { get { return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueSkillMaxType); } }
- public int MaxFinishLayer { get { return GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueSkillMaxLayer); } }
- public LeagueData LeagueData;//联盟信息
- public int HallLevel { get { return (int)GetNumeriValue(LeagueNumericType.HallLevel); } }
- public int HotelLevel { get { return (int)GetNumeriValue(LeagueNumericType.HotelLevel); } }
- public int StoreLevel { get { return (int)GetNumeriValue(LeagueNumericType.StoreLevel); } }
- public Dictionary<int, long> LeagueNumber = new Dictionary<int, long>();//联盟数值,LeagueNumericType
- public Dictionary<long, LeagueListData> ListDatas = new Dictionary<long, LeagueListData>();//联盟列表
- public Dictionary<long, OtherRoleInfoData> ListApplyDatas = new Dictionary<long, OtherRoleInfoData>();//联盟申请列表
- public List<LeagueLogData> ListLogDatas = new List<LeagueLogData>();//日志数据
- public Dictionary<long, int> ListAnswerDatas = new Dictionary<long, int>();//答题数据
- public void Clear()
- {
- Type = 2;
- ListDatas.Clear();
- LeagueData = null;
- ListApplyDatas.Clear();
- ListLogDatas.Clear();
- }
- public void SetNumeric(int type, long value)
- {
- LeagueNumber[type] = value;
- }
- public long GetNumeriValue(int type)
- {
- if (LeagueNumber.TryGetValue(type, out long value))
- {
- return value;
- }
- return 0;
- }
- public string GetMemberTitle(int pos)
- {
- string title = "";
- switch (pos)
- {
- case LeaguePos.Owner:
- title = "社长";
- break;
- case LeaguePos.SubOwner:
- title = "副社长";
- break;
- case LeaguePos.Flower:
- title = "御史";
- break;
- case LeaguePos.Member:
- title = "成员";
- break;
- }
- return title;
- }
- public int GetMyPos()
- {
- if (LeagueDataManager.Instance.LeagueData.LeagueMemberDatas.TryGetValue(RoleDataManager.roleId, out LeagueMemberData memberData))
- {
- return memberData.Pos;
- }
- return LeaguePos.Member;
- }
- // //判断一个玩家是否是会长副会长
- // public bool CheckPlayerIsLeader()
- // {
- // }
- /// <summary>
- /// 根据祈福类型获取祈福次数
- /// </summary>
- /// <returns></returns>
- public int GetPrayTimesByType(int prayType)
- {
- int curCount = 0;
- switch (prayType)
- {
- case LeaguePrayType.First:
- curCount = RoleDataManager.LeagueType1PrayTimes;
- break;
- case LeaguePrayType.Second:
- curCount = RoleDataManager.LeagueType2PrayTimes;
- break;
- case LeaguePrayType.Third:
- curCount = RoleDataManager.LeagueType3PrayTimes;
- break;
- }
- return curCount;
- }
- public int GetAllSkillScore(int scoreType)
- {
- int score = 0;
- foreach (int key in SkillDataManager.Instance.LeagueSkillScoreDatas.Keys)
- {
- score += SkillDataManager.Instance.LeagueSkillScoreDatas[key][scoreType];
- }
- return score;
- }
- public int GetSkillScoreByType(int skillType, int scoreType)
- {
- int score = 0;
- if (!SkillDataManager.Instance.LeagueSkillScoreDatas.ContainsKey(skillType)) return score;
- return SkillDataManager.Instance.LeagueSkillScoreDatas[skillType][scoreType];
- }
- //检测一个技能是否激活
- public bool CheckIsSkillActive(int skillType, int skillId)
- {
- if (!SkillDataManager.Instance.LeagueSkillDatas.ContainsKey(skillType)) return false;
- return SkillDataManager.Instance.LeagueSkillDatas[skillType].IndexOf(skillId) >= 0;
- }
- //根据技能类型获取该类型进度
- public double GetSkillProgressByType(int skillType)
- {
- LeagueSkillCountCfg skillCountCfg = LeagueSkillCountCfgArray.Instance.GetCfg(skillType);
- // int maxFinishType = GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueSkillMaxType);
- if (skillCountCfg.type - MaxFinishType <= 0) return 100;
- if (skillCountCfg.type - MaxFinishType > 1) return 0;
- // int layer = GameGlobal.myNumericComponent.GetAsInt(NumericType.LeagueSkillMaxLayer);
- if (MaxFinishLayer == 0) return 0;
- List<LeagueSkillCfg> firstSkillCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytypeAndlayer(skillType, 1);
- int startId = firstSkillCfgs[0].id;
- List<LeagueSkillCfg> curSkillCfgs = LeagueSkillCfgArray.Instance.GetCfgsBytypeAndlayer(skillType, MaxFinishLayer + 1);
- int curId = curSkillCfgs[0].id;
- for (int i = 0; i < curSkillCfgs.Count; i++)
- {
- if (SkillDataManager.Instance.LeagueSkillDatas[skillType].IndexOf(curSkillCfgs[i].id) < 0)
- {
- curId = curSkillCfgs[i].id;
- break;
- }
- }
- float count = curId - startId;
- float maxCount = skillCountCfg.skillCount;
- return Math.Round(count / maxCount * 100, 1); ;
- }
- }
- }
|