Exemplo n.º 1
0
        public static void SetPvpLevelInfo(GameObject root)
        {
            root.transform.Find("PanelA/Award/Panel_PlayerExp/PvpLevelNode").gameObject.CustomSetActive(true);
            Text   component = root.transform.Find("PanelA/Award/Panel_PlayerExp/PvpLevelNode/GameType").GetComponent <Text>();
            Text   text2     = root.transform.Find("PanelA/Award/Panel_PlayerExp/PvpLevelNode/PvpLevel").GetComponent <Text>();
            string text      = Singleton <CTextManager> .instance.GetText("Battle_Settle_Game_Type_Single");

            string        str2           = string.Empty;
            SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext();

            DebugHelper.Assert(curLvelContext != null, "Battle Level Context is NULL!!");
            uint iLevelID = (uint)curLvelContext.iLevelID;

            if (curLvelContext.isPVPLevel)
            {
                if (((curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH) || (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT)) || ((curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_ROOM) || (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT)))
                {
                    ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(iLevelID);
                    if (dataByKey == null)
                    {
                        ResCounterPartLevelInfo info2 = GameDataMgr.cpLevelDatabin.GetDataByKey(iLevelID);
                        object[] inParameters         = new object[] { iLevelID };
                        DebugHelper.Assert(info2 != null, "Failed find counterpart level config for id {0}", inParameters);
                        str2 = Utility.UTF8Convert(info2.stLevelCommonInfo.szName);
                        text = Singleton <CTextManager> .instance.GetText(string.Format("Battle_Settle_Game_Type{0}", info2.stLevelCommonInfo.bMaxAcntNum / 2));
                    }
                    else
                    {
                        str2 = Utility.UTF8Convert(dataByKey.stLevelCommonInfo.szName);
                        text = Singleton <CTextManager> .instance.GetText(string.Format("Battle_Settle_Game_Type{0}", dataByKey.stLevelCommonInfo.bMaxAcntNum / 2));
                    }
                }
                else if (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER)
                {
                    ResRankLevelInfo info3 = GameDataMgr.rankLevelDatabin.GetDataByKey(iLevelID);
                    DebugHelper.Assert(info3 != null);
                    str2 = Utility.UTF8Convert(info3.stLevelCommonInfo.szName);
                    text = Singleton <CTextManager> .instance.GetText(string.Format("Battle_Settle_Game_Type{0}", info3.stLevelCommonInfo.bMaxAcntNum / 2));
                }
            }
            else if (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_ARENA)
            {
                ResLevelCfgInfo info4     = GameDataMgr.arenaLevelDatabin.GetDataByKey((int)iLevelID);
                object[]        objArray2 = new object[] { iLevelID };
                DebugHelper.Assert(info4 != null, "Failed find level config for id {0}", objArray2);
                str2 = Utility.UTF8Convert(info4.szName);
            }
            else if (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT)
            {
                ResAcntBattleLevelInfo info5 = GameDataMgr.pvpLevelDatabin.GetDataByKey(iLevelID);
                object[] objArray3           = new object[] { iLevelID };
                DebugHelper.Assert(info5 != null, "Failed find level config for id {0}", objArray3);
                str2 = Utility.UTF8Convert(info5.stLevelCommonInfo.szName);
            }
            component.text = text;
            text2.text     = str2;
        }
Exemplo n.º 2
0
        public static ResDT_LevelCommonInfo FindLevelConfigMultiGame(int levelId)
        {
            ResDT_LevelCommonInfo stLevelCommonInfo = null;
            SLevelContext         curLvelContext    = Singleton <BattleLogic> .instance.GetCurLvelContext();

            if (curLvelContext != null)
            {
                if (((curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH) || (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT)) || ((curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_ROOM) || (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT)))
                {
                    ResAcntBattleLevelInfo  dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(levelId);
                    ResCounterPartLevelInfo info4     = null;
                    if (dataByKey == null)
                    {
                        info4 = GameDataMgr.cpLevelDatabin.GetDataByKey(levelId);
                        object[] inParameters = new object[] { levelId };
                        DebugHelper.Assert(info4 != null, "Failed find counterpart level config for id {0}", inParameters);
                        return(info4.stLevelCommonInfo);
                    }
                    return(dataByKey.stLevelCommonInfo);
                }
                if (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER)
                {
                    ResRankLevelInfo info5 = GameDataMgr.rankLevelDatabin.GetDataByKey(levelId);
                    if (info5 != null)
                    {
                        stLevelCommonInfo = info5.stLevelCommonInfo;
                    }
                    return(stLevelCommonInfo);
                }
                if (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH)
                {
                    ResRewardMatchLevelInfo info6 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(levelId);
                    if (info6 != null)
                    {
                        stLevelCommonInfo = info6.stLevelCommonInfo;
                    }
                    return(stLevelCommonInfo);
                }
                if (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_GUIDE)
                {
                    ResLevelCfgInfo info7 = GameDataMgr.levelDatabin.GetDataByKey(levelId);
                    stLevelCommonInfo = new ResDT_LevelCommonInfo {
                        bMaxAcntNum = info7.bMaxAcntNum
                    };
                }
            }
            return(stLevelCommonInfo);
        }
