public override void Open(string bindip, ushort port, bool lan) { if (bindip == "*") { bindip = "0.0.0.0"; } if (IsHosting) { return; } var ip = SteamworksCommon.GetUInt32FromIp(bindip); EServerMode mode = EServerMode.eServerModeAuthenticationAndSecure; //if(lan) mode = EServerMode.eServerModeNoAuthentication; if (!GameServer.Init(ip, (ushort)(port + 2), port, (ushort)(port + 1), mode, GameInfo.VERSION)) { throw new ServerInitializationFailedException("Couldn't start server (Steamworks API initialization failed)"); } SteamGameServer.SetDedicatedServer(!lan); SteamGameServer.SetGameDescription(GameInfo.NAME); SteamGameServer.SetProduct(GameInfo.NAME); SteamGameServer.SetModDir(GameInfo.NAME); SteamGameServer.SetServerName(Description); SteamGameServer.LogOnAnonymous(); SteamGameServer.SetPasswordProtected(false); //Todo SteamGameServer.EnableHeartbeats(true); Application.targetFrameRate = 60; IsHosting = true; }
private void ServerConnectedCallback(SteamServersConnected_t callback) { Debug.Log("[Steamworks.NET] GameServer connected successfully"); SteamGameServer.SetServerName(ServerConfig.ServerName); SteamGameServer.SetPasswordProtected(!string.IsNullOrEmpty(ServerConfig.Password)); SteamGameServer.SetMaxPlayerCount(ServerConfig.TeamNum * ServerConfig.NumPerTeam); SteamGameServer.SetMapName(ServerConfig.MapName); SteamGameServer.SetDedicatedServer(true); SetAdditionalGameInfo(); SteamGameServer.EnableHeartbeats(true); }
private void Start() { if (!SteamDSConfig.isDedicatedServer && !SteamManager.Initialized) { SteamManager.Reset(); } SteamDSConfig.MapName = GameSetup.Difficulty.ToString(); SteamDSConfig.manager.SetStart(this.loadAsync); bool flag = GameServer.Init(0u, SteamDSConfig.ServerSteamPort, SteamDSConfig.ServerGamePort, SteamDSConfig.ServerQueryPort, SteamDSConfig.ServerAuthMode, SteamDSConfig.ServerVersion); if (flag) { Debug.Log("GameServer init success. Port: " + SteamDSConfig.ServerGamePort); if (CoopDedicatedServerStarter.< > f__mg$cache0 == null) { CoopDedicatedServerStarter.< > f__mg$cache0 = new SteamAPIWarningMessageHook_t(CoopDedicatedServerStarter.SteamAPIDebugTextHook); } SteamGameServerUtils.SetWarningMessageHook(CoopDedicatedServerStarter.< > f__mg$cache0); SteamGameServer.SetModDir("theforestDS"); SteamGameServer.SetProduct(SteamDSConfig.ProductName); SteamGameServer.SetGameDescription(SteamDSConfig.ProductDescription); SteamGameServer.SetServerName(SteamDSConfig.ServerName); SteamGameServer.SetDedicatedServer(true); if (string.IsNullOrEmpty(SteamDSConfig.ServerSteamAccount)) { Debug.Log("Set a LogOnAnonymous"); SteamGameServer.LogOnAnonymous(); } else { Debug.Log("Set a Logon"); SteamGameServer.LogOn(SteamDSConfig.ServerSteamAccount); } SteamGameServer.EnableHeartbeats(true); SteamDSConfig.initialized = true; } else { Debug.LogError("GameServer.InitSafe failed"); CoopDedicatedServerStarter.ShutDown(); } }
// Token: 0x06001834 RID: 6196 RVA: 0x00088FEC File Offset: 0x000873EC public void open(uint ip, ushort port, ESecurityMode security) { if (this.isHosting) { return; } EServerMode eServerMode = EServerMode.eServerModeInvalid; if (security != ESecurityMode.LAN) { if (security != ESecurityMode.SECURE) { if (security == ESecurityMode.INSECURE) { eServerMode = EServerMode.eServerModeAuthentication; } } else { eServerMode = EServerMode.eServerModeAuthenticationAndSecure; } } else { eServerMode = EServerMode.eServerModeNoAuthentication; } if (!GameServer.Init(ip, port + 2, port, port + 1, eServerMode, "1.0.0.0")) { throw new Exception("GameServer API initialization failed!"); } SteamGameServer.SetDedicatedServer(this.appInfo.isDedicated); SteamGameServer.SetGameDescription(this.appInfo.name); SteamGameServer.SetProduct(this.appInfo.name); SteamGameServer.SetModDir(this.appInfo.name); SteamGameServer.LogOnAnonymous(); SteamGameServer.EnableHeartbeats(true); this.isHosting = true; }