public void CreateBullFightMatch(ulong sessionID, uint roleId, uint npcId) { GameMatch.Config config = new GameMatch.Config(); config.leagueType = GameMatch.LeagueType.eBullFight; config.type = GameMatch.Type.eBullFight; List <uint> sceneIDs = new List <uint>(GameSystem.Instance.SceneConfig.configs.Keys); config.sceneId = sceneIDs[UnityEngine.Random.Range(0, sceneIDs.Count)]; config.MatchTime = new IM.Number(120); config.session_id = sessionID; var member = new GameMatch.Config.TeamMember(); member.id = roleId.ToString(); member.pos = (int)fogs.proto.msg.FightStatus.FS_MAIN; member.team = Team.Side.eHome; member.team_name = MainPlayer.Instance.Name; member.roleInfo = MainPlayer.Instance.GetRole(roleId).m_roleInfo; config.MainRole = member; var enemy = new GameMatch.Config.TeamMember(); enemy.id = npcId.ToString(); enemy.pos = 4; enemy.team = Team.Side.eAway; enemy.roleInfo = null; config.NPCs.Add(enemy); CreateNewMatch(config); }
public void CreateNewQualifyingMatch(ulong sessionID, List <FightRole> fightList, RivalInfo rivalInfo) { GameMatch.Config config = new GameMatch.Config(); config.leagueType = GameMatch.LeagueType.eQualifying; config.type = GameMatch.Type.e3AIOn3AI; List <uint> sceneIDs = new List <uint>(GameSystem.Instance.SceneConfig.configs.Keys); config.sceneId = sceneIDs[UnityEngine.Random.Range(0, sceneIDs.Count)]; config.MatchTime = new IM.Number(120); config.session_id = sessionID; //object obj = LuaScriptMgr.Instance.GetLuaTable("_G")["CurLoadingImage"]; string str = "Texture/LoadShow"; object obj = (object)str; LuaScriptMgr.Instance.GetLuaTable("_G").Set("CurLoadingImage", obj); foreach (FightRole info in fightList) { var member = new GameMatch.Config.TeamMember(); member.id = info.role_id.ToString(); member.pos = (int)info.status; member.team = Team.Side.eHome; member.team_name = MainPlayer.Instance.Name; member.roleInfo = MainPlayer.Instance.GetRole(info.role_id).m_roleInfo; if (info.status == FightStatus.FS_MAIN) { config.MainRole = member; } else { config.NPCs.Add(member); } } int pos = 4; foreach (RoleInfo info in rivalInfo.role_info) { var member = new GameMatch.Config.TeamMember(); member.id = info.id.ToString(); member.pos = pos++; member.team = Team.Side.eAway; member.team_name = rivalInfo.name; member.roleInfo = info; member.isRobot = rivalInfo.player_type == CharacterType.ROBOT ? true : false; if (member.isRobot == false) { member.equipInfo = rivalInfo.equipments; member.squadInfo = rivalInfo.squad; } config.NPCs.Add(member); } CreateNewMatch(config); }
public void CreateMatch(PractiseData practise, ulong session_id) { if (practise.ID == 10001) { GameSystem.Instance.mClient.CreateNewMatch(GlobalConst.DIR_XML_MATCH_GUIDE, session_id, GameMatch.Type.eGuide); return; } GameMatch.Type type = GameMatch.Type.ePractise; GameMatch.Config config = new GameMatch.Config(); config.leagueType = GameMatch.LeagueType.ePractise; config.type = type; config.needPlayPlot = false; config.MatchTime = IM.Number.zero; config.sceneId = uint.Parse(practise.scene); config.extra_info = practise.ID; config.session_id = session_id; if (GameSystem.Instance.PractiseConfig.GetConfig(practise.ID).is_activity == 1) { GameMatch.Config.TeamMember mem = new GameMatch.Config.TeamMember(); List <uint> list = MainPlayer.Instance.GetRoleIDList(); int max = list.Count; int index = UnityEngine.Random.Range(0, max - 1); mem.id = list[index].ToString(); mem.team = Team.Side.eHome; mem.pos = 1; config.MainRole = mem; } else { if (practise.self_id != 0) { GameMatch.Config.TeamMember mem = new GameMatch.Config.TeamMember(); mem.id = practise.self_id.ToString(); mem.team = Team.Side.eHome; mem.pos = 1; config.MainRole = mem; } } if (practise.npc_id != 0) { GameMatch.Config.TeamMember npc = new GameMatch.Config.TeamMember(); npc.id = practise.npc_id.ToString(); npc.team = Team.Side.eAway; npc.pos = 2; config.NPCs.Add(npc); } GameSystem.Instance.mClient.CreateNewMatch(config); }
static int CreateNewMatch(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Client), typeof(GameMatch.Config))) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); GameMatch.Config arg0 = (GameMatch.Config)LuaScriptMgr.GetLuaObject(L, 2); bool o = obj.CreateNewMatch(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Client), typeof(GameMatch.Type))) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); GameMatch.Type arg0 = (GameMatch.Type)LuaScriptMgr.GetLuaObject(L, 2); bool o = obj.CreateNewMatch(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 4) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); string arg0 = LuaScriptMgr.GetLuaString(L, 2); ulong arg1 = (ulong)LuaScriptMgr.GetNumber(L, 3); GameMatch.Type arg2 = (GameMatch.Type)LuaScriptMgr.GetNetObject(L, 4, typeof(GameMatch.Type)); bool o = obj.CreateNewMatch(arg0, arg1, arg2); LuaScriptMgr.Push(L, o); return(1); } else if (count == 7) { Client obj = (Client)LuaScriptMgr.GetNetObjectSelf(L, 1, "Client"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); ulong arg1 = (ulong)LuaScriptMgr.GetNumber(L, 3); bool arg2 = LuaScriptMgr.GetBoolean(L, 4); GameMatch.LeagueType arg3 = (GameMatch.LeagueType)LuaScriptMgr.GetNetObject(L, 5, typeof(GameMatch.LeagueType)); List <uint> arg4 = (List <uint>)LuaScriptMgr.GetNetObject(L, 6, typeof(List <uint>)); List <uint> arg5 = (List <uint>)LuaScriptMgr.GetNetObject(L, 7, typeof(List <uint>)); obj.CreateNewMatch(arg0, arg1, arg2, arg3, arg4, arg5); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: Client.CreateNewMatch"); } return(0); }
public void CreateFreePracticeMatch(uint roleId) { GameMatch.Config config = new GameMatch.Config(); config.type = GameMatch.Type.eFreePractice; config.leagueType = GameMatch.LeagueType.ePractise; config.MainRole = new GameMatch.Config.TeamMember(); config.MainRole.id = roleId.ToString(); config.MainRole.team = Team.Side.eHome; string[] scences = GameSystem.Instance.CommonConfig.GetString("gFreePracticeScene").Split('&'); int index = UnityEngine.Random.Range(0, scences.Length); config.sceneId = uint.Parse(scences[index]); CreateNewMatch(config); //GameSystem.Instance.mClient.CreateNewMatch(GameMatch.Type.eFreePractice); }
static int _CreateGameMatch_Config(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { GameMatch.Config obj = new GameMatch.Config(); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: GameMatch.Config.New"); } return(0); }
public void CreateShootMatch(ulong sessionID, fogs.proto.msg.GameMode gameMode, uint roleId, uint npcId, uint gameModeId, uint mode_type_id) { GameMatch.Config config = new GameMatch.Config(); config.gameModeID = gameModeId; config.leagueType = GameMatch.LeagueType.eShoot; if (gameMode == fogs.proto.msg.GameMode.GM_GrabZone) { config.type = GameMatch.Type.eGrabZone; } else if (gameMode == fogs.proto.msg.GameMode.GM_MassBall) { config.type = GameMatch.Type.eMassBall; } else if (gameMode == fogs.proto.msg.GameMode.GM_GrabPoint) { config.type = GameMatch.Type.eGrabPoint; } List <uint> sceneIDs = new List <uint>(GameSystem.Instance.SceneConfig.configs.Keys); GameMode confGameMode = GameSystem.Instance.GameModeConfig.GetGameMode(gameModeId); config.sceneId = uint.Parse(confGameMode.scene); config.MatchTime = new IM.Number((int)confGameMode.time); config.session_id = sessionID; var member = new GameMatch.Config.TeamMember(); member.id = roleId.ToString(); member.pos = (int)fogs.proto.msg.FightStatus.FS_MAIN; member.team = Team.Side.eHome; member.team_name = MainPlayer.Instance.Name; member.roleInfo = MainPlayer.Instance.GetRole(roleId).m_roleInfo; config.MainRole = member; var enemy = new GameMatch.Config.TeamMember(); enemy.id = npcId.ToString(); enemy.pos = 4; enemy.team = Team.Side.eAway; enemy.mode_type_id = mode_type_id; enemy.roleInfo = null; config.NPCs.Add(enemy); CreateNewMatch(config); }
static int _CreateGameMatch_Practice1V1(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 1) { GameMatch.Config arg0 = (GameMatch.Config)LuaScriptMgr.GetNetObject(L, 1, typeof(GameMatch.Config)); GameMatch_Practice1V1 obj = new GameMatch_Practice1V1(arg0); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: GameMatch_Practice1V1.New"); } return(0); }
public void LoadMatchConfig(ref GameMatch.Config config, GameMatch.Type matchType = GameMatch.Type.eNone) { try { if (matchType == GameMatch.Type.eNone) { config.sceneId = gameMatchData.sceneId; config.NPCs = gameMatchData.npcList; config.MainRole = gameMatchData.mainRole; config.RemotePlayers = gameMatchData.remoteList; config.MatchTime = gameMatchData.matchTime; config.OppoColorMulti = gameMatchData.oppoColorMulti; } else { GameMatchData data = null; gameMatchDatas.TryGetValue(matchType, out data); if (data != null) { config.type = data.type; config.sceneId = data.sceneId; config.NPCs = data.npcList; config.MainRole = data.mainRole; config.RemotePlayers = data.remoteList; config.MatchTime = data.matchTime; config.OppoColorMulti = data.oppoColorMulti; } else { Debug.LogError("Match Config is null!"); } } } catch (Exception exp) { Debug.Log("load match config failed: " + exp.Message); } }
static int get_leagueType(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameMatch.Config obj = (GameMatch.Config)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name leagueType"); } else { LuaDLL.luaL_error(L, "attempt to index leagueType on a nil value"); } } LuaScriptMgr.Push(L, obj.leagueType); return(1); }
static int set_Scene(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameMatch.Config obj = (GameMatch.Config)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name Scene"); } else { LuaDLL.luaL_error(L, "attempt to index Scene on a nil value"); } } obj.Scene = LuaScriptMgr.GetString(L, 3); return(0); }
static int set_OppoColorMulti(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameMatch.Config obj = (GameMatch.Config)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name OppoColorMulti"); } else { LuaDLL.luaL_error(L, "attempt to index OppoColorMulti on a nil value"); } } obj.OppoColorMulti = (IM.Number)LuaScriptMgr.GetNetObject(L, 3, typeof(IM.Number)); return(0); }
static int set_MainRole(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameMatch.Config obj = (GameMatch.Config)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name MainRole"); } else { LuaDLL.luaL_error(L, "attempt to index MainRole on a nil value"); } } obj.MainRole = (GameMatch.Config.TeamMember)LuaScriptMgr.GetNetObject(L, 3, typeof(GameMatch.Config.TeamMember)); return(0); }
static int set_RemotePlayers(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameMatch.Config obj = (GameMatch.Config)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name RemotePlayers"); } else { LuaDLL.luaL_error(L, "attempt to index RemotePlayers on a nil value"); } } obj.RemotePlayers = (List <GameMatch.Config.TeamMember>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <GameMatch.Config.TeamMember>)); return(0); }
static int set_needPlayPlot(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameMatch.Config obj = (GameMatch.Config)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name needPlayPlot"); } else { LuaDLL.luaL_error(L, "attempt to index needPlayPlot on a nil value"); } } obj.needPlayPlot = LuaScriptMgr.GetBoolean(L, 3); return(0); }
static int set_port(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameMatch.Config obj = (GameMatch.Config)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name port"); } else { LuaDLL.luaL_error(L, "attempt to index port on a nil value"); } } obj.port = (int)LuaScriptMgr.GetNumber(L, 3); return(0); }
public void LoadFromMatch(string strSceneId, GameMatch match) { scene_name = strSceneId; GameMatch.Config config = match.m_config; PlayerManager pm = GameSystem.Instance.mClient.mPlayerManager; Player mainPlayer = null; foreach (Player player in pm) { if (player.m_id != uint.Parse(config.MainRole.id)) { continue; } mainPlayer = player; break; } if (mainPlayer == null) { return; } foreach (Player player in mainPlayer.m_team) { my_role_player_list.Add(player); } foreach (Player player in pm) { if (player.m_team == mainPlayer.m_team) { continue; } rival_player_list.Add(player); } }
public static void SetConfig(ref GameMatch.Config config) { int pos = 1; foreach (FightRole role in MainPlayer.Instance.SquadInfo) { Config.TeamMember mem = new Config.TeamMember(); mem.id = role.role_id.ToString(); mem.isRobot = false; mem.pos = pos++; mem.roleInfo = MainPlayer.Instance.GetRole2(role.role_id); mem.team = Team.Side.eHome; mem.team_name = MainPlayer.Instance.Name; if (mem.pos == 1) { config.MainRole = mem; } else { config.NPCs.Insert(mem.pos - 2, mem); } } config.leagueType = LeagueType.ePractise; }
public bool CreateNewMatch(string configName, ulong session_id = 0ul, GameMatch.Type matchType = GameMatch.Type.eNone) { if (mPlayerManager != null) { mPlayerManager.RemoveAllPlayers(); } if (mCurMatch != null) { mCurMatch = null; } GameMatch.Config config = new GameMatch.Config(); GameSystem.Instance.gameMatchConfig.LoadMatchConfig(ref config, GameMatch.Type.eNone); GameSystem.Instance.gameMatchConfig.LoadMatchConfig(ref config, matchType); config.session_id = session_id; if (config.MainRole == null) { config.MainRole = new GameMatch.Config.TeamMember(); config.MainRole.id = (MainPlayer.Instance.CaptainID).ToString(); } GameMatch match = null; switch (config.type) { case GameMatch.Type.e1On1: match = new GameMatch_1ON1(config); break; case GameMatch.Type.eReady: object o = LuaScriptMgr.Instance.GetLuaTable("_G")["TestScene"]; if (o != null) { config.sceneId = (uint)(double)o; } match = new GameMatch_Ready(config); break; case GameMatch.Type.eFreePractice: match = new GameMatch_FreePractice(config); break; case GameMatch.Type.e3On3: match = new GameMatch_3ON3(config); break; case GameMatch.Type.eGuide: GameMatch_Guide.SetConfig(ref config); match = new GameMatch_Guide(config); break; case GameMatch.Type.ePVP_1PLUS: case GameMatch.Type.ePVP_3On3: //match = new GameMatch_PVP(config); match = new GameMatch_PVP(config); break; } if (match == null) { Debug.LogError("Unsupported match type is detected when creating a new match."); return(false); } mCurMatch = match; mCurMatch.Build(); return(true); }
public void CreatePracticeVsMatch(List <uint> roleIds) { GameMatch.Config config = new GameMatch.Config(); config.type = GameMatch.Type.ePracticeVs; config.leagueType = GameMatch.LeagueType.ePracticeLocal; string[] scences = GameSystem.Instance.CommonConfig.GetString("gPracticeVsScene").Split('&'); int index = UnityEngine.Random.Range(0, scences.Length); config.sceneId = uint.Parse(scences[index]); config.MatchTime = new IM.Number(3 * 60); //config.MatchTime = 7; int pos = 1; config.MainRole = new GameMatch.Config.TeamMember(); config.MainRole.id = roleIds[0].ToString(); config.MainRole.pos = pos++; config.MainRole.team = Team.Side.eHome; foreach (uint id in roleIds) { if (id.ToString() != config.MainRole.id) { GameMatch.Config.TeamMember npc = new GameMatch.Config.TeamMember(); npc.id = id.ToString(); npc.pos = pos++; npc.team = Team.Side.eHome; config.NPCs.Add(npc); } } List <uint> rdList = new List <uint>(); foreach (var kv in BaseDataConfig2.roleBaseDatas) { if (kv.Value.display == 1) { rdList.Add(kv.Key); } } List <uint> npcList = new List <uint>(); for (var i = 0; i < 3; i++) { int r = UnityEngine.Random.Range(0, rdList.Count); npcList.Add(rdList[r]); rdList.RemoveAt(r); } foreach (var id in npcList) { GameMatch.Config.TeamMember npc = new GameMatch.Config.TeamMember(); npc.id = id.ToString(); npc.pos = pos++; npc.team = Team.Side.eAway; RoleInfo r = new RoleInfo(); r.id = id; r.acc_id = MainPlayer.Instance.AccountID; RoleBaseData2 rd = GameSystem.Instance.RoleBaseConfigData2.GetConfigData(id); r.star = (uint)rd.init_star; r.level = 1; r.quality = 1; npc.roleInfo = r; config.NPCs.Add(npc); } CreateNewMatch(config); }
public bool CreateNewMatch(GameMatch.Config config) { if (mPlayerManager != null) { mPlayerManager.RemoveAllPlayers(); } if (mCurMatch != null) { mCurMatch = null; } //涂鸦数据 GameMatch.Config.TeamMember mainRole = config.MainRole; if (mainRole != null) { RoleInfo role = MainPlayer.Instance.GetRole2(uint.Parse(mainRole.id)); if (role != null && role.badge_book_id != 0) { BadgeBook book = MainPlayer.Instance.badgeSystemInfo.GetBadgeBookByBookId(role.badge_book_id); mainRole.badgeBook = book; } for (int i = 0; i < config.NPCs.Count; ++i) { GameMatch.Config.TeamMember teamMate = config.NPCs [i]; if (teamMate != null) { RoleInfo roleTeammate = MainPlayer.Instance.GetRole2(uint.Parse(teamMate.id)); if (roleTeammate != null && roleTeammate.badge_book_id != 0) { BadgeBook book = MainPlayer.Instance.badgeSystemInfo.GetBadgeBookByBookId(roleTeammate.badge_book_id); teamMate.badgeBook = book; } } } } GameMatch match = null; switch (config.type) { case GameMatch.Type.ePVP_1PLUS: case GameMatch.Type.ePVP_3On3: match = new GameMatch_PVP(config); break; case GameMatch.Type.e1On1: case GameMatch.Type.eCareer1On1: match = new GameMatch_1ON1(config); break; case GameMatch.Type.ePractise: match = new GameMatch_Practise(config); break; case GameMatch.Type.eReady: match = new GameMatch_Ready(config); break; case GameMatch.Type.eFreePractice: match = new GameMatch_FreePractice(config); break; case GameMatch.Type.ePracticeVs: match = new GameMatch_PracticeVs(config); break; case GameMatch.Type.e3On3: case GameMatch.Type.eCareer3On3: match = new GameMatch_3ON3(config); break; case GameMatch.Type.eAsynPVP3On3: match = new GameMatch_AsynPVP3ON3(config); break; case GameMatch.Type.e3AIOn3AI: match = new GameMatch_3AION3AI(config); break; case GameMatch.Type.eReboundStorm: match = new GameMatch_ReboundStorm(config); break; case GameMatch.Type.eBlockStorm: match = new GameMatch_BlockStorm(config); break; case GameMatch.Type.eUltimate21: match = new GameMatch_Ultimate21(config); break; case GameMatch.Type.eMassBall: match = new GameMatch_MassBall(config); break; case GameMatch.Type.eGrabZone: match = new GameMatch_GrabZone(config); break; case GameMatch.Type.eGrabPoint: match = new GameMatch_GrabPoint(config); break; case GameMatch.Type.eBullFight: match = new GameMatch_BullFight(config); break; case GameMatch.Type.ePractice1V1: match = new GameMatch_Practice1V1(config); break; case GameMatch.Type.eQualifyingNewerAI: match = new GameMatch_QualifyingNewerAI(config); break; case GameMatch.Type.eLadderAI: match = new GameMatch_LadderAI(config); break; } if (match == null) { Debug.LogError("Unsupported match type is detected when creating a new match."); return(false); } mCurMatch = match; mCurMatch.Build(); return(true); }
public void CreateNewMatch(uint gameModeID, ulong sessionID, bool needPlayPlot, GameMatch.LeagueType leagueType, List <uint> teammates = null, List <uint> npcList = null) { GameMode gameMode = GameSystem.Instance.GameModeConfig.GetGameMode(gameModeID); if (teammates.Count < 1 && (gameMode.matchType == GameMatch.Type.e3On3 || gameMode.matchType == GameMatch.Type.eAsynPVP3On3 || gameMode.matchType == GameMatch.Type.ePractice1V1)) { return; } GameMatch.Config config = new GameMatch.Config(); config.leagueType = leagueType; config.type = gameMode.matchType; //config.type = GameMatch.Type.e3AIOn3AI; config.sceneId = uint.Parse(gameMode.scene); config.MatchTime = new IM.Number((int)gameMode.time); config.session_id = sessionID; config.gameModeID = gameModeID; config.needPlayPlot = needPlayPlot; config.level = gameMode.level; int pos = 1; config.MainRole = new GameMatch.Config.TeamMember(); config.MainRole.id = teammates[0].ToString(); config.MainRole.pos = pos++; config.MainRole.team = Team.Side.eHome; if (teammates != null) { foreach (uint id in teammates) { if (id.ToString() != config.MainRole.id) { GameMatch.Config.TeamMember mem_npc = new GameMatch.Config.TeamMember(); mem_npc.id = id.ToString(); mem_npc.pos = pos++; mem_npc.team = Team.Side.eHome; config.NPCs.Add(mem_npc); } } } List <uint> npcs = new List <uint>(); if (npcList != null) { npcs = npcList; } else { if (gameMode.mappedNPC.ContainsKey(MainPlayer.Instance.Captain.m_position)) { npcs.Add(gameMode.mappedNPC[MainPlayer.Instance.Captain.m_position]); } foreach (List <uint> candidates in gameMode.unmappedNPC) { if (candidates != null && candidates.Count > 0) { uint id = 0; do { id = candidates[UnityEngine.Random.Range(0, candidates.Count - 1)]; } while (npcs.Contains(id)); npcs.Add(id); } } } foreach (uint ID in npcs) { GameMatch.Config.TeamMember mem_npc = new GameMatch.Config.TeamMember(); mem_npc.id = ID.ToString(); mem_npc.pos = pos++; mem_npc.team = Team.Side.eAway; config.NPCs.Add(mem_npc); } CreateNewMatch(config); }