示例#1
0
        public static SysHeroProficiencyPointsVo Get_ProficiencyLevel(this ModelManager mmng, float _kda, string _battleId)
        {
            List <SysHeroProficiencyPointsVo> source = BaseDataMgr.instance.GetDicByType <SysHeroProficiencyPointsVo>().Values.OfType <SysHeroProficiencyPointsVo>().ToList <SysHeroProficiencyPointsVo>();
            SysHeroProficiencyPointsVo        sysHeroProficiencyPointsVo = (from obj in source
                                                                            where obj.battle_damage <= _kda && obj.type.ToString() == _battleId
                                                                            select obj).LastOrDefault <SysHeroProficiencyPointsVo>();

            if (sysHeroProficiencyPointsVo == null)
            {
                sysHeroProficiencyPointsVo = (from obj1 in source
                                              where obj1.battle_damage <= _kda
                                              select obj1).LastOrDefault <SysHeroProficiencyPointsVo>();
            }
            return(sysHeroProficiencyPointsVo);
        }
示例#2
0
        public static void Set_Settle_Proficiency(this ModelManager mmng)
        {
            SettlementModelData settlementModelData = mmng.Get_SettlementModelData();

            if (settlementModelData == null)
            {
                ClientLogger.Error("Settlement: Get Self Null");
                return;
            }
            PvpTeamInfo pvp_teamInfo = settlementModelData.pvp_teamInfo;

            if (pvp_teamInfo == null)
            {
                ClientLogger.Error("Settlement: Get PvpTeamInfo Null");
                settlementModelData.proficiencyExpRecord_curExp = 0;
                settlementModelData.proficiencyExpRecord_Delta  = 0;
                settlementModelData.levelScore = 5;
                return;
            }
            Units player = PlayerControlMgr.Instance.GetPlayer();

            if (mmng.Get_GetMyAchievementData_X() == null)
            {
                ClientLogger.Error("Settlement: Get Achievement Data Null");
                settlementModelData.proficiencyExpRecord_curExp = 0;
                settlementModelData.proficiencyExpRecord_Delta  = 0;
                settlementModelData.levelScore = 5;
                return;
            }
            List <KdaMyHeroData> myHero = ModelManager.Instance.Get_GetMyAchievementData_X().myHero;

            if (myHero == null)
            {
                settlementModelData.proficiencyExpRecord_curExp = 0;
            }
            else
            {
                foreach (KdaMyHeroData current in myHero)
                {
                    if (player != null && current.herouseddata.heroid == player.npc_id)
                    {
                        settlementModelData.proficiencyExpRecord_curExp = current.herouseddata.useinfo;
                    }
                }
            }
            string        userId        = mmng.Get_userData_X().UserId;
            PlayerCounter playerCounter = null;

            if (!pvp_teamInfo.unitCounters.TryGetValue(userId, out playerCounter))
            {
                return;
            }
            int num = playerCounter.deadCount;

            num = ((num != 0) ? num : 1);
            float                      num2       = (float)(playerCounter.killHoreCount + playerCounter.helpKillHoreCount) / (float)num * 3f;
            string                     curLevelId = LevelManager.CurLevelId;
            SysBattleSceneVo           dataById   = BaseDataMgr.instance.GetDataById <SysBattleSceneVo>(curLevelId);
            SysHeroProficiencyPointsVo sysHeroProficiencyPointsVo = mmng.Get_ProficiencyLevel(num2, curLevelId);

            if (sysHeroProficiencyPointsVo == null || dataById == null)
            {
                settlementModelData.proficiencyExpRecord_Delta = 0;
                ClientLogger.Error(string.Concat(new object[]
                {
                    "Settlement: Can't find Proficiency Item. KDA:",
                    num2,
                    " BattleId:",
                    curLevelId
                }));
                return;
            }
            SysBattleSceneVo dataById2 = BaseDataMgr.instance.GetDataById <SysBattleSceneVo>(LevelManager.CurBattleId);
            bool             flag      = LevelManager.m_CurLevel.IsFightWithRobot() || LevelManager.m_CurLevel.IsBattleNewbieGuide() || mmng.Get_Settle_IsSelfDefine();

            if (dataById.hero_proficiency_points == 1 && sysHeroProficiencyPointsVo.type.ToString() == curLevelId && GameManager.IsVictory.HasValue && !flag)
            {
                settlementModelData.proficiencyExpRecord_Delta = ((!GameManager.IsVictory.Value) ? sysHeroProficiencyPointsVo.failure_bonus_point : sysHeroProficiencyPointsVo.victory_bonus_point);
            }
            else
            {
                settlementModelData.proficiencyExpRecord_Delta = 0;
            }
            string evaluate = sysHeroProficiencyPointsVo.evaluate;

            switch (evaluate)
            {
            case "D":
                settlementModelData.levelScore = 1;
                return;

            case "C":
                settlementModelData.levelScore = 2;
                return;

            case "B":
                settlementModelData.levelScore = 3;
                return;

            case "A":
                settlementModelData.levelScore = 4;
                return;

            case "S":
                settlementModelData.levelScore = 5;
                return;
            }
            settlementModelData.levelScore = 0;
        }