コード例 #1
0
        protected virtual void ResetSynchrConfig()
        {
            MultiGameContext multiGameContext = this.GameContext as MultiGameContext;

            DebugHelper.Assert(multiGameContext != null);
            Singleton <FrameSynchr> .GetInstance().SetSynchrConfig(multiGameContext.MessageRef.dwKFrapsFreqMs, (uint)multiGameContext.MessageRef.bKFrapsLater, (uint)multiGameContext.MessageRef.bPreActFrap, multiGameContext.MessageRef.dwRandomSeed);
        }
コード例 #2
0
        protected virtual void PreparePlayer()
        {
            MultiGameContext multiGameContext = this.GameContext as MultiGameContext;

            DebugHelper.Assert(multiGameContext != null);
            if (multiGameContext == null)
            {
                return;
            }
            if (Singleton <GamePlayerCenter> .get_instance().GetAllPlayers().get_Count() > 0)
            {
            }
            Singleton <GamePlayerCenter> .get_instance().ClearAllPlayers();

            uint num = 0u;

            for (int i = 0; i < 2; i++)
            {
                int num2 = 0;
                while ((long)num2 < (long)((ulong)multiGameContext.MessageRef.astCampInfo[i].dwPlayerNum))
                {
                    uint   dwObjId = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.dwObjId;
                    Player player  = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(dwObjId);

                    DebugHelper.Assert(player == null, "你tm肯定在逗我");
                    if (num == 0u && i + 1 == 1)
                    {
                        num = dwObjId;
                    }
                    bool flag = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.bObjType == 2;
                    if (player != null)
                    {
                        goto IL_727;
                    }
                    string openId     = string.Empty;
                    uint   vipLv      = 0u;
                    int    honorId    = 0;
                    int    honorLevel = 0;
                    ulong  uid;
                    uint   logicWrold;
                    uint   level;
                    if (flag)
                    {
                        if (Convert.ToBoolean(multiGameContext.MessageRef.stDeskInfo.bIsWarmBattle))
                        {
                            uid        = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfNpc().ullFakeUid;
                            logicWrold = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfNpc().dwFakeLogicWorldID;
                            level      = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfNpc().dwFakePvpLevel;
                            openId     = string.Empty;
                        }
                        else
                        {
                            uid        = 0uL;
                            logicWrold = 0u;
                            level      = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.dwLevel;
                            openId     = string.Empty;
                        }
                    }
                    else
                    {
                        uid        = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfAcnt().ullUid;
                        logicWrold = (uint)multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfAcnt().iLogicWorldID;
                        level      = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.dwLevel;
                        openId     = Utility.UTF8Convert(multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].szOpenID);
                        vipLv      = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfAcnt().stGameVip.dwCurLevel;
                        honorId    = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfAcnt().iHonorID;
                        honorLevel = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.stDetail.get_stPlayerOfAcnt().iHonorLevel;
                    }
                    GameIntimacyData intimacyData = null;
                    if (!flag)
                    {
                        CSDT_CAMPPLAYERINFO cSDT_CAMPPLAYERINFO = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2];
                        if (cSDT_CAMPPLAYERINFO == null)
                        {
                            goto IL_81D;
                        }
                        ulong ullUid                 = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.get_stPlayerOfAcnt().ullUid;
                        int   iLogicWorldID          = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.get_stPlayerOfAcnt().iLogicWorldID;
                        byte  bIntimacyRelationPrior = cSDT_CAMPPLAYERINFO.stIntimacyRelation.bIntimacyRelationPrior;
                        COMDT_INTIMACY_RELATION_DATA stIntimacyRelationData = cSDT_CAMPPLAYERINFO.stIntimacyRelation.stIntimacyRelationData;
                        ulong  num4;
                        ulong  num3 = num4 = 0uL;
                        uint   num6;
                        uint   num5  = num6 = 0u;
                        string text  = string.Empty;
                        string text2 = string.Empty;
                        for (int j = 0; j < (int)stIntimacyRelationData.wIntimacyRelationNum; j++)
                        {
                            COMDT_INTIMACY_RELATION cOMDT_INTIMACY_RELATION = stIntimacyRelationData.astIntimacyRelationList[j];
                            if (cOMDT_INTIMACY_RELATION != null)
                            {
                                for (int k = 0; k < 2; k++)
                                {
                                    int num7 = 0;
                                    while ((long)num7 < (long)((ulong)multiGameContext.MessageRef.astCampInfo[k].dwPlayerNum))
                                    {
                                        CSDT_CAMPPLAYERINFO cSDT_CAMPPLAYERINFO2 = multiGameContext.MessageRef.astCampInfo[k].astCampPlayerInfo[num7];
                                        if (multiGameContext.MessageRef.astCampInfo[k].astCampPlayerInfo[num7].stPlayerInfo.bObjType != 2)
                                        {
                                            ulong ullUid2        = cSDT_CAMPPLAYERINFO2.stPlayerInfo.stDetail.get_stPlayerOfAcnt().ullUid;
                                            int   iLogicWorldID2 = cSDT_CAMPPLAYERINFO2.stPlayerInfo.stDetail.get_stPlayerOfAcnt().iLogicWorldID;
                                            if (cSDT_CAMPPLAYERINFO2 != null && (ullUid2 != ullUid || iLogicWorldID2 != iLogicWorldID))
                                            {
                                                if (cOMDT_INTIMACY_RELATION.ullUid == ullUid2 && (ulong)cOMDT_INTIMACY_RELATION.dwLogicWorldId == (ulong)((long)iLogicWorldID2))
                                                {
                                                    string text3 = StringHelper.UTF8BytesToString(ref cSDT_CAMPPLAYERINFO2.stPlayerInfo.szName);
                                                    if (cOMDT_INTIMACY_RELATION.bIntimacyState == bIntimacyRelationPrior)
                                                    {
                                                        num4 = ullUid2;
                                                        num6 = (uint)iLogicWorldID2;
                                                        text = text3;
                                                    }
                                                    else
                                                    {
                                                        num3  = ullUid2;
                                                        num5  = (uint)iLogicWorldID2;
                                                        text2 = text3;
                                                    }
                                                }
                                            }
                                        }
                                        num7++;
                                    }
                                }
                            }
                        }
                        string text4 = StringHelper.UTF8BytesToString(ref cSDT_CAMPPLAYERINFO.stPlayerInfo.szName);
                        if (num4 != 0uL && num6 != 0u)
                        {
                            string title = string.Empty;
                            if (bIntimacyRelationPrior == 1)
                            {
                                title = Singleton <CTextManager> .get_instance().GetText("IntimacyShowLoadGay", new string[]
                                {
                                    text
                                });
                            }
                            if (bIntimacyRelationPrior == 2)
                            {
                                title = Singleton <CTextManager> .get_instance().GetText("IntimacyShowLoadLover", new string[]
                                {
                                    text
                                });
                            }
                            intimacyData = new GameIntimacyData(bIntimacyRelationPrior, num4, num6, title);
                            string text5 = string.Format("----FR, 局内亲密度, 玩家:{0}, 优先选择的关系:{1} --- finded 关系:{2}, 对方名字:{3}", new object[]
                            {
                                text4,
                                bIntimacyRelationPrior,
                                bIntimacyRelationPrior,
                                text
                            });
                        }
                        else if (num3 != 0uL && num5 != 0u)
                        {
                            byte b = 0;
                            if (bIntimacyRelationPrior == 1)
                            {
                                b = 2;
                            }
                            if (bIntimacyRelationPrior == 2)
                            {
                                b = 1;
                            }
                            string title2 = string.Empty;
                            if (b == 1)
                            {
                                title2 = Singleton <CTextManager> .get_instance().GetText("IntimacyShowLoadGay", new string[]
                                {
                                    text2
                                });
                            }
                            if (b == 2)
                            {
                                title2 = Singleton <CTextManager> .get_instance().GetText("IntimacyShowLoadLover", new string[]
                                {
                                    text2
                                });
                            }
                            intimacyData = new GameIntimacyData(b, num3, num5, title2);
                            string text6 = string.Format("----FR, 局内亲密度, 玩家:{0}, 优先选择的关系:{1} --- finded 关系:{2}, 对方名字:{3}", new object[]
                            {
                                text4,
                                bIntimacyRelationPrior,
                                b,
                                text2
                            });
                        }
                    }
                    player = Singleton <GamePlayerCenter> .GetInstance().AddPlayer(dwObjId, i + 1, (int)multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.bPosOfCamp, level, flag, Utility.UTF8Convert(multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.szName), 0, (int)logicWrold, uid, vipLv, openId, multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].dwGradeOfRank, multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].dwClassOfRank, honorId, honorLevel, intimacyData);

                    DebugHelper.Assert(player != null, "创建player失败");
                    if (player != null)
                    {
                        player.isGM = (multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].bIsGM > 0);
                        goto IL_727;
                    }
                    goto IL_727;
