Exemple #1
0
        private void OnBattleEnd(MobaMessage msg)
        {
            P2CBattleEndInfo probufMsg = msg.GetProbufMsg <P2CBattleEndInfo>();
            PvpTeamInfo      teamInfo  = probufMsg.teamInfo;

            Singleton <PvpManager> .Instance.RoomInfo.WinTeam      = new TeamType?(PvpProtocolTools.GroupToTeam((int)probufMsg.winGroup));
            Singleton <PvpManager> .Instance.RoomInfo.BattleResult = teamInfo;
            this.OnAfterBattleEnd(probufMsg);
            AutoTestController.InvokeTestLogic(AutoTestTag.LeavePvp, delegate
            {
                PvpUtils.GoHome();
            }, 1f);
        }
        private void Show()
        {
            Settlement_Chaos.< Show > c__AnonStorey244 <Show> c__AnonStorey = new Settlement_Chaos.< Show > c__AnonStorey244();
            PvpTeamInfo        pvpTeamInfo = ModelManager.Instance.Get_Settle_PvpTeamInfo();

            if (pvpTeamInfo == null)
            {
                pvpTeamInfo = Singleton <PvpManager> .Instance.BattleResult;
            }
            if (pvpTeamInfo == null)
            {
                ClientLogger.Error("Can't get Battle INFOs!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                return;
            }
            TeamType?winTeam = Singleton <PvpManager> .Instance.RoomInfo.WinTeam;

            this.SetTitle(new TeamType?(winTeam.Value));
            List <HeroData> heroDataList = this.GetHeroDataList(pvpTeamInfo, 0);
        private void GetPvpFightResult(MobaMessage msg)
        {
            MobaMessageManagerTools.EndWaiting_manual("SendGetPvpFightResult");
            OperationResponse operationResponse = msg.Param as OperationResponse;

            if (operationResponse == null)
            {
                return;
            }
            MobaErrorCode mobaErrorCode = (MobaErrorCode)((int)operationResponse.Parameters[1]);

            if (mobaErrorCode == MobaErrorCode.PvpResultEmpty)
            {
                this._coroutineManager.StartCoroutine(this.RequestAgain(1f), true);
                return;
            }
            if (mobaErrorCode == MobaErrorCode.UserNotExist)
            {
                ClientLogger.Error("GetPvpFightResult: UserNotExist");
                return;
            }
            byte[]      buffer      = (byte[])operationResponse.Parameters[220];
            PvpTeamInfo pvpTeamInfo = SerializeHelper.Deserialize <PvpTeamInfo>(buffer);

            Singleton <PvpManager> .Instance.RoomInfo.BattleResult   = pvpTeamInfo;
            Singleton <PvpManager> .Instance.RoomInfo.OldLadderScore = ModelManager.Instance.Get_userData_X().LadderScore;
            ModelManager.Instance.Get_userData_X().LadderScore = pvpTeamInfo.CurrLadderScore;
            if (GameManager.IsVictory.HasValue && GameManager.IsVictory.Value)
            {
                AnalyticsToolManager.FinishLevel(pvpTeamInfo.sceneid);
            }
            else
            {
                AnalyticsToolManager.FailLevel(pvpTeamInfo.sceneid);
            }
            this._coroutineManager.StopAllCoroutine();
        }
Exemple #4
0
        public static bool Get_Settle_IsSelfDefine(this ModelManager mmng)
        {
            PvpTeamInfo pvpTeamInfo = mmng.Get_Settle_PvpTeamInfo();

            return(pvpTeamInfo != null && pvpTeamInfo.isSelfDefine);
        }
Exemple #5
0
        public static string Get_Settle_MvpUserId(this ModelManager mmng)
        {
            PvpTeamInfo pvpTeamInfo = mmng.Get_Settle_PvpTeamInfo();

            return((pvpTeamInfo != null) ? pvpTeamInfo.mvpuserid : string.Empty);
        }
Exemple #6
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;
        }
        private void SetDescribe()
        {
            string name = this.mCenterOnChild.centeredObject.name;
            SysSummonersAchievementVo dataById = BaseDataMgr.instance.GetDataById <SysSummonersAchievementVo>(name);
            int num = 0;

            this.mMedalName.text = LanguageManager.Instance.GetStringById(dataById.name);
            PvpTeamInfo   pvpTeamInfo   = ModelManager.Instance.Get_Settle_PvpTeamInfo();
            string        userId        = ModelManager.Instance.Get_userData_X().UserId;
            PlayerCounter playerCounter = null;

            pvpTeamInfo.unitCounters.TryGetValue(userId, out playerCounter);
            int id = dataById.id;

            switch (id)
            {
            case 3001:
                this.mShine.mainTexture = ResourceManager.Load <Texture>("Light_default", true, true, null, 0, false);
                if (this.homeKdaData != null)
                {
                    num  = ((playerCounter == null) ? 1 : playerCounter.extKillCount[2]);
                    num += this.homeKdaData.doublekill;
                }
                break;

            case 3002:
                this.mShine.mainTexture = ResourceManager.Load <Texture>("Light_purple", true, true, null, 0, false);
                if (this.homeKdaData != null)
                {
                    num  = ((playerCounter == null) ? 1 : playerCounter.extKillCount[3]);
                    num += this.homeKdaData.triplekill;
                }
                break;

            case 3003:
                this.mShine.mainTexture = ResourceManager.Load <Texture>("Light_gold", true, true, null, 0, false);
                if (this.homeKdaData != null)
                {
                    num  = ((playerCounter == null) ? 1 : playerCounter.extKillCount[4]);
                    num += this.homeKdaData.quadrakill;
                }
                break;

            case 3004:
                this.mShine.mainTexture = ResourceManager.Load <Texture>("Light_gold", true, true, null, 0, false);
                if (this.homeKdaData != null)
                {
                    num  = ((playerCounter == null) ? 1 : playerCounter.extKillCount[5]);
                    num += this.homeKdaData.pentakill;
                }
                break;

            default:
                if (id != 1001)
                {
                    if (id != 2001)
                    {
                        this.mShine.mainTexture = ResourceManager.Load <Texture>("Light_default", true, true, null, 0, false);
                    }
                    else
                    {
                        this.mShine.mainTexture = ResourceManager.Load <Texture>("Light_purple", true, true, null, 0, false);
                        if (this.homeKdaData != null)
                        {
                            num  = ((playerCounter == null) ? 1 : playerCounter.extKillCount[104]);
                            num += this.homeKdaData.godlike;
                        }
                    }
                }
                else
                {
                    this.mShine.mainTexture = ResourceManager.Load <Texture>("Light_red", true, true, null, 0, false);
                    if (this.homeKdaData != null)
                    {
                        num = 1 + this.homeKdaData.mvp;
                    }
                }
                break;
            }
            this.mMedalDesc.text = ((num > 0) ? LanguageManager.Instance.GetStringById(dataById.describe).Replace("*", num.ToString()) : LanguageManager.Instance.GetStringById(dataById.describe));
        }