|  |  |  | 
|---|
|  |  |  | fightPropertyFormula = config.Numerical2; | 
|---|
|  |  |  | fightPowerFormula = config.Numerical3; | 
|---|
|  |  |  | skillFightPowerFormula = config.Numerical4; | 
|---|
|  |  |  | JaceCalculator.Init(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 初始化战力计算的信息 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //功能属性 类型:值 | 
|---|
|  |  |  | public Dictionary<int, int> lvAttrs = new Dictionary<int, int>();  //等级属性 | 
|---|
|  |  |  | public Dictionary<int, int> officialAttrs = new Dictionary<int, int>();  //官职属性 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //分开存储预览和 真实属性 | 
|---|
|  |  |  | public Dictionary<int, int> equipAttrs = new Dictionary<int, int>();   //装备属性 | 
|---|
|  |  |  | 
|---|
|  |  |  | return config.MaxHP; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //官职属性 | 
|---|
|  |  |  | void RefreshOfficialAttrs() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | officialAttrs.Clear(); | 
|---|
|  |  |  | var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel); | 
|---|
|  |  |  | for (int i = 0; i < config.AddAttrType.Length; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var id = config.AddAttrType[i]; | 
|---|
|  |  |  | officialAttrs[id] = config.AddAttrNum[i]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #if UNITY_EDITOR | 
|---|
|  |  |  | Debug.Log("战力:官职属性 " + JsonMapper.ToJson(officialAttrs)); | 
|---|
|  |  |  | #endif | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //装备属性:身上装备汇总 | 
|---|
|  |  |  | 
|---|
|  |  |  | propertyVariables["equipValue"] = equipAttrs.ContainsKey(attrType) ? equipAttrs[attrType] : 0; | 
|---|
|  |  |  | propertyVariables["bookValue"] = 0; | 
|---|
|  |  |  | propertyVariables["bookPer"] = GetBookPer(attrType) / 10000.0f; | 
|---|
|  |  |  | propertyVariables["realmValue"] = officialAttrs.ContainsKey(attrType) ? officialAttrs[attrType] : 0; | 
|---|
|  |  |  | propertyVariables["realmPer"] = GetOfficialPer(attrType) / 10000.0f; | 
|---|
|  |  |  | propertyVariables["gubaoValue"] = 0; | 
|---|
|  |  |  | propertyVariables["gubaoPer"] = 0; | 
|---|
|  |  |  | propertyVariables["hjgValue"] = 0; | 
|---|
|  |  |  | propertyVariables["hjgPer"] = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //!!!单武将战力预览的话需要排除队伍影响战力,只算武将自身的上阵属性 | 
|---|
|  |  |  | propertyVariables["lineupInitAddPer"] = GetLineUpPer(attrType, "lineupInitAddPer") / 10000.0f; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return HeroUIManager.Instance.bookPer; | 
|---|
|  |  |  | return HeroUIManager.Instance.allHeroBookPer; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int GetOfficialPer(int attrType) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var pertype = PlayerPropertyConfig.baseAttr2perDict[attrType]; | 
|---|
|  |  |  | return officialAttrs.ContainsKey(pertype) ? officialAttrs[pertype] : 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int GetCountryPer(int attrType) | 
|---|
|  |  |  | 
|---|
|  |  |  | #endif | 
|---|
|  |  |  | // --- 先计算所有功能的汇总属性 --- | 
|---|
|  |  |  | RefreshLVAttrs(); | 
|---|
|  |  |  | RefreshOfficialAttrs(); | 
|---|
|  |  |  | RefrehEquipAttrs(); | 
|---|
|  |  |  | RefreshTeamAttrs(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (config.showType == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | fightPowerVariables[config.Parameter] = (ulong)GetPropertyVaule(config.ID, hero, propertyFormula); | 
|---|
|  |  |  | fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, propertyFormula), 3); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | fightPowerVariables[config.Parameter] = (ulong)GetPropertyVaule(config.ID, hero, fightPropertyFormula); | 
|---|
|  |  |  | fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, fightPropertyFormula), 3); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | var index = team.GetEmptyPosition(); | 
|---|
|  |  |  | if (index < 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | team.AddHero(heroInfo, 5); | 
|---|
|  |  |  | team.AddHero(heroInfo, 5, false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | team.AddHero(heroInfo, index); | 
|---|
|  |  |  | team.AddHero(heroInfo, index, false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | InitFightPowerParam(ispreview: ispreview); | 
|---|
|  |  |  | RefreshLVAttrs(); | 
|---|
|  |  |  | RefreshOfficialAttrs(); | 
|---|
|  |  |  | RefrehEquipAttrs(); | 
|---|
|  |  |  | RefreshTeamAttrs(); | 
|---|
|  |  |  |  | 
|---|