Exemplo n.º 3
0
        public static ResDT_LevelCommonInfo GetPvpMapCommonInfo(byte mapType, uint mapId)
        {
            ResDT_LevelCommonInfo resDT_LevelCommonInfo = new ResDT_LevelCommonInfo();

            if (mapType == 1)
            {
                ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(dataByKey != null);
                resDT_LevelCommonInfo = dataByKey.stLevelCommonInfo;
            }
            else if (mapType == 3)
            {
                ResRankLevelInfo dataByKey2 = GameDataMgr.rankLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(dataByKey2 != null);
                resDT_LevelCommonInfo = dataByKey2.stLevelCommonInfo;
            }
            else if (mapType == 4)
            {
                ResEntertainmentLevelInfo dataByKey3 = GameDataMgr.entertainLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(dataByKey3 != null);
                resDT_LevelCommonInfo = dataByKey3.stLevelCommonInfo;
            }
            else if (mapType == 5)
            {
                ResRewardMatchLevelInfo dataByKey4 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(dataByKey4 != null);
                resDT_LevelCommonInfo = dataByKey4.stLevelCommonInfo;
            }
            else if (mapType == 6)
            {
                ResGuildMatchLevelInfo dataByKey5 = GameDataMgr.guildMatchLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(dataByKey5 != null);
                resDT_LevelCommonInfo = dataByKey5.stLevelCommonInfo;
            }
            else if (mapType == 2)
            {
                ResCounterPartLevelInfo dataByKey6 = GameDataMgr.cpLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(dataByKey6 != null);
                resDT_LevelCommonInfo = dataByKey6.stLevelCommonInfo;
            }
            if (resDT_LevelCommonInfo == null)
            {
                resDT_LevelCommonInfo = new ResDT_LevelCommonInfo();
            }
            return(resDT_LevelCommonInfo);
        }
Exemplo n.º 4
0
        public ResDT_LevelCommonInfo GetPvpMapCommonInfo(int mapType, uint mapId)
        {
            ResDT_LevelCommonInfo resDT_LevelCommonInfo = null;

            switch (mapType)
            {
            case 1:
            {
                ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(mapId);
                resDT_LevelCommonInfo = dataByKey.stLevelCommonInfo;
                break;
            }

            case 2:
            {
                ResCounterPartLevelInfo dataByKey2 = GameDataMgr.cpLevelDatabin.GetDataByKey(mapId);
                resDT_LevelCommonInfo = dataByKey2.stLevelCommonInfo;
                break;
            }

            case 3:
            {
                ResRankLevelInfo dataByKey3 = GameDataMgr.rankLevelDatabin.GetDataByKey(mapId);
                resDT_LevelCommonInfo = dataByKey3.stLevelCommonInfo;
                break;
            }

            case 4:
            {
                ResEntertainmentLevelInfo dataByKey4 = GameDataMgr.entertainLevelDatabin.GetDataByKey(mapId);
                resDT_LevelCommonInfo = dataByKey4.stLevelCommonInfo;
                break;
            }

            case 5:
            {
                ResRewardMatchLevelInfo dataByKey5 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(mapId);
                resDT_LevelCommonInfo = dataByKey5.stLevelCommonInfo;
                break;
            }
            }
            if (resDT_LevelCommonInfo == null)
            {
            }
            return(resDT_LevelCommonInfo);
        }
