/// <summary> /// Initializes a new instance of the <see cref="LoginHandler"/> class. /// </summary> /// <param name="gameContext">The game context.</param> public LoginHandler(IGameServerContext gameContext) { this.gameContext = gameContext; this.loginAction = new LoginAction(gameContext); this.logoutAction = new LogoutAction(gameContext); this.decryptor = new Xor3Decryptor(0); }
protected override async Task OnInitializedAsyncSafe() { if (Vm.AuthenticationData.AuthenticationStatus == AuthenticationStatus.LoggedIn) { AuthenticationSystem.Controller.Dispatch(LogoutAction.Create()); } }
public static UserModel LogoutReducer(UserModel previousState, LogoutAction action) { var userService = new UserService(App.Store.GetState().UserConnectionString); userService.Logout(action.userId); return(null); }
void sh_DataArrive(object sender, DataArriveEventArgs e) { if (e.Data.GetType() == typeof(LoginAction)) { LoginAction action = e.Data as LoginAction; e.StateObject.OperatorId = action.OperatorId; if (operatorSocketMap.ContainsKey(action.OperatorId)) { try { if (operatorSocketMap[action.OperatorId].Connected) { sh.SendPacket(operatorSocketMap[action.OperatorId], new OperatorForceLogoffEventArgs()); operatorSocketMap[action.OperatorId].Close(); } } catch (Exception ex) { Trace.TraceError("ForceLogoff Operator " + action.OperatorId + "failed : " + ex.Message); } operatorSocketMap[action.OperatorId] = e.StateObject.workSocket; } else { operatorSocketMap.Add(action.OperatorId, e.StateObject.workSocket); } } else if (e.Data.GetType() == typeof(LogoutAction)) { LogoutAction action = e.Data as LogoutAction; if (operatorSocketMap.ContainsKey(action.OperatorId)) { operatorSocketMap[action.OperatorId] = null; } } else if (e.Data.GetType() == typeof(HeartBeatAction)) { HeartBeatAction a = e.Data as HeartBeatAction; Operator op = OperatorService.GetOperatorById(a.OperatorId); if (op != null) { op.HeartBeatTime = DateTime.Now; } } }
public SessionService(AbstractServicePlugin plugin) : base(plugin) { _logoutAction = new LogoutAction(this); ListenerActions.Add(_logoutAction); }