public override uint LoginLogic(Login2Server msg, Session session, out SimpleNetManager.Player player) { URCSettingData config = URCSettingData.GetCofig(); string key = msg.key; string pw = msg.password; if (config.loginKey.Equals(key) && config.loginPassword.Equals(pw)) { player = new SimpleNetManager.Player(session); player.playerID = Guid.NewGuid().ToString(); return(0); } player = null; return(102); }
public static bool ConsoleStart() { Init(); if (isStart) { return(false); } RemoteDeviceInfo deviceInfo = RemoteDeviceInfo.GetLocalDeviceInfo(); deviceInfo.otherData.Add("ServerVersion", ServerVersionInfo.Version); deviceInfo.otherData.Add("MinClientVersion", ServerVersionInfo.MinClientVersion); URCSettingData config = URCSettingData.GetCofig(); try { string deviceInfoStr = SimpleJsonUtils.ToJson(deviceInfo); NetServer.Start(config.netPort); NetServer.DiscoverServer.Start(config.netPort, deviceInfoStr); LoginService loginService = NetServer.ServiceManager.Get <LoginService>(); loginService.SetPlayerLoginHandler(new SimplePlayerLoginHandler()); //LogService logService = NetServer.ServiceManager.Get<LogService>(); //logService.logSwitchForceControl = logSwitchForceControl; } catch (Exception e) { Debug.LogError(e); return(false); } Debug.Log("URC NetServer.port:" + config.netPort); isStart = true; return(true); }