Exemplo n.º 5
0
        public static ResDT_LevelCommonInfo GetPvpMapCommonInfo(byte mapType, uint mapId)
        {
            ResDT_LevelCommonInfo stLevelCommonInfo = new ResDT_LevelCommonInfo();

            if (mapType == 1)
            {
                ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(dataByKey != null);
                stLevelCommonInfo = dataByKey.stLevelCommonInfo;
            }
            else if (mapType == 3)
            {
                ResRankLevelInfo info3 = GameDataMgr.rankLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(info3 != null);
                stLevelCommonInfo = info3.stLevelCommonInfo;
            }
            else if (mapType == 4)
            {
                ResEntertainmentLevelInfo info4 = GameDataMgr.entertainLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(info4 != null);
                stLevelCommonInfo = info4.stLevelCommonInfo;
            }
            else if (mapType == 5)
            {
                ResRewardMatchLevelInfo info5 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(info5 != null);
                stLevelCommonInfo = info5.stLevelCommonInfo;
            }
            else if (mapType == 2)
            {
                ResCounterPartLevelInfo info6 = GameDataMgr.cpLevelDatabin.GetDataByKey(mapId);
                DebugHelper.Assert(info6 != null);
                stLevelCommonInfo = info6.stLevelCommonInfo;
            }
            if (stLevelCommonInfo == null)
            {
                stLevelCommonInfo = new ResDT_LevelCommonInfo();
            }
            return(stLevelCommonInfo);
        }
Exemplo n.º 6
0
        public static void FindLevelConfigSingleGame(int levelId, out ResLevelCfgInfo outLevelCfg, out ResDT_LevelCommonInfo outLevelComInfo)
        {
            outLevelCfg     = null;
            outLevelComInfo = null;
            SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext();

            if (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT)
            {
                ResAcntBattleLevelInfo  dataByKey         = GameDataMgr.pvpLevelDatabin.GetDataByKey(levelId);
                ResDT_LevelCommonInfo   stLevelCommonInfo = null;
                ResCounterPartLevelInfo info3             = null;
                if (dataByKey == null)
                {
                    info3 = GameDataMgr.cpLevelDatabin.GetDataByKey(levelId);
                    object[] inParameters = new object[] { levelId };
                    DebugHelper.Assert(info3 != null, "Failed find counterpart level config for id {0}", inParameters);
                    stLevelCommonInfo = info3.stLevelCommonInfo;
                }
                else
                {
                    stLevelCommonInfo = dataByKey.stLevelCommonInfo;
                }
                outLevelComInfo = stLevelCommonInfo;
            }
            else if (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_ARENA)
            {
                ResLevelCfgInfo info4 = GameDataMgr.arenaLevelDatabin.GetDataByKey(levelId);
                outLevelCfg = info4;
            }
            else if (curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_BURNING)
            {
                ResLevelCfgInfo info5 = GameDataMgr.burnMap.GetDataByKey(levelId);
                outLevelCfg = info5;
            }
            else
            {
                ResLevelCfgInfo info6 = GameDataMgr.levelDatabin.GetDataByKey(levelId);
                outLevelCfg = info6;
            }
        }
