Beispiel #1
0
        public SingleGameContext(SCPKG_STARTSINGLEGAMERSP InMessage)
        {
            DebugHelper.Assert(InMessage != null, "输入不应该为null");
            this.RewardCount = (int)((InMessage == null) ? 0u : InMessage.dwRewardNum);
            Singleton <ActorDataCenter> .get_instance().ClearHeroServerData();

            if (Singleton <GamePlayerCenter> .get_instance().GetAllPlayers().get_Count() > 0)
            {
            }
            Singleton <GamePlayerCenter> .get_instance().ClearAllPlayers();

            if (InMessage == null || InMessage.stDetail.get_stSingleGameSucc() == null || InMessage.stDetail.get_stSingleGameSucc().bNum < 1)
            {
                return;
            }
            this.DoNew9SlotCalc(InMessage);
            int num = Mathf.Min((int)InMessage.stDetail.get_stSingleGameSucc().bNum, InMessage.stDetail.get_stSingleGameSucc().astFighter.Length);

            for (int i = 0; i < num; i++)
            {
                COMDT_PLAYERINFO cOMDT_PLAYERINFO = InMessage.stDetail.get_stSingleGameSucc().astFighter[i];
                if (CheatCommandReplayEntry.heroPerformanceTest)
                {
                    cOMDT_PLAYERINFO.astChoiceHero = InMessage.stDetail.get_stSingleGameSucc().astFighter[0].astChoiceHero;
                }
                if (cOMDT_PLAYERINFO.bObjType != 0)
                {
                    string empty       = string.Empty;
                    int    honorId     = 0;
                    int    honorLevel  = 0;
                    uint   gradeOfRank = 0u;
                    ulong  uid;
                    uint   logicWrold;
                    uint   level;
                    if (cOMDT_PLAYERINFO.bObjType == 2)
                    {
                        if (InMessage.bGameType == 1 && Convert.ToBoolean(InMessage.stGameParam.get_stSingleGameRspOfCombat().bIsWarmBattle))
                        {
                            uid        = cOMDT_PLAYERINFO.stDetail.get_stPlayerOfNpc().ullFakeUid;
                            logicWrold = cOMDT_PLAYERINFO.stDetail.get_stPlayerOfNpc().dwFakeLogicWorldID;
                            level      = cOMDT_PLAYERINFO.stDetail.get_stPlayerOfNpc().dwFakePvpLevel;
                        }
                        else
                        {
                            uid        = 0uL;
                            logicWrold = 0u;
                            level      = cOMDT_PLAYERINFO.dwLevel;
                        }
                    }
                    else
                    {
                        uid         = ((cOMDT_PLAYERINFO.bObjType != 1) ? 0uL : cOMDT_PLAYERINFO.stDetail.get_stPlayerOfAcnt().ullUid);
                        logicWrold  = (uint)((cOMDT_PLAYERINFO.bObjType != 1) ? 0 : cOMDT_PLAYERINFO.stDetail.get_stPlayerOfAcnt().iLogicWorldID);
                        level       = cOMDT_PLAYERINFO.dwLevel;
                        honorId     = cOMDT_PLAYERINFO.stDetail.get_stPlayerOfAcnt().iHonorID;
                        honorLevel  = cOMDT_PLAYERINFO.stDetail.get_stPlayerOfAcnt().iHonorLevel;
                        gradeOfRank = (uint)((InMessage.stGameParam.get_stSingleGameRspOfCombat() != null) ? InMessage.stGameParam.get_stSingleGameRspOfCombat().bGradeOfRank : 0);
                    }
                    uint vipLv = 0u;
                    if (cOMDT_PLAYERINFO.stDetail.get_stPlayerOfAcnt() != null)
                    {
                        vipLv = cOMDT_PLAYERINFO.stDetail.get_stPlayerOfAcnt().stGameVip.dwCurLevel;
                    }
                    Player player = Singleton <GamePlayerCenter> .GetInstance().AddPlayer(cOMDT_PLAYERINFO.dwObjId, cOMDT_PLAYERINFO.bObjCamp, (int)cOMDT_PLAYERINFO.bPosOfCamp, level, cOMDT_PLAYERINFO.bObjType != 1, StringHelper.UTF8BytesToString(ref cOMDT_PLAYERINFO.szName), 0, (int)logicWrold, uid, vipLv, null, gradeOfRank, 0u, honorId, honorLevel, null);

                    if (player != null)
                    {
                        for (int j = 0; j < cOMDT_PLAYERINFO.astChoiceHero.Length; j++)
                        {
                            uint dwHeroID = cOMDT_PLAYERINFO.astChoiceHero[j].stBaseInfo.stCommonInfo.dwHeroID;
                            player.AddHero(dwHeroID);
                        }
                        player.isGM = LobbyMsgHandler.isHostGMAcnt;
                    }
                    Singleton <ActorDataCenter> .get_instance().AddHeroesServerData(cOMDT_PLAYERINFO.dwObjId, cOMDT_PLAYERINFO.astChoiceHero);
                }
                if (cOMDT_PLAYERINFO.bObjType == 1)
                {
                    Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(cOMDT_PLAYERINFO.dwObjId);
                }
            }
            this.LevelContext = CLevelCfgLogicManager.CreatePveLevelContext(InMessage);
        }