IL_81D:
                    num2++;
                    continue;
IL_727:
                    for (int l = 0; l < multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.astChoiceHero.Length; l++)
                    {
                        COMDT_CHOICEHERO cOMDT_CHOICEHERO = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.astChoiceHero[l];
                        int dwHeroID = (int)cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.dwHeroID;
                        if (dwHeroID != 0)
                        {
                            bool flag2 = (cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.dwMaskBits & 4u) > 0u && (cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.dwMaskBits & 1u) == 0u;
                            if (multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[num2].stPlayerInfo.bObjType == 1)
                            {
                                if (flag2)
                                {
                                }
                            }
                            if (player != null)
                            {
                                player.AddHero((uint)dwHeroID);
                            }
                        }
                    }
                    goto IL_81D;
                }
            }
            if (Singleton <WatchController> .GetInstance().IsWatching)
            {
                Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(num);
            }
            else if (Singleton <GameReplayModule> .HasInstance() && Singleton <GameReplayModule> .get_instance().isReplay)
            {
                Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(num);
            }
            else
            {
                Player playerByUid = Singleton <GamePlayerCenter> .GetInstance().GetPlayerByUid(Singleton <CRoleInfoManager> .get_instance().masterUUID);

                DebugHelper.Assert(playerByUid != null, "load multi game but hostPlayer is null");
                Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(playerByUid.PlayerId);
            }
            multiGameContext.levelContext.m_isWarmBattle = Convert.ToBoolean(multiGameContext.MessageRef.stDeskInfo.bIsWarmBattle);
            multiGameContext.SaveServerData();
        }