Exemplo n.º 7
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 (comdt_playerinfo.bObjType != 0)
                    {
                        ulong uid = 0L;
                        uint  dwFakeLogicWorldID = 0;
                        uint  level = 1;
                        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;
                        }
                        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, 0);

                        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);
                    }
                }
                if (InMessage.bGameType == 2)
                {
                    ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey(InMessage.iLevelId);
                    DebugHelper.Assert(dataByKey != null);
                    base.LevelContext = new SLevelContext();
                    base.LevelContext.Init(dataByKey, 1);
                    if (dataByKey.bGuideLevelSubType == 0)
                    {
                        base.LevelContext.isPVPLevel = true;
                        base.LevelContext.isPVPMode  = true;
                    }
                    else if (dataByKey.bGuideLevelSubType == 1)
                    {
                        base.LevelContext.isPVPLevel = false;
                        base.LevelContext.isPVPMode  = false;
                    }
                    base.LevelContext.GameType            = (COM_GAME_TYPE)InMessage.bGameType;
                    this.levelContext.bShowTrainingHelper = dataByKey.bShowTrainingHelper > 0;
                    this.m_LevelDesignFileName            = base.LevelContext.LevelDesignFileName;
                    this.m_LevelArtistFileName            = base.LevelContext.LevelArtistFileName;
                }
                else if (InMessage.bGameType == 0)
                {
                    ResLevelCfgInfo levelCfg = GameDataMgr.levelDatabin.GetDataByKey(InMessage.iLevelId);
                    DebugHelper.Assert(levelCfg != null);
                    base.LevelContext = new SLevelContext();
                    base.LevelContext.Init(levelCfg, Singleton <CAdventureSys> .instance.currentDifficulty);
                    base.LevelContext.GameType            = (COM_GAME_TYPE)InMessage.bGameType;
                    this.levelContext.bShowTrainingHelper = levelCfg.bShowTrainingHelper > 0;
                    this.m_LevelDesignFileName            = base.LevelContext.LevelDesignFileName;
                    this.m_LevelArtistFileName            = base.LevelContext.LevelArtistFileName;
                }
                else if (InMessage.bGameType == 7)
                {
                    ResLevelCfgInfo info3 = GameDataMgr.burnMap.GetDataByKey(Singleton <BurnExpeditionController> .GetInstance().model.Get_LevelID(Singleton <BurnExpeditionController> .GetInstance().model.curSelect_LevelIndex));
                    DebugHelper.Assert(info3 != null);
                    base.LevelContext = new SLevelContext();
                    base.LevelContext.Init(info3, 1);
                    base.LevelContext.GameType            = (COM_GAME_TYPE)InMessage.bGameType;
                    this.levelContext.bShowTrainingHelper = info3.bShowTrainingHelper > 0;
                    this.m_LevelDesignFileName            = base.LevelContext.LevelDesignFileName;
                    this.m_LevelArtistFileName            = base.LevelContext.LevelArtistFileName;
                }
                else if (InMessage.bGameType == 8)
                {
                    ResLevelCfgInfo info4 = GameDataMgr.arenaLevelDatabin.GetDataByKey(InMessage.iLevelId);
                    DebugHelper.Assert(info4 != null);
                    base.LevelContext = new SLevelContext();
                    base.LevelContext.Init(info4, 1);
                    base.LevelContext.GameType            = (COM_GAME_TYPE)InMessage.bGameType;
                    this.levelContext.bShowTrainingHelper = info4.bShowTrainingHelper > 0;
                    this.m_LevelDesignFileName            = base.LevelContext.LevelDesignFileName;
                    this.m_LevelArtistFileName            = base.LevelContext.LevelArtistFileName;
                }
                else if (InMessage.bGameType == 1)
                {
                    base.LevelContext          = CLevelCfgLogicManager.MakeMobaContext((uint)InMessage.iLevelId, COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT, 1);
                    base.LevelContext.GameType = (COM_GAME_TYPE)InMessage.bGameType;
                    ResAcntBattleLevelInfo info5 = GameDataMgr.pvpLevelDatabin.GetDataByKey((uint)InMessage.iLevelId);
                    if (info5 != null)
                    {
                        this.m_LevelDesignFileName = StringHelper.UTF8BytesToString(ref info5.stLevelCommonInfo.szDesignFileName);
                        if (info5.stLevelCommonInfo.szArtistFileName != null)
                        {
                            this.m_LevelArtistFileName = StringHelper.UTF8BytesToString(ref info5.stLevelCommonInfo.szArtistFileName);
                        }
                    }
                    else
                    {
                        ResCounterPartLevelInfo info6 = GameDataMgr.cpLevelDatabin.GetDataByKey((uint)InMessage.iLevelId);
                        this.m_LevelDesignFileName = StringHelper.UTF8BytesToString(ref info6.stLevelCommonInfo.szDesignFileName);
                        if (info6.stLevelCommonInfo.szArtistFileName != null)
                        {
                            this.m_LevelArtistFileName = StringHelper.UTF8BytesToString(ref info6.stLevelCommonInfo.szArtistFileName);
                        }
                    }
                    base.LevelContext.isWarmBattle      = Convert.ToBoolean(InMessage.stGameParam.stSingleGameRspOfCombat.bIsWarmBattle);
                    base.LevelContext.DynamicDifficulty = InMessage.stGameParam.stSingleGameRspOfCombat.bAILevel;
                    base.LevelContext.MapType           = InMessage.stGameParam.stSingleGameRspOfCombat.bMapType;
                }
            }
        }
