public static bool ConsoleToolStart() { if (isStart) { return(false); } RemoteDeviceInfo deviceInfo = RemoteDeviceInfo.GetLocalDeviceInfo(); GameConsolePanelSettingConfig config = GameConsolePanelSettingConfig.GetCofig(); try { string deviceInfoStr = SimpleJsonUtils.ToJson(deviceInfo); LitNetServer.SetNetworkServerManager(deviceInfoStr, config.netPort); LitNetServer.Start(); LoginService loginService = LitNetServer.ServiceManager.Get <LoginService>(); loginService.SetPlayerLoginHandler(new SimplePlayerLoginHandler()); } catch (Exception e) { Debug.LogError(e); return(false); } Debug.Log("LitNetServer.port:" + config.netPort); isStart = true; return(true); }
public static void Init() { GameConsolePanelSettingConfig config = GameConsolePanelSettingConfig.GetCofig(); if (config.autoBoot) { ConsoleToolStart(); } else { Debug.Log("ConsoleBootManager.init"); int state = PlayerPrefs.GetInt(PF_WhenFirstCustomBootThenAutoBoot, 0); if (state == 1) { ConsoleToolStart(); return; } ConsoleBootManager.Init(config, () => { if (config.whenFirstCustomBootThenAutoBoot) { PlayerPrefs.SetInt(PF_WhenFirstCustomBootThenAutoBoot, 1); } ConsoleToolStart(); }); } }
public override uint LoginLogic(Login2Server msg, long connectId, out LiteNetLibManager.Player player) { GameConsolePanelSettingConfig config = GameConsolePanelSettingConfig.GetCofig(); string key = msg.key; string pw = msg.password; if (config.loginKey.Equals(key) && config.loginPassword.Equals(pw)) { player = new LiteNetLibManager.Player(connectId); player.playerID = Guid.NewGuid().ToString(); return(0); } player = null; return(102); }