Beispiel #2
0
        public SingleGameContext(SCPKG_STARTSINGLEGAMERSP InMessage)
        {
            DebugHelper.Assert(InMessage != null, "输入不应该为null");
            base.RewardCount = (InMessage == null) ? 0 : ((int)InMessage.dwRewardNum);
            Singleton <ActorDataCenter> .instance.ClearHeroServerData();

            if (Singleton <GamePlayerCenter> .instance.GetAllPlayers().Count > 0)
            {
            }
            Singleton <GamePlayerCenter> .instance.ClearAllPlayers();

            if (((InMessage != null) && (InMessage.stDetail.stSingleGameSucc != null)) && (InMessage.stDetail.stSingleGameSucc.bNum >= 1))
            {
                this.DoNew9SlotCalc(InMessage);
                int num = Mathf.Min(InMessage.stDetail.stSingleGameSucc.bNum, InMessage.stDetail.stSingleGameSucc.astFighter.Length);
                for (int i = 0; i < num; i++)
                {
                    COMDT_PLAYERINFO comdt_playerinfo = InMessage.stDetail.stSingleGameSucc.astFighter[i];
                    if (CheatCommandReplayEntry.heroPerformanceTest)
                    {
                        comdt_playerinfo.astChoiceHero = InMessage.stDetail.stSingleGameSucc.astFighter[0].astChoiceHero;
                    }
                    if (comdt_playerinfo.bObjType != 0)
                    {
                        ulong uid = 0L;
                        uint  dwFakeLogicWorldID = 0;
                        uint  level       = 1;
                        int   honorId     = 0;
                        int   honorLevel  = 0;
                        uint  gradeOfRank = 0;
                        if (comdt_playerinfo.bObjType == 2)
                        {
                            if ((InMessage.bGameType == 1) && Convert.ToBoolean(InMessage.stGameParam.stSingleGameRspOfCombat.bIsWarmBattle))
                            {
                                uid = comdt_playerinfo.stDetail.stPlayerOfNpc.ullFakeUid;
                                dwFakeLogicWorldID = comdt_playerinfo.stDetail.stPlayerOfNpc.dwFakeLogicWorldID;
                                level = comdt_playerinfo.stDetail.stPlayerOfNpc.dwFakePvpLevel;
                            }
                            else
                            {
                                uid = 0L;
                                dwFakeLogicWorldID = 0;
                                level = comdt_playerinfo.dwLevel;
                            }
                        }
                        else
                        {
                            uid = (comdt_playerinfo.bObjType != 1) ? ((ulong)0L) : comdt_playerinfo.stDetail.stPlayerOfAcnt.ullUid;
                            dwFakeLogicWorldID = (comdt_playerinfo.bObjType != 1) ? 0 : ((uint)comdt_playerinfo.stDetail.stPlayerOfAcnt.iLogicWorldID);
                            level       = comdt_playerinfo.dwLevel;
                            honorId     = comdt_playerinfo.stDetail.stPlayerOfAcnt.iHonorID;
                            honorLevel  = comdt_playerinfo.stDetail.stPlayerOfAcnt.iHonorLevel;
                            gradeOfRank = (InMessage.stGameParam.stSingleGameRspOfCombat != null) ? InMessage.stGameParam.stSingleGameRspOfCombat.bGradeOfRank : 0;
                        }
                        uint vipLv = 0;
                        if (comdt_playerinfo.stDetail.stPlayerOfAcnt != null)
                        {
                            vipLv = comdt_playerinfo.stDetail.stPlayerOfAcnt.stGameVip.dwCurLevel;
                        }
                        Player player = Singleton <GamePlayerCenter> .GetInstance().AddPlayer(comdt_playerinfo.dwObjId, (COM_PLAYERCAMP)comdt_playerinfo.bObjCamp, comdt_playerinfo.bPosOfCamp, level, comdt_playerinfo.bObjType != 1, StringHelper.UTF8BytesToString(ref comdt_playerinfo.szName), 0, (int)dwFakeLogicWorldID, uid, vipLv, null, gradeOfRank, 0, honorId, honorLevel);

                        if (player != null)
                        {
                            for (int j = 0; j < comdt_playerinfo.astChoiceHero.Length; j++)
                            {
                                uint dwHeroID = comdt_playerinfo.astChoiceHero[j].stBaseInfo.stCommonInfo.dwHeroID;
                                player.AddHero(dwHeroID);
                            }
                            player.isGM = LobbyMsgHandler.isHostGMAcnt;
                        }
                        Singleton <ActorDataCenter> .instance.AddHeroesServerData(comdt_playerinfo.dwObjId, comdt_playerinfo.astChoiceHero);
                    }
                    if (comdt_playerinfo.bObjType == 1)
                    {
                        Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(comdt_playerinfo.dwObjId);
                    }
                }
                base.LevelContext = CLevelCfgLogicManager.CreatePveLevelContext(InMessage);
            }
        }