Exemplo n.º 8
0
        public uint GetMvpPlayer(COM_PLAYERCAMP camp, bool bWin)
        {
            if ((this.m_winMvpId != 0) || (this.m_loseMvpId != 0))
            {
                if (bWin)
                {
                    return(this.m_winMvpId);
                }
                return(this.m_loseMvpId);
            }
            SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext();

            int bMaxAcntNum = 0;

            if (curLvelContext != null)
            {
                if (((curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT) || (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH)) || ((curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_ROOM) || (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT)))
                {
                    ResAcntBattleLevelInfo  dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID);
                    ResCounterPartLevelInfo info2     = null;
                    if (dataByKey == null)
                    {
                        info2 = GameDataMgr.cpLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID);
                    }
                    if (dataByKey != null)
                    {
                        bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum;
                    }
                    else
                    {
                        bMaxAcntNum = info2.stLevelCommonInfo.bMaxAcntNum;
                    }
                }
                else if (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER)
                {
                    ResRankLevelInfo info3 = GameDataMgr.rankLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID);
                    if (info3 != null)
                    {
                        bMaxAcntNum = info3.stLevelCommonInfo.bMaxAcntNum;
                    }
                }
                else if (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH)
                {
                    ResRewardMatchLevelInfo info4 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID);
                    if (info4 != null)
                    {
                        bMaxAcntNum = info4.stLevelCommonInfo.bMaxAcntNum;
                    }
                }
            }
            if (bMaxAcntNum <= 2)
            {
                return(0);
            }
            uint  playerId = 0;
            float num3     = 0f;
            int   numKill  = 0;

            DictionaryView <uint, PlayerKDA> .Enumerator enumerator = Singleton <BattleStatistic> .instance.m_playerKDAStat.GetEnumerator();

            PlayerKDA rkda = null;
            float     num5 = ((float)GameDataMgr.globalInfoDatabin.GetDataByKey((uint)0xb1).dwConfValue) / 10000f;

            while (enumerator.MoveNext())
            {
                KeyValuePair <uint, PlayerKDA> current = enumerator.Current;
                rkda = current.Value;
                if ((!rkda.bHangup && !rkda.bRunaway) && !rkda.bDisconnect)
                {
                    float scoreValue = rkda.GetScoreValue();
                    if ((rkda.PlayerCamp == camp) && (scoreValue >= num3))
                    {
                        if (scoreValue == num3)
                        {
                            KeyValuePair <uint, PlayerKDA> pair2 = enumerator.Current;
                            if (pair2.Value.numKill < numKill)
                            {
                                continue;
                            }
                        }
                        if (bWin || (scoreValue >= num5))
                        {
                            KeyValuePair <uint, PlayerKDA> pair3 = enumerator.Current;
                            playerId = pair3.Value.PlayerId;
                            num3     = scoreValue;
                            KeyValuePair <uint, PlayerKDA> pair4 = enumerator.Current;
                            numKill = pair4.Value.numKill;
                        }
                    }
                }
            }
            return(playerId);
        }
