|
@@ -0,0 +1,368 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using ET;
|
|
|
+using UnityEngine;
|
|
|
+using UI.FieldWork;
|
|
|
+using FairyGUI;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ class FieldWorkDataManager : SingletonBase<FieldWorkDataManager>
|
|
|
+ {
|
|
|
+ public long LastFightTime = 0; //上次战斗时间,时间为0,说明未战斗过,则没有段位奖励
|
|
|
+ public List<int> ThemeList = new List<int>() { 1, 2, 3 };
|
|
|
+ public List<string> Tag = new List<string> { "艳丽", "志怪" }; //本周标签
|
|
|
+ public int SeasonId = 1; // 赛季id
|
|
|
+ public List<FightData> DressupList = new List<FightData>(); //我的搭配列表
|
|
|
+ public List<int> HistoryDressupList = new List<int>();//本周通过关的服装列表
|
|
|
+ public List<CardAbrasionInfo> CardAbrasionInfoList = new List<CardAbrasionInfo>();
|
|
|
+ public Dictionary<int,CimbingTowerLevelInfoProto> CimbingTowerLevelInfoList = new Dictionary<int, CimbingTowerLevelInfoProto>();
|
|
|
+
|
|
|
+ public List<int> roundTime = new List<int>();
|
|
|
+ public OtherRoleInfoData roleInfo = new OtherRoleInfoData() {
|
|
|
+ roleName = RoleDataManager.roleName,
|
|
|
+ roleLv = RoleDataManager.lvl,
|
|
|
+ headId = RoleDataManager.headId};
|
|
|
+ //Dictionary<回合下标, Dictionary<partId, Dictionary<战斗节点, List<PassivitySkillLvlCfg>>>>
|
|
|
+ public Dictionary<int, Dictionary<int, Dictionary<int, List<PassivitySkillLvlCfg>>>> vaildSkills =
|
|
|
+ new Dictionary<int, Dictionary<int, Dictionary<int, List<PassivitySkillLvlCfg>>>>();
|
|
|
+
|
|
|
+ public Dictionary<int, Dictionary<int, Dictionary<int, List<PassivitySkillLvlCfg>>>> targetVaildSkills =
|
|
|
+ new Dictionary<int, Dictionary<int, Dictionary<int, List<PassivitySkillLvlCfg>>>>();
|
|
|
+
|
|
|
+ public int SelectThemeIndex = 0; //当前选中换装主题(ThemeList)的下标
|
|
|
+ public int SelectTargetIndex = -1; //当前选中挑战对象的下标
|
|
|
+ public int CurFightIndex = 0; //当前挑战场次下标
|
|
|
+ public List<long> myScore = new List<long>(); //对战数据,三轮分数
|
|
|
+
|
|
|
+ public List<ItemInfoProto> BonusList = new List<ItemInfoProto>(); //战斗结算奖励
|
|
|
+
|
|
|
+ public int targetWinScore = 10000;
|
|
|
+
|
|
|
+ //战斗关卡
|
|
|
+ public int currentLevelID = 0;
|
|
|
+ public List<string> nameList = new List<string>()
|
|
|
+ {"壹","贰","叄","肆","伍","陆","柒","捌","玖","拾","拾壹","终"};
|
|
|
+ public int guideLevelID = 100005009;
|
|
|
+ public int MaxLevelId = 0;
|
|
|
+ public bool IsAutoStart = false;
|
|
|
+ /// <summary>
|
|
|
+ /// 更新战斗结算总分,含胜负
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="obj"></param>
|
|
|
+ /// <param name="myScores"></param>
|
|
|
+ /// <param name="targetScore"></param>
|
|
|
+ public void UpdateAllScoreResult(GObject obj, List<long> myScores,int targetScore)
|
|
|
+ {
|
|
|
+ UI_ComAllScoreResult com = UI_ComAllScoreResult.Proxy(obj);
|
|
|
+ bool isWin = UpdateAllScore(com.m_comResult.target, myScores, targetScore);
|
|
|
+ //_ui.m_loaResule.url = isWin ? "ui://FieldWork/kstzjj_slsl" : "ui://FieldWork/kstzjj_shib";
|
|
|
+ UI_ComAllScoreResult.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool UpdateAllScore(GObject obj, List<long> myScores, int targetScore)
|
|
|
+ {
|
|
|
+ long myAllScore = 0;
|
|
|
+ long targetAllScore = 0;
|
|
|
+ for (int i = 0; i < myScores.Count; i++)
|
|
|
+ {
|
|
|
+ myAllScore += myScores[i];
|
|
|
+ }
|
|
|
+ UI_ComAllScore com = UI_ComAllScore.Proxy(obj);
|
|
|
+ com.m_txtMyFightScore.text = myAllScore.ToString();
|
|
|
+ UI_ComAllScore.ProxyEnd();
|
|
|
+ bool isWin = myAllScore > targetAllScore;
|
|
|
+ return isWin;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新标签、战力、属性分数值
|
|
|
+ /// </summary>
|
|
|
+ public void UpdateValue(GObject obj, int index, List<FightData> roleDatas)
|
|
|
+ {
|
|
|
+ UI.Arena.UI_ComFIeldValueInfo com = UI.Arena.UI_ComFIeldValueInfo.Proxy(obj);
|
|
|
+ com.m_scoreType.url = ResPathUtil.GetScorePath(FieldWorkDataManager.Instance.ThemeList[index]);
|
|
|
+ com.m_txtScore.text = FightDataManager.Instance.GetScore(roleDatas[index]).ToString();
|
|
|
+ long fightScore = ArenaDataManager.Instance.GetAllFightScore(roleDatas);
|
|
|
+ com.m_txtFightScore.SetVar("value", fightScore.ToString()).FlushVars(); ;
|
|
|
+ com.m_txtTagScore.text = FightDataManager.Instance.GetTagsScore(roleDatas[index].itemList, roleDatas[index].tags).ToString();
|
|
|
+ int count = ArenaDataManager.Instance.GetTagsCount(roleDatas[index].itemList, roleDatas[index].tags);
|
|
|
+ com.m_c1.selectedIndex = Math.Min(count, ArenaTagCfgArray.Instance.dataArray.Length);
|
|
|
+ com.m_c3.selectedIndex = roleDatas[index].tags.Length > 0 ? 1 : 0;
|
|
|
+ UpdateFightScore(com.m_comFightScore.target, roleDatas);
|
|
|
+
|
|
|
+ ItemUtil.UpdateTag(com.m_comTag, roleDatas[index].tags[0]);
|
|
|
+ ItemUtil.UpdateTag(com.m_comTag1, roleDatas[index].tags[1]);
|
|
|
+
|
|
|
+ if (com.m_btnTagRule.data == null)
|
|
|
+ {
|
|
|
+ com.m_btnTagRule.onClick.Add(RuleController.ShowRuleView);
|
|
|
+ com.m_btnTagRule.data = 300034;
|
|
|
+ }
|
|
|
+ UI.Arena.UI_ComFIeldValueInfo.ProxyEnd();
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 更新战力值
|
|
|
+ /// </summary>
|
|
|
+ public void UpdateFightScore(GObject obj, List<FightData> roleDatas)
|
|
|
+ {
|
|
|
+ List<long> fightScore = ArenaDataManager.Instance.GetFightScoreList(roleDatas);
|
|
|
+ UI.Arena.UI_ComFieldFightScore com = UI.Arena.UI_ComFieldFightScore.Proxy(obj);
|
|
|
+ com.m_txtSuitScore.SetVar("value", fightScore[0].ToString()).FlushVars(); ;
|
|
|
+ com.m_txtClickScore.SetVar("value", fightScore[1].ToString()).FlushVars(); ;
|
|
|
+ com.m_txtCardScore.SetVar("value", fightScore[2].ToString()).FlushVars(); ;
|
|
|
+ UI.Arena.UI_ComFieldFightScore.ProxyEnd();
|
|
|
+ }
|
|
|
+ public void GetFightResult()
|
|
|
+ {
|
|
|
+ myScore.Clear();
|
|
|
+ long allScore = 0;
|
|
|
+ for (int i = 0; i < DressupList.Count; i++)
|
|
|
+ {
|
|
|
+ FieldWorkDataManager.Instance.GetQuickFightResult(i, DressupList[i], out long score);
|
|
|
+ allScore += score;
|
|
|
+ myScore.Add(score);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public int GetTargetWinScore(int levelID)
|
|
|
+ {
|
|
|
+ targetWinScore = 10000;
|
|
|
+ return targetWinScore;
|
|
|
+ }
|
|
|
+ public string GetHeihtScore(int levelID)
|
|
|
+ {
|
|
|
+ if(CimbingTowerLevelInfoList.ContainsKey(levelID))
|
|
|
+ {
|
|
|
+ long score = CimbingTowerLevelInfoList[levelID].WeekMaxScore;
|
|
|
+ return score.ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public List<List<int>> GetDressAndCard()
|
|
|
+ {
|
|
|
+ List<List<int>> dress = new List<List<int>>();
|
|
|
+ for (int i=0;i< FieldWorkDataManager.Instance.DressupList.Count;i++)
|
|
|
+ {
|
|
|
+ List<int> dressA = new List<int>();
|
|
|
+ dressA = FieldWorkDataManager.Instance.DressupList[i].itemList.ToList();
|
|
|
+ //去除默认
|
|
|
+ dressA.Remove(10000);
|
|
|
+ dressA.Remove(20000);
|
|
|
+ dressA.Remove(30000);
|
|
|
+ dressA.Remove(50000);
|
|
|
+ dressA.Remove(60000);
|
|
|
+ if (FieldWorkDataManager.Instance.DressupList[i].cardId > 0)
|
|
|
+ {
|
|
|
+ dressA.Add(FieldWorkDataManager.Instance.DressupList[i].cardId);
|
|
|
+ }
|
|
|
+ dress.Add(dressA);
|
|
|
+ }
|
|
|
+ return dress;
|
|
|
+ }
|
|
|
+ public float GetCardAbrasion(int cardID)
|
|
|
+ {
|
|
|
+ float abrasion = 0;
|
|
|
+ float UseNum = 0;
|
|
|
+ float cardTimes = CimbingTowerCfgArray.Instance.dataArray[0].UseLimit;
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cardID);
|
|
|
+ if(itemCfg == null)
|
|
|
+ {
|
|
|
+ return 100;
|
|
|
+ }
|
|
|
+ foreach (var item in CardAbrasionInfoList)
|
|
|
+ {
|
|
|
+ if(item.Card == cardID)
|
|
|
+ {
|
|
|
+ UseNum = item.UseNum;
|
|
|
+ abrasion = UseNum / cardTimes;
|
|
|
+ if(abrasion >= 1)
|
|
|
+ {
|
|
|
+ abrasion = 1;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return abrasion * 100;
|
|
|
+ }
|
|
|
+ //输入属性类型,获取联盟技能该属性加成总值
|
|
|
+ public int GetAllSkillScore(int scoreType)
|
|
|
+ {
|
|
|
+ int score = 0;
|
|
|
+ if(scoreType == 0)
|
|
|
+ {
|
|
|
+ return score;
|
|
|
+ }
|
|
|
+ foreach (int key in SkillDataManager.Instance.LeagueSkillScoreDatas.Keys)
|
|
|
+ {
|
|
|
+ score += SkillDataManager.Instance.LeagueSkillScoreDatas[key][scoreType];
|
|
|
+ }
|
|
|
+ return score;
|
|
|
+ }
|
|
|
+ public void SetDataScoreType()
|
|
|
+ {
|
|
|
+ for(int i = 0;i<DressupList.Count;i++)
|
|
|
+ {
|
|
|
+ DressupList[i].scoreType = ThemeList[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public bool SetCanStart()
|
|
|
+ {
|
|
|
+ int i = 0;
|
|
|
+ foreach(var item in DressupList)
|
|
|
+ {
|
|
|
+ bool isDress = false;
|
|
|
+ for(int j= 0;j<item.itemList.Count;j++)
|
|
|
+ {
|
|
|
+ if(item.itemList.Count > 0)
|
|
|
+ {
|
|
|
+ if(item.itemList[j] != 10000 && item.itemList[j] != 20000
|
|
|
+ && item.itemList[j] != 30000 && item.itemList[j] != 50000 && item.itemList[j] != 60000)
|
|
|
+ {
|
|
|
+ isDress = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(item.cardId > 0 && isDress)
|
|
|
+ {
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(i>=3)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public bool CheckLevelPass(int LevelID)
|
|
|
+ {
|
|
|
+ CimbingTowerLevelCfg levelCfg = CimbingTowerLevelCfgArray.Instance.dataArray[0];
|
|
|
+ if(LevelID == levelCfg.id)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ int levelBefore = LevelID - 1;
|
|
|
+ if (FieldWorkDataManager.Instance.CimbingTowerLevelInfoList.ContainsKey(levelBefore))
|
|
|
+ {
|
|
|
+ if( FieldWorkDataManager.Instance.CimbingTowerLevelInfoList[levelBefore].IsPass)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 词牌如果磨损达到上限就放到最后
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="arrayList"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<CardData> SortCardList(List<CardData> cardList)
|
|
|
+ {
|
|
|
+ List<CardData> card = new List<CardData>();
|
|
|
+ int limitNum = CimbingTowerCfgArray.Instance.dataArray[0].UseLimit;
|
|
|
+ card = cardList.ToList();
|
|
|
+ for(int i = 0;i<card.Count;i++)
|
|
|
+ {
|
|
|
+ foreach(var item in CardAbrasionInfoList)
|
|
|
+ {
|
|
|
+ if(item.Card == card[i].id)
|
|
|
+ {
|
|
|
+ if(item.UseNum >= limitNum)
|
|
|
+ {
|
|
|
+ // 添加到列表末尾
|
|
|
+ card.Add(card[i]);
|
|
|
+ // 移除元素
|
|
|
+ card.RemoveAt(i);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return card;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取快速挑战结果
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="myRoleData"></param>
|
|
|
+ /// <param name="_score"></param>
|
|
|
+
|
|
|
+ public void GetQuickFightResult(int roundIndex, FightData myRoleData, out long _score)
|
|
|
+ {
|
|
|
+ double score = 0;
|
|
|
+
|
|
|
+ int cardId = myRoleData.cardId;
|
|
|
+ double mainScore = ScoreSystemData.Instance.GetMainScore(myRoleData);
|
|
|
+ List<int> skillLvs = myRoleData.skillLvs;
|
|
|
+
|
|
|
+ List<int> roundTime = ScoreSystemData.Instance.GetRoundTime(myRoleData.cardId, myRoleData.skillLvs);
|
|
|
+ if (InstanceZonesDataManager.FightScene == ConstInstanceZonesType.Arena || InstanceZonesDataManager.FightScene == ConstInstanceZonesType.FieldWork)
|
|
|
+ {
|
|
|
+ FieldWorkDataManager.Instance.roundTime = roundTime;
|
|
|
+ if (!FieldWorkDataManager.Instance.vaildSkills.ContainsKey(roundIndex)) FieldWorkDataManager.Instance.vaildSkills[roundIndex] = new Dictionary<int, Dictionary<int, List<PassivitySkillLvlCfg>>>();
|
|
|
+ }
|
|
|
+
|
|
|
+ int roundId = 0;
|
|
|
+ int currentTime = SkillBeginTime.FIGHT_BEGIN;
|
|
|
+ GetSkillScore(FightRoleType.MINE, roundIndex, currentTime, roundId, mainScore, cardId, skillLvs, roundTime, ref score);
|
|
|
+ for (int i = 0; i < FightScoreCfgArray.Instance.dataArray.Length; i++)
|
|
|
+ {
|
|
|
+ roundId++;
|
|
|
+ currentTime = SkillBeginTime.ERVERY_ROUND_BEGIN;
|
|
|
+ GetSkillScore(FightRoleType.MINE, roundIndex, currentTime, roundId, mainScore, cardId, skillLvs, roundTime, ref score);
|
|
|
+ score += ScoreSystemData.Instance.GetRoundScore(myRoleData, roundId, ClickType.PERFECT_CLICK, 0);
|
|
|
+ currentTime = SkillBeginTime.PERFECT_CLICK;
|
|
|
+ GetSkillScore(FightRoleType.MINE, roundIndex, currentTime, roundId, mainScore, cardId, skillLvs, roundTime, ref score);
|
|
|
+ currentTime = SkillBeginTime.ERVERY_ROUND_END;
|
|
|
+ GetSkillScore(FightRoleType.MINE, roundIndex, currentTime, roundId, mainScore, cardId, skillLvs, roundTime, ref score);
|
|
|
+ // Debug.Log(" targetScore444:" + targetScore);
|
|
|
+ }
|
|
|
+ roundId++;
|
|
|
+ currentTime = SkillBeginTime.ALL_PERFECT_START;
|
|
|
+ GetSkillScore(FightRoleType.MINE, roundIndex, currentTime, roundId, mainScore, cardId, skillLvs, roundTime, ref score);
|
|
|
+ score += ScoreSystemData.Instance.GetAllCircleAddScore(myRoleData);
|
|
|
+ _score = Mathf.CeilToInt((float)score);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void GetSkillScore(int roleType, int roundIndex, int currentTime, int partId, double mainScore, int cardId, List<int> skillLvs, List<int> roundTime, ref double score)
|
|
|
+ {
|
|
|
+ List<int> targetSkillLvs = new List<int>();
|
|
|
+ List<int> targetRoundTime = new List<int>();
|
|
|
+ List<PassivitySkillLvlCfg> vaildSkills = ScoreSystemData.Instance.GetValidSkills(currentTime, partId, cardId, skillLvs, 0, targetSkillLvs, roundTime, targetRoundTime);
|
|
|
+ ScoreSystemData.Instance.GetRoundItemSkillScore(vaildSkills, mainScore, 0, out int skillScore, out int targetSkillScore, out Dictionary<int, int> skillScoreDic);
|
|
|
+
|
|
|
+ score += skillScore;
|
|
|
+
|
|
|
+ if (InstanceZonesDataManager.FightScene == ConstInstanceZonesType.Arena || InstanceZonesDataManager.FightScene == ConstInstanceZonesType.FieldWork)
|
|
|
+ {
|
|
|
+ FieldWorkDataManager dataManager = FieldWorkDataManager.Instance;
|
|
|
+ if (roleType == FightRoleType.MINE)
|
|
|
+ {
|
|
|
+ if (!dataManager.vaildSkills[roundIndex].ContainsKey(partId)) dataManager.vaildSkills[roundIndex][partId] = new Dictionary<int, List<PassivitySkillLvlCfg>>();
|
|
|
+ dataManager.vaildSkills[roundIndex][partId][currentTime] = vaildSkills;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (!dataManager.targetVaildSkills[roundIndex].ContainsKey(partId)) dataManager.targetVaildSkills[roundIndex][partId] = new Dictionary<int, List<PassivitySkillLvlCfg>>();
|
|
|
+ dataManager.targetVaildSkills[roundIndex][partId][currentTime] = vaildSkills;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|