コード例 #3
0
ファイル: MultiGame.cs プロジェクト: wujiangu/wanshiwu0.1
        protected virtual void PreparePlayer()
        {
            MultiGameContext gameContext = base.GameContext as MultiGameContext;

            DebugHelper.Assert(gameContext != null);
            if (gameContext != null)
            {
                if (Singleton <GamePlayerCenter> .instance.GetAllPlayers().Count > 0)
                {
                }
                Singleton <GamePlayerCenter> .instance.ClearAllPlayers();

                for (int i = 0; i < 2; i++)
                {
                    for (int j = 0; j < gameContext.MessageRef.astCampInfo[i].dwPlayerNum; j++)
                    {
                        uint   dwObjId = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.dwObjId;
                        Player player  = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(dwObjId);

                        DebugHelper.Assert(player == null, "你tm肯定在逗我");
                        bool isComputer = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.bObjType == 2;
                        if (player == null)
                        {
                            ulong  uid = 0L;
                            uint   dwFakeLogicWorldID = 0;
                            uint   dwFakePvpLevel     = 1;
                            string openId             = string.Empty;
                            uint   vipLv = 0;
                            if (isComputer)
                            {
                                if (Convert.ToBoolean(gameContext.MessageRef.stDeskInfo.bIsWarmBattle))
                                {
                                    uid = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.stDetail.stPlayerOfNpc.ullFakeUid;
                                    dwFakeLogicWorldID = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.stDetail.stPlayerOfNpc.dwFakeLogicWorldID;
                                    dwFakePvpLevel     = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.stDetail.stPlayerOfNpc.dwFakePvpLevel;
                                    openId             = string.Empty;
                                }
                                else
                                {
                                    uid = 0L;
                                    dwFakeLogicWorldID = 0;
                                    dwFakePvpLevel     = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.dwLevel;
                                    openId             = string.Empty;
                                }
                            }
                            else
                            {
                                uid = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.stDetail.stPlayerOfAcnt.ullUid;
                                dwFakeLogicWorldID = (uint)gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.stDetail.stPlayerOfAcnt.iLogicWorldID;
                                dwFakePvpLevel     = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.dwLevel;
                                openId             = Utility.UTF8Convert(gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].szOpenID);
                                vipLv = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.stDetail.stPlayerOfAcnt.stGameVip.dwCurLevel;
                            }
                            player = Singleton <GamePlayerCenter> .GetInstance().AddPlayer(dwObjId, (COM_PLAYERCAMP)(i + 1), gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.bPosOfCamp, gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.dwLevel, isComputer, Utility.UTF8Convert(gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.szName), 0, (int)dwFakeLogicWorldID, uid, vipLv, openId, gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].dwGradeOfRank);

                            DebugHelper.Assert(player != null, "创建player失败");
                            if (player != null)
                            {
                                player.isGM = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].bIsGM > 0;
                            }
                        }
                        for (int k = 0; k < gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.astChoiceHero.Length; k++)
                        {
                            COMDT_CHOICEHERO comdt_choicehero = gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.astChoiceHero[k];
                            int dwHeroID = (int)comdt_choicehero.stBaseInfo.stCommonInfo.dwHeroID;
                            if (dwHeroID != 0)
                            {
                                bool flag2 = ((comdt_choicehero.stBaseInfo.stCommonInfo.dwMaskBits & 4) > 0) && ((comdt_choicehero.stBaseInfo.stCommonInfo.dwMaskBits & 1) == 0);
                                if ((gameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[j].stPlayerInfo.bObjType != 1) || !flag2)
                                {
                                }
                                if (player != null)
                                {
                                    player.AddHero((uint)dwHeroID);
                                }
                            }
                        }
                    }
                }
                if (Singleton <GameReplayModule> .HasInstance() && Singleton <GameReplayModule> .instance.isReplay)
                {
                    List <Player> allPlayers = Singleton <GamePlayerCenter> .GetInstance().GetAllPlayers();

                    int num10 = (Singleton <GameReplayModule> .instance.playerIdx >= allPlayers.Count) ? (allPlayers.Count - 1) : Singleton <GameReplayModule> .instance.playerIdx;
                    Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(allPlayers[num10].PlayerId);
                }
                else
                {
                    Player playerByUid = Singleton <GamePlayerCenter> .GetInstance().GetPlayerByUid(Singleton <CRoleInfoManager> .instance.masterUUID);

                    DebugHelper.Assert(playerByUid != null, "load multi game but hostPlayer is null");
                    Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(playerByUid.PlayerId);
                }
                gameContext.levelContext.isWarmBattle = Convert.ToBoolean(gameContext.MessageRef.stDeskInfo.bIsWarmBattle);
                gameContext.SaveServerData();
            }
        }