Exemplo n.º 9
0
        public static SLevelContext MakeMobaContext(uint LevelId, COM_GAME_TYPE GameType, int difficult)
        {
            SLevelContext context = new SLevelContext {
                isPVPLevel          = true,
                GameType            = GameType,
                isPVPMode           = true,
                difficulty          = difficult,
                horizonEnableMethod = Horizon.EnableMethod.EnableAll
            };

            if (GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT)
            {
                context.MapType = 4;
            }
            if ((GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH) && IsLuanDouRuleWithUnion(LevelId))
            {
                context.MapType = 4;
            }
            if (((GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH) || (GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT)) || ((GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_ROOM) || (GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT)))
            {
                ResAcntBattleLevelInfo  info = GameDataMgr.pvpLevelDatabin.GetDataByKey(LevelId);
                ResDT_LevelCommonInfo   stLevelCommonInfo = null;
                ResCounterPartLevelInfo info3             = null;
                if (info == null)
                {
                    info3 = GameDataMgr.cpLevelDatabin.GetDataByKey(LevelId);
                    object[] inParameters = new object[] { LevelId };
                    DebugHelper.Assert(info3 != null, "Failed find counterpart level config for id {0}", inParameters);
                    stLevelCommonInfo = info3.stLevelCommonInfo;
                }
                else
                {
                    stLevelCommonInfo = info.stLevelCommonInfo;
                }
                context.LevelName           = StringHelper.UTF8BytesToString(ref stLevelCommonInfo.szName);
                context.LevelDesignFileName = StringHelper.UTF8BytesToString(ref stLevelCommonInfo.szDesignFileName);
                if (stLevelCommonInfo.szArtistFileName != null)
                {
                    context.LevelArtistFileName = StringHelper.UTF8BytesToString(ref stLevelCommonInfo.szArtistFileName);
                }
                context.mapWidth     = stLevelCommonInfo.iMapWidth;
                context.mapHeight    = stLevelCommonInfo.iMapHeight;
                context.bigMapWidth  = stLevelCommonInfo.iBigMapWidth;
                context.bigMapHeight = stLevelCommonInfo.iBigMapHeight;
                context.miniMapPath  = stLevelCommonInfo.szThumbnailPath;
                context.bigMapPath   = stLevelCommonInfo.szBigMapPath;
                context.mapPath      = StringHelper.UTF8BytesToString(ref stLevelCommonInfo.szMapPath);
                context.AIModeType   = (RES_LEVEL_HEROAITYPE)stLevelCommonInfo.iHeroAIType;
                if (info == null)
                {
                    context.iLevelID              = (int)info3.dwMapId;
                    context.dwAttackOrder         = info3.dwAttackOrderID;
                    context.dynamicPropertyConfig = info3.dwDynamicPropertyCfg;
                    context.battleTaskOfCamps[1]  = info3.dwBattleTaskOfCamp1;
                    context.battleTaskOfCamps[2]  = info3.dwBattleTaskOfCamp2;
                    context.musicStartEvent       = StringHelper.UTF8BytesToString(ref info3.szMusicStartEvent);
                    context.musicEndEvent         = StringHelper.UTF8BytesToString(ref info3.szMusicEndEvent);
                    context.bankResName           = StringHelper.UTF8BytesToString(ref info3.szBankResourceName);
                    context.ambientSoundEvent     = StringHelper.UTF8BytesToString(ref info3.szAmbientSoundEvent);
                }
                else
                {
                    context.iLevelID              = (int)info.dwMapId;
                    context.dwAttackOrder         = info.dwAttackOrderID;
                    context.dynamicPropertyConfig = info.dwDynamicPropertyCfg;
                    context.battleTaskOfCamps[1]  = info.dwBattleTaskOfCamp1;
                    context.battleTaskOfCamps[2]  = info.dwBattleTaskOfCamp2;
                    context.musicStartEvent       = StringHelper.UTF8BytesToString(ref info.szMusicStartEvent);
                    context.musicEndEvent         = StringHelper.UTF8BytesToString(ref info.szMusicEndEvent);
                    context.bankResName           = StringHelper.UTF8BytesToString(ref info.szBankResourceName);
                    context.ambientSoundEvent     = StringHelper.UTF8BytesToString(ref info.szAmbientSoundEvent);
                    context.pvpLevelPlayerNum     = info.stLevelCommonInfo.bMaxAcntNum;
                }
            }
            else if (GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER)
            {
                ResRankLevelInfo info4 = GameDataMgr.rankLevelDatabin.GetDataByKey(LevelId);
                DebugHelper.Assert(info4 != null);
                context.LevelName           = StringHelper.UTF8BytesToString(ref info4.stLevelCommonInfo.szName);
                context.LevelDesignFileName = StringHelper.UTF8BytesToString(ref info4.stLevelCommonInfo.szDesignFileName);
                if (info4.stLevelCommonInfo.szArtistFileName != null)
                {
                    context.LevelArtistFileName = StringHelper.UTF8BytesToString(ref info4.stLevelCommonInfo.szArtistFileName);
                }
                context.iLevelID              = (int)info4.dwMapId;
                context.dwAttackOrder         = info4.dwAttackOrderID;
                context.dynamicPropertyConfig = info4.dwDynamicPropertyCfg;
                context.AIModeType            = (RES_LEVEL_HEROAITYPE)info4.stLevelCommonInfo.iHeroAIType;
                context.mapWidth              = info4.stLevelCommonInfo.iMapWidth;
                context.mapHeight             = info4.stLevelCommonInfo.iMapHeight;
                context.bigMapWidth           = info4.stLevelCommonInfo.iBigMapWidth;
                context.bigMapHeight          = info4.stLevelCommonInfo.iBigMapHeight;
                context.miniMapPath           = info4.stLevelCommonInfo.szThumbnailPath;
                context.bigMapPath            = info4.stLevelCommonInfo.szBigMapPath;
                context.battleTaskOfCamps[1]  = info4.dwBattleTaskOfCamp1;
                context.battleTaskOfCamps[2]  = info4.dwBattleTaskOfCamp2;
                context.musicStartEvent       = StringHelper.UTF8BytesToString(ref info4.szMusicStartEvent);
                context.musicEndEvent         = StringHelper.UTF8BytesToString(ref info4.szMusicEndEvent);
                context.ambientSoundEvent     = StringHelper.UTF8BytesToString(ref info4.szAmbientSoundEvent);
                context.bankResName           = StringHelper.UTF8BytesToString(ref info4.szBankResourceName);
                context.pvpLevelPlayerNum     = info4.stLevelCommonInfo.bMaxAcntNum;
            }
            else if (GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH)
            {
                ResRewardMatchLevelInfo info5 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(LevelId);
                DebugHelper.Assert(info5 != null);
                context.LevelName           = StringHelper.UTF8BytesToString(ref info5.stLevelCommonInfo.szName);
                context.LevelDesignFileName = StringHelper.UTF8BytesToString(ref info5.stLevelCommonInfo.szDesignFileName);
                if (info5.stLevelCommonInfo.szArtistFileName != null)
                {
                    context.LevelArtistFileName = StringHelper.UTF8BytesToString(ref info5.stLevelCommonInfo.szArtistFileName);
                }
                context.iLevelID              = (int)info5.dwMapId;
                context.dwAttackOrder         = info5.dwAttackOrderID;
                context.dynamicPropertyConfig = info5.dwDynamicPropertyCfg;
                context.AIModeType            = (RES_LEVEL_HEROAITYPE)info5.stLevelCommonInfo.iHeroAIType;
                context.mapWidth              = info5.stLevelCommonInfo.iMapWidth;
                context.mapHeight             = info5.stLevelCommonInfo.iMapHeight;
                context.bigMapWidth           = info5.stLevelCommonInfo.iBigMapWidth;
                context.bigMapHeight          = info5.stLevelCommonInfo.iBigMapHeight;
                context.miniMapPath           = info5.stLevelCommonInfo.szThumbnailPath;
                context.bigMapPath            = info5.stLevelCommonInfo.szBigMapPath;
                context.battleTaskOfCamps[1]  = info5.dwBattleTaskOfCamp1;
                context.battleTaskOfCamps[2]  = info5.dwBattleTaskOfCamp2;
                context.musicStartEvent       = StringHelper.UTF8BytesToString(ref info5.szMusicStartEvent);
                context.musicEndEvent         = StringHelper.UTF8BytesToString(ref info5.szMusicEndEvent);
                context.ambientSoundEvent     = StringHelper.UTF8BytesToString(ref info5.szAmbientSoundEvent);
                context.bankResName           = StringHelper.UTF8BytesToString(ref info5.szBankResourceName);
                context.pvpLevelPlayerNum     = info5.stLevelCommonInfo.bMaxAcntNum;
                context.m_SecondName          = info5.szMatchName;
            }
            ResEntertainmentLevelInfo dataByKey = GameDataMgr.entertainLevelDatabin.GetDataByKey(LevelId);

            if (dataByKey != null)
            {
                context.SubMapType = dataByKey.bEntertainmentSubType;
            }
            return(context);
        }
