void CreateCustomServer() { Pathea.CustomGameData.Mgr.Instance.curGameData = Pathea.CustomGameData.Mgr.Instance.GetCustomData(UID); if (null == Pathea.CustomGameData.Mgr.Instance.curGameData) { return; } string serverName = mServerName.text; if (LoadServer.Exist(serverName)) { return; } Pathea.PeGameMgr.gameName = Pathea.CustomGameData.Mgr.Instance.curGameData.name; Pathea.PeGameMgr.monsterYes = mMonsterYes; Pathea.PeGameMgr.loadArchive = Pathea.ArchiveMgr.ESave.New; MyServer ms = new MyServer(); ms.gameName = serverName; ms.gamePassword = mPassword.text; ms.gameMode = (int)Pathea.PeGameMgr.sceneMode; ms.masterRoleName = GameClientLobby.role.name; ms.mapName = Pathea.PeGameMgr.gameName; ms.seedStr = mSeed.text; ms.uid = UID; ms.unlimitedRes = mInfiniteResoureces.isChecked; ms.proxyServer = mProxyServer.isChecked; ms.isPrivate = mPrivateServer.isChecked; ms.useSkillTree = RandomMapConfig.useSkillTree = mSkillTreeSystem.isChecked; ms.scriptsAvailable = mAllScriptsAvailable.isChecked; MyServerManager.StartCustomServer(ms); }
void OnCreateHostBtn() { if (string.IsNullOrEmpty(mServerName.text)) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000059)); return; } if (Pathea.PeGameMgr.sceneMode == Pathea.PeGameMgr.ESceneMode.Custom) { if (!mMultiCustomCtrl.HasSelectMap())//没选中地图 { return; } if (LoadServer.Exist(mServerName.text)) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000485)); return; } mMultiCustomCtrl.OnWndStartClick();//检测地图完整性 StartCoroutine(WhetherMapCheckHasFinished()); return; } if (Input.GetMouseButtonUp(0) && mMapList.Count > 0) { string serverName = mServerName.text; //int serverport = uLink.NetworkUtility.FindAvailablePort(9900, 9915); string password = mPassword.text; string mapName = mMapName.text; bool publicServer = !mPrivateServer.isChecked; switch (mBiomePop.selection) { case "Grassland": RandomMapConfig.RandomMapID = RandomMapType.GrassLand; RandomMapConfig.vegetationId = RandomMapType.GrassLand; break; case "Forest": RandomMapConfig.RandomMapID = RandomMapType.Forest; RandomMapConfig.vegetationId = RandomMapType.Forest; break; case "Desert": RandomMapConfig.RandomMapID = RandomMapType.Desert; RandomMapConfig.vegetationId = RandomMapType.Desert; break; case "Redstone": RandomMapConfig.RandomMapID = RandomMapType.Redstone; RandomMapConfig.vegetationId = RandomMapType.Redstone; break; case "Rainforest": RandomMapConfig.RandomMapID = RandomMapType.Rainforest; RandomMapConfig.vegetationId = RandomMapType.Rainforest; break; case "Mountain": RandomMapConfig.RandomMapID = RandomMapType.Mountain; RandomMapConfig.vegetationId = RandomMapType.Mountain; break; case "Swamp": RandomMapConfig.RandomMapID = RandomMapType.Swamp; RandomMapConfig.vegetationId = RandomMapType.Swamp; break; case "Crater": RandomMapConfig.RandomMapID = RandomMapType.Crater; RandomMapConfig.vegetationId = RandomMapType.Crater; break; default: RandomMapConfig.RandomMapID = RandomMapType.GrassLand; RandomMapConfig.vegetationId = RandomMapType.GrassLand; break; } switch (mWeatherPop.selection) { case "Dry": RandomMapConfig.ScenceClimate = ClimateType.CT_Dry; break; case "Temperate": RandomMapConfig.ScenceClimate = ClimateType.CT_Temperate; break; case "Wet": RandomMapConfig.ScenceClimate = ClimateType.CT_Wet; break; case "Random": RandomMapConfig.ScenceClimate = ClimateType.CT_Random; break; } Pathea.PeGameMgr.monsterYes = mMonsterYes; string seedStr = mSeed.text; serverName = serverName.Trim(); if (string.IsNullOrEmpty(serverName)) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000060)); return; } if (serverName.Length < 4 || serverName.Length > 19) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000486)); return; } if (LoadServer.Exist(serverName)) { MessageBox_N.ShowOkBox(PELocalization.GetString(8000485)); return; } bool IsInfiniteResoureces = mInfiniteResoureces.isChecked; bool useProxy = mProxyServer.isChecked; bool useSkillTree = mSkillTreeSystem.isChecked; bool scriptsAvailable = mAllScriptsAvailable.isChecked; RandomMapConfig.useSkillTree = useSkillTree; MyServer ms = new MyServer(); ms.gameName = serverName; ms.gamePassword = password; ms.mapName = mapName; ms.gameMode = (int)Pathea.PeGameMgr.sceneMode; ms.gameType = (int)Pathea.PeGameMgr.gameType; ms.seedStr = seedStr; ms.teamNum = teamNum; ms.numPerTeam = playerNum; ms.dropDeadPercent = Convert.ToInt32(mDropRateSelections[mDropRateIndex]); ms.terrainType = (int)RandomMapConfig.RandomMapID; ms.vegetationId = (int)RandomMapConfig.vegetationId; ms.sceneClimate = (int)RandomMapConfig.ScenceClimate; ms.monsterYes = Pathea.PeGameMgr.monsterYes; ms.unlimitedRes = IsInfiniteResoureces; ms.terrainHeight = mTerrainHeight; ms.mapSize = mMapSize; ms.riverDensity = mRiverDensity; ms.riverWidth = mRiverWidth; //a0.95 ms.plainHeight = plainHeight; ms.flatness = flatness; ms.bridgeMaxHeight = bridgeMaxHeight; //b0.72 ms.allyCount = mAllyCount; ms.scriptsAvailable = scriptsAvailable; ms.proxyServer = useProxy; ms.isPrivate = !publicServer; ms.masterRoleName = GameClientLobby.role.name; ms.useSkillTree = useSkillTree; ms.uid = ""; //ms.dropDeadPercent = drop MyServerManager.CreateNewServer(ms); } }