コード例 #4
0
        protected virtual void PreparePlayer()
        {
            MultiGameContext multiGameContext = this.GameContext as MultiGameContext;

            DebugHelper.Assert(multiGameContext != null);
            if (multiGameContext == null)
            {
                return;
            }
            Singleton <GamePlayerCenter> .instance.ClearAllPlayers();

            uint   num  = 0u;
            string text = string.Empty;

            for (int i = 0; i < 2; i++)
            {
                text = text + "camp" + i.ToString() + "|";
                uint num2 = 0u;
                while (num2 < multiGameContext.MessageRef.astCampInfo[i].dwPlayerNum)
                {
                    CSDT_CAMPPLAYERINFO cSDT_CAMPPLAYERINFO = multiGameContext.MessageRef.astCampInfo[i].astCampPlayerInfo[(int)((UIntPtr)num2)];
                    if (cSDT_CAMPPLAYERINFO == null)
                    {
                        num2 += 1u;
                    }
                    else
                    {
                        uint   dwObjId = cSDT_CAMPPLAYERINFO.stPlayerInfo.dwObjId;
                        Player player  = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(dwObjId);

                        DebugHelper.Assert(player == null, "你tm肯定在逗我");
                        if (num == 0u && i == 0)
                        {
                            num = dwObjId;
                        }
                        bool flag = cSDT_CAMPPLAYERINFO.stPlayerInfo.bObjType == 2;
                        if (player == null)
                        {
                            string openId     = string.Empty;
                            uint   vipLv      = 0u;
                            int    honorId    = 0;
                            int    honorLevel = 0;
                            uint   wangZheCnt = 0u;
                            ulong  num3       = 0uL;
                            uint   num4       = 0u;
                            uint   level      = cSDT_CAMPPLAYERINFO.stPlayerInfo.dwLevel;
                            if (flag)
                            {
                                if (Convert.ToBoolean(multiGameContext.MessageRef.stDeskInfo.bIsWarmBattle))
                                {
                                    num3  = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfNpc.ullFakeUid;
                                    num4  = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfNpc.dwFakeLogicWorldID;
                                    level = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfNpc.dwFakePvpLevel;
                                }
                            }
                            else
                            {
                                num3       = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfAcnt.ullUid;
                                num4       = (uint)cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfAcnt.iLogicWorldID;
                                openId     = Utility.UTF8Convert(cSDT_CAMPPLAYERINFO.szOpenID);
                                vipLv      = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfAcnt.stGameVip.dwCurLevel;
                                honorId    = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfAcnt.iHonorID;
                                honorLevel = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfAcnt.iHonorLevel;
                                wangZheCnt = cSDT_CAMPPLAYERINFO.stPlayerInfo.stDetail.stPlayerOfAcnt.dwWangZheCnt;
                            }
                            GameIntimacyData intimacyData = null;
                            if (!flag)
                            {
                                string text2 = StringHelper.UTF8BytesToString(ref cSDT_CAMPPLAYERINFO.stPlayerInfo.szName);
                                byte   bIntimacyRelationPrior = cSDT_CAMPPLAYERINFO.stIntimacyRelation.bIntimacyRelationPrior;
                                COMDT_INTIMACY_CARD_INFO stIntimacyRelationData = cSDT_CAMPPLAYERINFO.stIntimacyRelation.stIntimacyRelationData;
                                LoadEnt loadEnt = new LoadEnt();
                                for (int j = 0; j < (int)stIntimacyRelationData.bIntimacyNum; j++)
                                {
                                    COMDT_INTIMACY_CARD_DATA cOMDT_INTIMACY_CARD_DATA = stIntimacyRelationData.astIntimacyData[j];
                                    if (cOMDT_INTIMACY_CARD_DATA != null)
                                    {
                                        for (int k = 0; k < 2; k++)
                                        {
                                            int num5 = 0;
                                            while ((long)num5 < (long)((ulong)multiGameContext.MessageRef.astCampInfo[k].dwPlayerNum))
                                            {
                                                CSDT_CAMPPLAYERINFO cSDT_CAMPPLAYERINFO2 = multiGameContext.MessageRef.astCampInfo[k].astCampPlayerInfo[num5];
                                                if (multiGameContext.MessageRef.astCampInfo[k].astCampPlayerInfo[num5].stPlayerInfo.bObjType == 2)
                                                {
                                                    num5++;
                                                }
                                                else
                                                {
                                                    ulong ullUid        = cSDT_CAMPPLAYERINFO2.stPlayerInfo.stDetail.stPlayerOfAcnt.ullUid;
                                                    int   iLogicWorldID = cSDT_CAMPPLAYERINFO2.stPlayerInfo.stDetail.stPlayerOfAcnt.iLogicWorldID;
                                                    if (cSDT_CAMPPLAYERINFO2 != null && (ullUid != num3 || (long)iLogicWorldID != (long)((ulong)num4)) && (int)cOMDT_INTIMACY_CARD_DATA.wIntimacyValue >= IntimacyRelationViewUT.Getlevel2_maxValue() && cOMDT_INTIMACY_CARD_DATA.stUin.ullUid == ullUid && (ulong)cOMDT_INTIMACY_CARD_DATA.stUin.dwLogicWorldId == (ulong)((long)iLogicWorldID) && IntimacyRelationViewUT.IsRelationPriorityHigher(cOMDT_INTIMACY_CARD_DATA.bIntimacyState, loadEnt.state, bIntimacyRelationPrior))
                                                    {
                                                        string text3 = StringHelper.UTF8BytesToString(ref cSDT_CAMPPLAYERINFO2.stPlayerInfo.szName);
                                                        string text4 = string.Format("----FRData Loading s1: 玩家:{0} ----对方名字:{1}, 新关系:{2}替换之前关系:{3}", new object[]
                                                        {
                                                            text2,
                                                            text3,
                                                            (COM_INTIMACY_STATE)cOMDT_INTIMACY_CARD_DATA.bIntimacyState,
                                                            loadEnt.state
                                                        });
                                                        loadEnt.intimacyValue    = (int)cOMDT_INTIMACY_CARD_DATA.wIntimacyValue;
                                                        loadEnt.otherSideName    = text3;
                                                        loadEnt.state            = (COM_INTIMACY_STATE)cOMDT_INTIMACY_CARD_DATA.bIntimacyState;
                                                        loadEnt.otherSideUlluid  = ullUid;
                                                        loadEnt.otherSideWorldId = iLogicWorldID;
                                                    }
                                                    num5++;
                                                }
                                            }
                                        }
                                    }
                                }
                                if (loadEnt.state != COM_INTIMACY_STATE.COM_INTIMACY_STATE_NULL)
                                {
                                    string relationInLoadingMenu = IntimacyRelationViewUT.GetRelationInLoadingMenu((byte)loadEnt.state, loadEnt.otherSideName);
                                    intimacyData = new GameIntimacyData(loadEnt.intimacyValue, loadEnt.state, loadEnt.otherSideUlluid, loadEnt.otherSideWorldId, relationInLoadingMenu);
                                }
                            }
                            player = Singleton <GamePlayerCenter> .GetInstance().AddPlayer(dwObjId, i + COM_PLAYERCAMP.COM_PLAYERCAMP_1, (int)cSDT_CAMPPLAYERINFO.stPlayerInfo.bPosOfCamp, level, flag, Utility.UTF8Convert(cSDT_CAMPPLAYERINFO.stPlayerInfo.szName), 0, (int)num4, num3, vipLv, openId, cSDT_CAMPPLAYERINFO.dwShowGradeOfRank, cSDT_CAMPPLAYERINFO.dwClassOfRank, wangZheCnt, honorId, honorLevel, intimacyData, cSDT_CAMPPLAYERINFO.ullUserPrivacyBits);

                            DebugHelper.Assert(player != null, "创建player失败");
                            if (player != null)
                            {
                                player.isGM = (cSDT_CAMPPLAYERINFO.bIsGM > 0);
                            }
                        }
                        for (int l = 0; l < cSDT_CAMPPLAYERINFO.stPlayerInfo.astChoiceHero.Length; l++)
                        {
                            COMDT_CHOICEHERO cOMDT_CHOICEHERO = cSDT_CAMPPLAYERINFO.stPlayerInfo.astChoiceHero[l];
                            int dwHeroID = (int)cOMDT_CHOICEHERO.stBaseInfo.stCommonInfo.dwHeroID;
                            player.AddHero((uint)dwHeroID);
                        }
                        if (player != null)
                        {
                            string text5 = string.Format("{0}:{1}|", player.OpenId, player.LogicWrold);
                            text += text5;
                        }
                        num2 += 1u;
                    }
                }
            }
            MonoSingleton <TGPSDKSys> .GetInstance().GameStart(text);

            if (Singleton <WatchController> .GetInstance().IsWatching)
            {
                Player playerByUid = Singleton <GamePlayerCenter> .GetInstance().GetPlayerByUid(Singleton <WatchController> .GetInstance().TargetUID);

                if (playerByUid != null)
                {
                    Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(playerByUid.PlayerId);
                }
                else
                {
                    Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(num);
                }
            }
            else
            {
                Player playerByUid2 = Singleton <GamePlayerCenter> .GetInstance().GetPlayerByUid(Singleton <CRoleInfoManager> .instance.masterUUID);

                DebugHelper.Assert(playerByUid2 != null, "load multi game but hostPlayer is null");
                Singleton <GamePlayerCenter> .GetInstance().SetHostPlayer(playerByUid2.PlayerId);
            }
            multiGameContext.levelContext.m_isWarmBattle = Convert.ToBoolean(multiGameContext.MessageRef.stDeskInfo.bIsWarmBattle);
            multiGameContext.SaveServerData();
        }