Exemplo n.º 10
0
        public static void InitMapDataInfo()
        {
            Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CHeroSelectSystem> .GetInstance().m_roomInfo;

            ResDT_LevelCommonInfo mapData = Singleton <CHeroSelectSystem> .GetInstance().m_mapData;

            DebugHelper.Assert(roomInfo != null);
            uint dwMapId = roomInfo.roomAttrib.dwMapId;

            if (roomInfo.roomAttrib.bMapType == 1)
            {
                ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(dataByKey != null);
                mapData.szName           = dataByKey.stLevelCommonInfo.szName;
                mapData.szDesignFileName = dataByKey.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = dataByKey.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = dataByKey.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = dataByKey.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = dataByKey.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = dataByKey.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = dataByKey.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = dataByKey.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = dataByKey.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 3)
            {
                ResRankLevelInfo info4 = GameDataMgr.rankLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info4 != null);
                mapData.szName           = info4.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info4.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info4.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info4.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info4.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info4.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info4.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info4.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info4.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info4.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 2)
            {
                ResCounterPartLevelInfo info5 = GameDataMgr.cpLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info5 != null);
                mapData.szName           = info5.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info5.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info5.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info5.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info5.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info5.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info5.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info5.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info5.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info5.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 4)
            {
                ResAcntBattleLevelInfo info6 = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info6 != null);
                mapData.szName           = info6.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info6.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info6.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info6.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info6.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info6.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info6.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info6.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info6.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info6.stLevelCommonInfo.iHeroAIType;
            }
            else if (roomInfo.roomAttrib.bMapType == 5)
            {
                ResRewardMatchLevelInfo info7 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(dwMapId);
                DebugHelper.Assert(info7 != null);
                mapData.szName           = info7.stLevelCommonInfo.szName;
                mapData.szDesignFileName = info7.stLevelCommonInfo.szDesignFileName;
                mapData.szArtistFileName = info7.stLevelCommonInfo.szArtistFileName;
                mapData.szThumbnailPath  = info7.stLevelCommonInfo.szThumbnailPath;
                mapData.bMaxAcntNum      = info7.stLevelCommonInfo.bMaxAcntNum;
                mapData.bValidRoomType   = info7.stLevelCommonInfo.bValidRoomType;
                mapData.bHeroNum         = info7.stLevelCommonInfo.bHeroNum;
                mapData.bIsAllowHeroDup  = info7.stLevelCommonInfo.bIsAllowHeroDup;
                mapData.dwHeroFormId     = info7.stLevelCommonInfo.dwHeroFormId;
                mapData.iHeroAIType      = info7.stLevelCommonInfo.iHeroAIType;
                Singleton <CHeroSelectSystem> .GetInstance().m_mapSubType = (int)info7.dwSubType;
            }
            CSDT_SINGLE_GAME_OF_COMBAT reportInfo = new CSDT_SINGLE_GAME_OF_COMBAT {
                bRoomType = (byte)Singleton <CHeroSelectSystem> .GetInstance().m_roomType,
                dwMapId   = roomInfo.roomAttrib.dwMapId,
                bMapType  = roomInfo.roomAttrib.bMapType,
                bAILevel  = roomInfo.roomAttrib.npcAILevel
            };
            byte bHeroNum     = mapData.bHeroNum;
            uint dwHeroFormId = mapData.dwHeroFormId;

            Singleton <CHeroSelectSystem> .GetInstance().SetPVEDataWithCombat(bHeroNum, dwHeroFormId, reportInfo, "Room Type");
        }
