private void OnRoom_ChangePos(CUIEvent uiEvent) { COM_PLAYERCAMP camp = COM_PLAYERCAMP.COM_PLAYERCAMP_1; if (uiEvent.m_eventParams.tag == 1) { camp = COM_PLAYERCAMP.COM_PLAYERCAMP_1; } else if (uiEvent.m_eventParams.tag == 2) { camp = COM_PLAYERCAMP.COM_PLAYERCAMP_2; } if (this.roomInfo != null) { uint dwMapId = this.roomInfo.roomAttrib.dwMapId; ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId); DebugHelper.Assert(dataByKey != null); int bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum; int freePos = this.roomInfo.GetFreePos(camp, bMaxAcntNum); if (freePos >= 0) { ReqChangeCamp(camp, freePos); } } }
public static int GetMapPlayerNum(uint MapId, COM_BATTLE_MAP_TYPE MapType) { if ((MapType == COM_BATTLE_MAP_TYPE.COM_BATTLE_MAP_TYPE_VERSUS) || (MapType == COM_BATTLE_MAP_TYPE.COM_BATTLE_MAP_TYPE_ENTERTAINMENT)) { ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(MapId); object[] inParameters = new object[] { MapId }; DebugHelper.Assert(dataByKey != null, "can't find map by id = {0}", inParameters); return((dataByKey == null) ? 0 : dataByKey.stLevelCommonInfo.bMaxAcntNum); } if (MapType == COM_BATTLE_MAP_TYPE.COM_BATTLE_MAP_TYPE_RANK) { ResRankLevelInfo info2 = GameDataMgr.rankLevelDatabin.GetDataByKey(MapId); object[] objArray2 = new object[] { MapId }; DebugHelper.Assert(info2 != null, "can't find map by id = {0}", objArray2); return((info2 == null) ? 0 : info2.stLevelCommonInfo.bMaxAcntNum); } if (MapType == COM_BATTLE_MAP_TYPE.COM_BATTLE_MAP_TYPE_REWARDMATCH) { ResRewardMatchLevelInfo info3 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(MapId); object[] objArray3 = new object[] { MapId }; DebugHelper.Assert(info3 != null, "can't find map by id = {0}", objArray3); return((info3 == null) ? 0 : info3.stLevelCommonInfo.bMaxAcntNum); } return(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; }
public bool ShouldStatInThisGameMode() { SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext(); if (!curLvelContext.isPVPLevel) { return(false); } ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(curLvelContext.iLevelID); return((dataByKey != null) && (dataByKey.stLevelCommonInfo.bMaxAcntNum == 10)); }
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); }
public static void ReqCreateRoom(uint MapId) { Debug.Log("ReqCreateRoom"); CSPkg msg = NetworkModule.CreateDefaultCSPKG(0x3fc); msg.stPkgData.stCreateMultGameReq.dwMapId = MapId; StringHelper.StringToUTF8Bytes("testRoom", ref msg.stPkgData.stCreateMultGameReq.szRoomName); msg.stPkgData.stCreateMultGameReq.bGameMode = 1; msg.stPkgData.stCreateMultGameReq.bMapType = 1; ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(MapId); if ((dataByKey != null) && (dataByKey.stLevelCommonInfo.bChaosPickRule > 0)) { msg.stPkgData.stCreateMultGameReq.bMapType = 4; } Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref msg, true); }
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); }
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); }
public static void SetRoomData(GameObject root, Assets.Scripts.GameSystem.RoomInfo data) { uint dwMapId = data.roomAttrib.dwMapId; ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId); DebugHelper.Assert(dataByKey != null); SetStartBtnStatus(root, data); UpdateBtnStatus(root, data); int bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum; root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref dataByKey.stLevelCommonInfo.szName); root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(string.Format("Common_Team_Player_Type_{0}", bMaxAcntNum / 2)); GameObject gameObject = root.transform.Find("Panel_Main/Left_Player1").gameObject; MemberInfo memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 1); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 2); gameObject = root.transform.Find("Panel_Main/Left_Player2").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 2); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 4); gameObject = root.transform.Find("Panel_Main/Left_Player3").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 3); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 6); gameObject = root.transform.Find("Panel_Main/Left_Player4").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 4); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 8); gameObject = root.transform.Find("Panel_Main/Left_Player5").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_1, 5); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 10); gameObject = root.transform.Find("Panel_Main/Right_Player1").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 1); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 2); gameObject = root.transform.Find("Panel_Main/Right_Player2").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 2); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 4); gameObject = root.transform.Find("Panel_Main/Right_Player3").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 3); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 6); gameObject = root.transform.Find("Panel_Main/Right_Player4").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 4); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 8); gameObject = root.transform.Find("Panel_Main/Right_Player5").gameObject; memberInfo = GetMemberInfo(data, COM_PLAYERCAMP.COM_PLAYERCAMP_2, 5); SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 10); }
private void InitMaps(CUIFormScript rootFormScript) { this.mapList = new ListView <ResAcntBattleLevelInfo>(); uint[] numArray = new uint[10]; uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_1"), out numArray[0]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_2"), out numArray[1]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_3"), out numArray[2]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_4"), out numArray[3]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_5"), out numArray[4]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_6"), out numArray[5]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_7"), out numArray[6]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_8"), out numArray[7]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_9"), out numArray[8]); uint.TryParse(Singleton <CTextManager> .instance.GetText("MapID_Room_10"), out numArray[9]); for (int i = 0; i < numArray.Length; i++) { if (numArray[i] != 0) { ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(numArray[i]); if (dataByKey != null) { this.mapList.Add(dataByKey); } } } CUIListScript component = rootFormScript.transform.Find("Panel_Main/List").gameObject.GetComponent <CUIListScript>(); component.SetElementAmount(this.mapList.Count); for (int j = 0; j < component.m_elementAmount; j++) { Image image = component.GetElemenet(j).transform.GetComponent <Image>(); string prefabPath = CUIUtility.s_Sprite_Dynamic_PvpEntry_Dir + this.mapList[j].dwMapId; image.SetSprite(prefabPath, rootFormScript, true, false, false); } component.SelectElement(-1, true); if (CSysDynamicBlock.bLobbyEntryBlocked) { Transform transform = rootFormScript.transform.Find("panelGroup5"); if (transform != null) { transform.gameObject.CustomSetActive(false); } } }
private void OnRoom_SelectMap(CUIEvent uiEvent) { int selectedIndex = uiEvent.m_srcWidget.GetComponent <CUIListScript>().GetSelectedIndex(); if ((selectedIndex >= 0) && (selectedIndex < this.mapList.Count)) { ResAcntBattleLevelInfo info = this.mapList[selectedIndex]; this.mapId = info.dwMapId; if ((selectedIndex == 3) && !Singleton <CFunctionUnlockSys> .instance.FucIsUnlock(RES_SPECIALFUNCUNLOCK_TYPE.RES_SPECIALFUNCUNLOCKTYPE_ENTERTAINMENT)) { ResSpecialFucUnlock dataByKey = GameDataMgr.specialFunUnlockDatabin.GetDataByKey((uint)0x19); Singleton <CUIManager> .GetInstance().OpenTips(dataByKey.szLockedTip, false, 1f, null, new object[0]); } else { Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Room_CreateRoom); } } }
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; } }
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); }
public static void SetMultiGameContextLevelName(MultiGameContext mGameCon, uint mapId, COM_GAME_TYPE gameType) { if (gameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH) { ResRewardMatchLevelInfo dataByKey = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(mapId); if (dataByKey != null) { mGameCon.m_LevelDesignFileName = StringHelper.UTF8BytesToString(ref dataByKey.stLevelCommonInfo.szDesignFileName); if (dataByKey.stLevelCommonInfo.szArtistFileName != null) { mGameCon.m_LevelArtistFileName = StringHelper.UTF8BytesToString(ref dataByKey.stLevelCommonInfo.szArtistFileName); } } } else if (gameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER) { ResRankLevelInfo info2 = GameDataMgr.rankLevelDatabin.GetDataByKey(mapId); if (info2 != null) { mGameCon.m_LevelDesignFileName = StringHelper.UTF8BytesToString(ref info2.stLevelCommonInfo.szDesignFileName); if (info2.stLevelCommonInfo.szArtistFileName != null) { mGameCon.m_LevelArtistFileName = StringHelper.UTF8BytesToString(ref info2.stLevelCommonInfo.szArtistFileName); } } } else { ResAcntBattleLevelInfo info3 = GameDataMgr.pvpLevelDatabin.GetDataByKey(mapId); if (info3 != null) { mGameCon.m_LevelDesignFileName = StringHelper.UTF8BytesToString(ref info3.stLevelCommonInfo.szDesignFileName); if (info3.stLevelCommonInfo.szArtistFileName != null) { mGameCon.m_LevelArtistFileName = StringHelper.UTF8BytesToString(ref info3.stLevelCommonInfo.szArtistFileName); } } } }
public static void SetTeamData(GameObject root, TeamInfo data) { uint dwMapId = data.stTeamInfo.dwMapId; int bMapType = data.stTeamInfo.bMapType; int bMaxAcntNum = 0; switch (bMapType) { case 1: case 4: { ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId); DebugHelper.Assert(dataByKey != null); root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref dataByKey.stLevelCommonInfo.szName); bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum; break; } case 3: { ResRankLevelInfo info2 = GameDataMgr.rankLevelDatabin.GetDataByKey(dwMapId); DebugHelper.Assert(info2 != null); root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref info2.stLevelCommonInfo.szName); bMaxAcntNum = 4; break; } case 5: { ResRewardMatchLevelInfo info3 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(dwMapId); DebugHelper.Assert(info3 != null); root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref info3.stLevelCommonInfo.szName); bMaxAcntNum = info3.stLevelCommonInfo.bMaxAcntNum; break; } } if (bMapType == 3) { root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText("Common_Team_Player_Type_6"); } else { root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(string.Format("Common_Team_Player_Type_{0}", bMaxAcntNum / 2)); } CMatchingView.SetStartBtnStatus(root); GameObject gameObject = root.transform.Find("Panel_Main/Player1").gameObject; TeamMember memberInfo = CMatchingView.GetMemberInfo(data, 1); CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 2); gameObject = root.transform.Find("Panel_Main/Player2").gameObject; memberInfo = CMatchingView.GetMemberInfo(data, 2); CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 4); gameObject = root.transform.Find("Panel_Main/Player3").gameObject; memberInfo = CMatchingView.GetMemberInfo(data, 3); CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 6); gameObject = root.transform.Find("Panel_Main/Player4").gameObject; memberInfo = CMatchingView.GetMemberInfo(data, 4); CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 8); gameObject = root.transform.Find("Panel_Main/Player5").gameObject; memberInfo = CMatchingView.GetMemberInfo(data, 5); CMatchingView.SetPlayerSlotData(gameObject, memberInfo, bMaxAcntNum >= 10); }
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"); }
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); }
public static void SetMasterPvpDetailWhenGameSettle(COMDT_GAME_INFO gameInfo) { byte num5; byte bGameType = gameInfo.bGameType; byte bMapType = gameInfo.bMapType; uint iLevelID = (uint)gameInfo.iLevelID; byte bMaxAcntNum = 0; CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "masterRoleInfo is null"); if (masterRoleInfo == null) { return; } switch (((COM_GAME_TYPE)bGameType)) { case COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT: Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stVsMachineInfo, gameInfo.bGameResult); return; case COM_GAME_TYPE.COM_SINGLE_GAME_OF_GUIDE: case COM_GAME_TYPE.COM_SINGLE_GAME_OF_ACTIVITY: case COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_ROOM: case COM_GAME_TYPE.COM_SINGLE_GAME_OF_BURNING: case COM_GAME_TYPE.COM_SINGLE_GAME_OF_ARENA: return; case COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER: Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stLadderInfo, gameInfo.bGameResult); Singleton <CRoleInfoManager> .instance.CalculateKDA(gameInfo); return; case COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH: case COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH: if (gameInfo.bIsPKAI != 2) { switch (bMapType) { case 1: case 4: { ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(iLevelID); DebugHelper.Assert(dataByKey != null, "ResAcntBattleLevelInfo is null"); if (dataByKey == null) { return; } bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum; goto Label_0192; } case 3: { ResRankLevelInfo info3 = GameDataMgr.rankLevelDatabin.GetDataByKey(iLevelID); DebugHelper.Assert(info3 != null, "ResRankLevelInfo is null"); if (info3 == null) { return; } bMaxAcntNum = info3.stLevelCommonInfo.bMaxAcntNum; goto Label_0192; } case 5: { ResRewardMatchLevelInfo info4 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(iLevelID); DebugHelper.Assert(info4 != null, "ResRankLevelInfo is null"); if (info4 == null) { return; } bMaxAcntNum = info4.stLevelCommonInfo.bMaxAcntNum; goto Label_0192; } } break; } Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stVsMachineInfo, gameInfo.bGameResult); return; case COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT: if (gameInfo.bIsPKAI == 1) { Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stEntertainmentInfo, gameInfo.bGameResult); Singleton <CRoleInfoManager> .instance.CalculateKDA(gameInfo); } return; default: return; } Label_0192: num5 = bMaxAcntNum; switch (num5) { case 2: Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stOneVsOneInfo, gameInfo.bGameResult); break; case 4: Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stTwoVsTwoInfo, gameInfo.bGameResult); break; case 6: Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stThreeVsThreeInfo, gameInfo.bGameResult); break; default: if (num5 == 10) { Singleton <CRoleInfoManager> .instance.CalculateWins(masterRoleInfo.pvpDetail.stFiveVsFiveInfo, gameInfo.bGameResult); } break; } Singleton <CRoleInfoManager> .instance.CalculateKDA(gameInfo); }
public static void UpdateBtnStatus(GameObject root, Assets.Scripts.GameSystem.RoomInfo data) { uint dwMapId = data.roomAttrib.dwMapId; ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(dwMapId); DebugHelper.Assert(dataByKey != null); int bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum; bool isSelfRoomOwner = Singleton <CRoomSystem> .GetInstance().IsSelfRoomOwner; GameObject gameObject = root.transform.Find("Panel_Main/bg1/LeftRobot").gameObject; GameObject obj3 = root.transform.Find("Panel_Main/bg1/LeftJoin").gameObject; GameObject obj4 = root.transform.Find("Panel_Main/bg2/RightRobot").gameObject; GameObject obj5 = root.transform.Find("Panel_Main/bg2/RightJoin").gameObject; gameObject.CustomSetActive(false); obj3.CustomSetActive(false); obj4.CustomSetActive(false); obj5.CustomSetActive(false); CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); if (isSelfRoomOwner) { if (masterRoleInfo != null) { MemberInfo memberInfo = data.GetMemberInfo(masterRoleInfo.playerUllUID); if (memberInfo != null) { COM_PLAYERCAMP camp = (memberInfo.camp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_1 : COM_PLAYERCAMP.COM_PLAYERCAMP_2; if (data.GetFreePos(memberInfo.camp, bMaxAcntNum) >= 0) { if (memberInfo.camp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) { gameObject.CustomSetActive(true); } else { obj4.CustomSetActive(true); } } if (data.GetFreePos(camp, bMaxAcntNum) >= 0) { if (camp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) { gameObject.CustomSetActive(true); obj3.CustomSetActive(true); } else { obj4.CustomSetActive(true); obj5.CustomSetActive(true); } } } } } else if (masterRoleInfo != null) { MemberInfo info4 = data.GetMemberInfo(masterRoleInfo.playerUllUID); if (info4 != null) { COM_PLAYERCAMP com_playercamp2 = (info4.camp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_1 : COM_PLAYERCAMP.COM_PLAYERCAMP_2; if (data.GetFreePos(com_playercamp2, bMaxAcntNum) >= 0) { if (com_playercamp2 == COM_PLAYERCAMP.COM_PLAYERCAMP_1) { obj3.CustomSetActive(true); } else { obj5.CustomSetActive(true); } } } } CUIEventScript component = gameObject.GetComponent <CUIEventScript>(); component.m_onClickEventID = enUIEventID.Room_AddRobot; component.m_onClickEventParams.tag = 1; component = obj3.GetComponent <CUIEventScript>(); component.m_onClickEventID = enUIEventID.Room_ChangePos; component.m_onClickEventParams.tag = 1; component = obj4.GetComponent <CUIEventScript>(); component.m_onClickEventID = enUIEventID.Room_AddRobot; component.m_onClickEventParams.tag = 2; component = obj5.GetComponent <CUIEventScript>(); component.m_onClickEventID = enUIEventID.Room_ChangePos; component.m_onClickEventParams.tag = 2; }
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); }
private static void ReqStartSingleWarmBattle() { bInFakeSelect = false; Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout)); CSPkg msg = NetworkModule.CreateDefaultCSPKG(0x41a); Assets.Scripts.GameSystem.RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; DebugHelper.Assert(roomInfo != null, "RoomInfo Should not be NULL!!!"); if (roomInfo != null) { msg.stPkgData.stStartSingleGameReq.stBattleParam.bGameType = 1; msg.stPkgData.stStartSingleGameReq.stBattleParam.stGameDetail.stGameOfCombat = Singleton <CHeroSelectSystem> .GetInstance().m_stGameOfCombat; msg.stPkgData.stStartSingleGameReq.stBattleList.stBattleList.wHeroCnt = 1; MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo(); DebugHelper.Assert(masterMemberInfo != null, "self Info Should not be NULL!!!"); if (masterMemberInfo != null) { msg.stPkgData.stStartSingleGameReq.stBattleList.stBattleList.BattleHeroList[0] = masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID; } ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey(roomInfo.roomAttrib.dwMapId); DebugHelper.Assert(dataByKey != null); if (dataByKey != null) { ResDT_LevelCommonInfo stLevelCommonInfo = dataByKey.stLevelCommonInfo; COM_PLAYERCAMP camp = COM_PLAYERCAMP.COM_PLAYERCAMP_1; int dwHeroID = 0; for (int i = 0; i < roomInfo.CampMemberList.Length; i++) { ListView <MemberInfo> view = roomInfo.CampMemberList[i]; for (int k = 0; k < view.Count; k++) { if (view[k].ullUid == roomInfo.selfInfo.ullUid) { camp = view[k].camp; dwHeroID = (int)view[k].ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID; break; } } } CSDT_BATTLE_PLAYER_BRIEF stBattlePlayer = msg.stPkgData.stStartSingleGameReq.stBattlePlayer; int index = 0; for (int j = 0; j < 2; j++) { for (int m = 0; m < roomInfo.CampMemberList[j].Count; m++) { MemberInfo info5 = roomInfo.CampMemberList[j][m]; if (info5 != null) { if (info5.RoomMemberType == 2) { stBattlePlayer.astFighter[index].bObjType = 2; stBattlePlayer.astFighter[index].bPosOfCamp = (byte)m; stBattlePlayer.astFighter[index].bObjCamp = (byte)(j + 1); stBattlePlayer.astFighter[index].dwLevel = info5.dwMemberPvpLevel; FakeHeroSelect fakeHeroSelect = GetFakeHeroSelect(info5.ullUid); if (fakeHeroSelect != null) { stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = fakeHeroSelect.selectedHero; stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeHeroSelect.selectedPlayerSkill; stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.wSkinID = (ushort)fakeHeroSelect.selectedSkin; stBattlePlayer.astFighter[index].szName = fakeHeroSelect.FakePlayer.szUserName; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc = new COMDT_PLAYERINFO_OF_NPC(); stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.ullFakeUid = fakeHeroSelect.FakePlayer.ullUid; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakePvpLevel = fakeHeroSelect.FakePlayer.dwAcntPvpLevel; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakeLogicWorldID = fakeHeroSelect.FakePlayer.dwLogicWorldId; } else { SelectHeroForEnemyPlayer(ref stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo, stBattlePlayer.astFighter[index].dwLevel); stBattlePlayer.astFighter[index].szName = info5.WarmNpc.szUserName; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc = new COMDT_PLAYERINFO_OF_NPC(); stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.ullFakeUid = info5.WarmNpc.ullUid; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakePvpLevel = info5.WarmNpc.dwAcntPvpLevel; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakeLogicWorldID = info5.WarmNpc.dwLogicWorldId; } } else if (info5.RoomMemberType == 1) { stBattlePlayer.astFighter[index].bObjType = 1; stBattlePlayer.astFighter[index].bPosOfCamp = (byte)m; stBattlePlayer.astFighter[index].bObjCamp = (byte)camp; for (int n = 0; n < stLevelCommonInfo.bHeroNum; n++) { stBattlePlayer.astFighter[index].astChoiceHero[n].stBaseInfo.stCommonInfo.dwHeroID = (uint)dwHeroID; } } index++; } } } stBattlePlayer.bNum = (byte)index; roomInfo.roomAttrib.bWarmBattle = false; roomInfo.roomAttrib.npcAILevel = 2; Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref msg, true); } } }
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; } } }
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); }