コード例 #5
0
        public GameInfoBase StartGame(GameContextBase InGameContext)
        {
            DebugHelper.Assert(InGameContext != null);
            if (InGameContext == null)
            {
                return(null);
            }
            if (Singleton <BattleLogic> .instance.isRuning)
            {
                return(null);
            }
            MultiGameContext multiGameContext = InGameContext as MultiGameContext;

            Singleton <GameInput> .GetInstance().isSlowUpMoveCmd = (multiGameContext != null && multiGameContext.MessageRef != null && multiGameContext.MessageRef.bIsSlowUP != 0);

            SynchrReport.Reset();
            GameSettings.DecideDynamicParticleLOD();
            MonoSingleton <TGPSDKSys> .GetInstance().EnablePhone(true);

            Singleton <CHeroSelectBaseSystem> .instance.m_fOpenHeroSelectForm = Time.time - Singleton <CHeroSelectBaseSystem> .instance.m_fOpenHeroSelectForm;
            this.m_fLoadingTime = Time.time;
            this.m_eventsLoadingTime.Clear();
            ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false);

            DebugHelper.Assert(accountInfo != null, "account info is null");
            this.m_iMapId    = InGameContext.levelContext.m_mapID;
            this.m_kGameType = InGameContext.levelContext.GetGameType();
            this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("OpenID", (accountInfo != null) ? accountInfo.OpenId : "0"));
            this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("LevelID", InGameContext.levelContext.m_mapID.ToString()));
            this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPLevel", InGameContext.levelContext.IsMobaMode().ToString()));
            this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPMode", InGameContext.levelContext.IsMobaMode().ToString()));
            this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("bLevelNo", InGameContext.levelContext.m_levelNo.ToString()));
            Singleton <BattleLogic> .GetInstance().isRuning = true;

            Singleton <BattleLogic> .GetInstance().isFighting = false;

            Singleton <BattleLogic> .GetInstance().isGameOver = false;

            Singleton <BattleLogic> .GetInstance().isWaitMultiStart = false;

            ActionManager.Instance.frameMode = true;
            MonoSingleton <ActionManager> .GetInstance().ForceStop();

            Singleton <GameObjMgr> .GetInstance().ClearActor();

            Singleton <SceneManagement> .GetInstance().Clear();

            MonoSingleton <SceneMgr> .GetInstance().ClearAll();

            MonoSingleton <GameLoader> .GetInstance().ResetLoader();

            InGameContext.PrepareStartup();
            if (!MonoSingleton <GameFramework> .instance.EditorPreviewMode)
            {
                DebugHelper.Assert(InGameContext.levelContext != null);
                DebugHelper.Assert(!string.IsNullOrEmpty(InGameContext.levelContext.m_levelDesignFileName));
                if (string.IsNullOrEmpty(InGameContext.levelContext.m_levelArtistFileName))
                {
                    MonoSingleton <GameLoader> .instance.AddLevel(InGameContext.levelContext.m_levelDesignFileName);
                }
                else
                {
                    MonoSingleton <GameLoader> .instance.AddDesignSerializedLevel(InGameContext.levelContext.m_levelDesignFileName);

                    MonoSingleton <GameLoader> .instance.AddArtistSerializedLevel(InGameContext.levelContext.m_levelArtistFileName);
                }
                MonoSingleton <GameLoader> .instance.AddSoundBank("Effect_Common");

                MonoSingleton <GameLoader> .instance.AddSoundBank("System_Voice");
            }
            GameInfoBase gameInfoBase = InGameContext.CreateGameInfo();

            DebugHelper.Assert(gameInfoBase != null, "can't create game logic object!");
            this.gameInfo = gameInfoBase;
            gameInfoBase.PreBeginPlay();
            Singleton <BattleLogic> .instance.m_LevelContext = this.gameInfo.gameContext.levelContext;
            try
            {
                DebugHelper.CustomLog("GameBuilder Start Game: ispvplevel={0} ispvpmode={4} levelid={1} leveltype={6} levelname={3} Gametype={2} pick={5}", new object[]
                {
                    InGameContext.levelContext.IsMobaMode(),
                    InGameContext.levelContext.m_mapID,
                    InGameContext.levelContext.GetGameType(),
                    InGameContext.levelContext.m_levelName,
                    InGameContext.levelContext.IsMobaMode(),
                    InGameContext.levelContext.GetSelectHeroType(),
                    InGameContext.levelContext.m_pveLevelType
                });
                Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

                if (hostPlayer != null)
                {
                    DebugHelper.CustomLog("HostPlayer player id={1} name={2} ", new object[]
                    {
                        hostPlayer.PlayerId,
                        hostPlayer.Name
                    });
                }
            }
            catch (Exception)
            {
            }
            if (!MonoSingleton <GameFramework> .instance.EditorPreviewMode)
            {
                this.m_fLoadProgress = 0f;
                MonoSingleton <GameLoader> .GetInstance().Load(new GameLoader.LoadProgressDelegate(this.onGameLoadProgress), new GameLoader.LoadCompleteDelegate(this.OnGameLoadComplete));

                MonoSingleton <VoiceSys> .GetInstance().HeroSelectTobattle();

                Singleton <GameStateCtrl> .GetInstance().GotoState("LoadingState");
            }
            return(gameInfoBase);
        }