Exemplo n.º 11
0
        public static uint GetLevelIncomeRuleID(SLevelContext _levelContext, IncomeControl inControl)
        {
            inControl.m_isExpCompensate          = false;
            inControl.m_originalGoldCoinInBattle = 0;
            inControl.m_compensateRateList.Clear();
            uint dwSoulID = 0;

            if ((_levelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_ADVENTURE) || (_levelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_GUIDE))
            {
                ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey(_levelContext.iLevelID);
                return((dataByKey == null) ? 0 : dataByKey.dwSoulID);
            }
            if (((_levelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT) || (_levelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH)) || ((_levelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_ROOM) || (_levelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT)))
            {
                ResAcntBattleLevelInfo  info2 = GameDataMgr.pvpLevelDatabin.GetDataByKey((uint)_levelContext.iLevelID);
                ResCounterPartLevelInfo info3 = null;
                if (info2 != null)
                {
                    dwSoulID = info2.stLevelCommonInfo.dwSoulID;
                    inControl.InitExpCompensateInfo(info2.stLevelCommonInfo.bIsOpenExpCompensate, ref info2.stLevelCommonInfo.astExpCompensateDetail);
                    inControl.m_originalGoldCoinInBattle = info2.wOriginalGoldCoinInBattle;
                    return(dwSoulID);
                }
                info3 = GameDataMgr.cpLevelDatabin.GetDataByKey((uint)_levelContext.iLevelID);
                if (info3 != null)
                {
                    dwSoulID = info3.stLevelCommonInfo.dwSoulID;
                    inControl.InitExpCompensateInfo(info3.stLevelCommonInfo.bIsOpenExpCompensate, ref info3.stLevelCommonInfo.astExpCompensateDetail);
                    inControl.m_originalGoldCoinInBattle = info3.wOriginalGoldCoinInBattle;
                }
                return(dwSoulID);
            }
            if (_levelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER)
            {
                ResRankLevelInfo info4 = GameDataMgr.rankLevelDatabin.GetDataByKey((uint)_levelContext.iLevelID);
                dwSoulID = (info4 == null) ? 0 : info4.stLevelCommonInfo.dwSoulID;
                if (info4 != null)
                {
                    inControl.InitExpCompensateInfo(info4.stLevelCommonInfo.bIsOpenExpCompensate, ref info4.stLevelCommonInfo.astExpCompensateDetail);
                    inControl.m_originalGoldCoinInBattle = info4.wOriginalGoldCoinInBattle;
                }
                return(dwSoulID);
            }
            if (_levelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH)
            {
                ResRewardMatchLevelInfo info5 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey((uint)_levelContext.iLevelID);
                dwSoulID = (info5 == null) ? 0 : info5.stLevelCommonInfo.dwSoulID;
                if (info5 != null)
                {
                    inControl.InitExpCompensateInfo(info5.stLevelCommonInfo.bIsOpenExpCompensate, ref info5.stLevelCommonInfo.astExpCompensateDetail);
                    inControl.m_originalGoldCoinInBattle = info5.wOriginalGoldCoinInBattle;
                }
                return(dwSoulID);
            }
            if (_levelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_ACTIVITY)
            {
                ResLevelCfgInfo info6 = GameDataMgr.activityLevelDatabin.GetDataByKey(_levelContext.iLevelID);
                return((info6 == null) ? 0 : info6.dwSoulID);
            }
            if (_levelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_BURNING)
            {
                ResLevelCfgInfo info7 = GameDataMgr.burnMap.GetDataByKey(_levelContext.iLevelID);
                return((info7 == null) ? 0 : info7.dwSoulID);
            }
            if (_levelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_ARENA)
            {
                ResLevelCfgInfo info8 = GameDataMgr.burnMap.GetDataByKey(_levelContext.iLevelID);
                dwSoulID = (info8 == null) ? 0 : info8.dwSoulID;
            }
            return(dwSoulID);
        }