// ------------------------------------------------------------------------------- // RequestRegisterUser // ------------------------------------------------------------------------------- public override bool RequestRegisterUser(NetworkConnection conn, string name, string password) { if (!base.RequestRegisterUser(conn, name, password)) { return(false); } UserRegisterRequestMessage message = new UserRegisterRequestMessage { username = name, password = GenerateHash(name, password) }; conn.Send(message); return(true); }
// ------------------------------------------------------------------------------- // OnUserRegisterRequestMessage // @Client -> @Server // ------------------------------------------------------------------------------- void OnUserRegisterRequestMessage(NetworkConnection conn, UserRegisterRequestMessage msg) { ServerResponseMessage message = new ServerResponseMessage { code = successCode, text = "", causesDisconnect = true }; if (DatabaseManager.singleton.TryUserRegister(msg.username, msg.password)) { DatabaseManager.singleton.SaveDataUser(msg.username, false); eventListener.onUserRegister.Invoke(msg.username); message.text = systemText.userRegisterSuccess; } else { message.text = systemText.userRegisterFailure; message.code = errorCode; } conn.Send(message); }