public ConnectionRequest(Guid clientId, ClientStatus initialStatus, string username, IActorRef clientsActor) { ClientId = clientId; InitialStatus = initialStatus; Username = username; ClientsHandler = clientsActor; }
public SetStatusPacketOut(ClientStatus opt, byte status) { ID = ClientToServerPacket.SET_STATUS; Data = new byte[2]; Data[0] = (byte)opt; Data[1] = status; }
/* Constructor with instant initialisation of ServerEndPoint */ public TCPClient(String _server_IPv4Address, Int16 _server_Port) { this.status = ClientStatus.stopped; encoder = new ASCIIEncoding(); this.server_IPAdresse = IPAddress.Parse(_server_IPv4Address); this.server_Port = _server_Port; }
public HeartbeatActor() { Receive<BeginHeartbeat>(msg => HandleBeginHeartbeat(msg)); Receive<SendHeartbeat>(msg => HandleSendHeartbeat()); Receive<ChangeStatus>(msg => _status = msg.NewStatus); Receive<ConnectionMessages.Disconnect>(msg => HandleDisconnect(msg)); Receive<ConnectionMessages.HeartbeatAcknowledged>(msg => HandleAck(msg)); }
public TgcSocketClientInfo(Socket clientSocket) { this.socket = clientSocket; this.status = ClientStatus.HandshakePending; //IP Address IPEndPoint endPoint = (IPEndPoint)clientSocket.RemoteEndPoint; this.address = endPoint.Address; }
public override int TryReadPacket(byte[] Buffer, int Length) { int offset = 1; byte status = 0; if (!TryReadByte(Buffer, ref offset, out status)) return -1; ClientStatus = (ClientStatus)status; return offset; }
public override int TryReadPacket(byte[] buffer, int length) { int offset = 1; byte status = 0; if (!DataUtility.TryReadByte(buffer, ref offset, out status)) return -1; ClientStatus = (ClientStatus)status; return offset; }
public SetStatusPacketOut(PlayerEntity player, ClientStatus opt, byte status) { UsageType = NetUsageType.PLAYERS; ID = ServerToClientPacket.SET_STATUS; Data = new byte[8 + 1 + 1]; Utilities.LongToBytes(player.EID).CopyTo(Data, 0); Data[8] = (byte)opt; Data[8 + 1] = status; }
private void HandleHeartbeat(ConnectionMessages.Heartbeat msg) { if (msg.Status != _status) { _status = msg.Status; Context.Parent.Tell(new ClientsActor.ClientStatusChanged(_clientId, _status)); } Sender.Tell(new ConnectionMessages.HeartbeatAcknowledged()); }
public void SetProcess(Process pro, ClientStatus prostatus) { Process = pro; Process.EnableRaisingEvents = true; Process.Exited += OnClientClose; status = status | prostatus; if (prostatus == ClientStatus.None || prostatus == ClientStatus.Closed) { status = ClientStatus.None; } }
private static void OnStatusChanged(ClientStatus status) { try { hubConnection.InvokeAsync("StatusChanged", status); } catch (Exception) { Console.WriteLine("HUB: Message send failure."); } }
protected void NotifyStatusChanged(ClientStatus newStatus) { if (_status != newStatus) { _status = newStatus; ClientStatusChanged?.Invoke(this, new PipeClientStatusChangedEventArgs() { Status = _status }); } }
/* Constructor default*/ public TCPClient() { this.status = new ClientStatus(); this.status = ClientStatus.stopped; encoder = new ASCIIEncoding(); // Timeouts this.StreamReadTimeout = 4000; this.ReceiveTimeout = 4000; }
private static void ClientOnClientStatusChanged(object sender, ClientStatus e) { if (e == ClientStatus.Playing && Client.Status == ClientStatus.Matchmaking) { BS_Utils.Gameplay.ScoreSubmission.ProlongedDisableSubmission("Beat Saber 99"); } else if (e == ClientStatus.Waiting && Client.Status == ClientStatus.Playing) { BS_Utils.Gameplay.ScoreSubmission.RemoveProlongedDisable("Beat Saber 99"); } }
internal void Delete() { AddNotifications( new ValidationContract() .AreNotEquals(Status, ClientStatus.Delete, "Status", "This client is already delete") ); Deleted = DateTime.Now; Updated = Created; Status = ClientStatus.Delete; }
protected virtual void OnClientClose(object sender, EventArgs e) { Process pro = sender as Process; Status = ClientStatus.Closed; if (Account.Settings.RelaunchesLeft > 0) { Account.Settings.RelaunchesLeft--; Launch(); } }
private void HandleWaitingOponentMessage(String address, AbstractMessage message) { clientStatus = ClientStatus.WaitingCharacterSelection; controller.SupressUpdate(); ScreenManager.GetInstance().RemoveLastScreen(); ScreenManager.GetInstance().AddScreen(new WaitingPlayerScreen()); controller.ReleaseUpdate(); }
public void SetClientStatus(ClientStatus cs) { if (this.client_status_label.InvokeRequired) { this.client_status_label.BeginInvoke((MethodInvoker) delegate() { this.client_status_label.Text = cs.ToString(); }); } else { this.client_status_label.Text = cs.ToString(); } }
private void HandleBeginHeartbeat(BeginHeartbeat msg) { _status = msg.Status; _target = msg.HeartbeatTarget; _cancelHeartbeat = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable( TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), Self, new SendHeartbeat(), Self); }
/// <summary> /// Handles the error. /// </summary> private T HandleError <T>(ClientStatus status, string msg) { switch (status) { case ClientStatus.CacheDoesNotExist: throw new IgniteClientException("Cache doesn't exist: " + Name, null, (int)status); default: throw new IgniteClientException(msg, null, (int)status); } }
public void SetupClient() { client = new NetworkClient(); client.RegisterHandler(MsgType.Connect, OnConnected); client.RegisterHandler(VirtualHausMessageTypes.APPARTMENT_LOADING, LoadAppartment); client.RegisterHandler(VirtualHausMessageTypes.FURNITURE_LOADING, LoadFurnitures); client.RegisterHandler(VirtualHausMessageTypes.USER_POSITION, UpdateUserPosition); client.Connect(NETWORK_IP_ADDRESS, NETWORK_PORT); status = ClientStatus.CONNECTING; }
public Client(string firstname, string lastname, string businessName, string invoicePrefix, string address, string email, string primaryPhone) { FirstName = firstname; LastName = lastname; BusinessName = businessName; InvoicePrefix = invoicePrefix; Address = address; Email = email; PrimaryPhone = primaryPhone; _state = new EnabledState(); _status = ClientStatus.Enabled; }
void Update() { if (Status == ClientStatus.Entered && NotMoving()) { LookForFreeTable(); } if (Status == ClientStatus.Approaching && NotMoving()) { Sit(); } if (Status == ClientStatus.Waiting) { waitingTime += PlayTimer.Instance.TimePerFrame(); if (occupiedTable.Hookah != null) { smokedHookah = occupiedTable.Hookah; Status = ClientStatus.Smoking; smokedHookah.SetActive(); prefsSatisfied = PrefsSatisfied(); DisplayText(prefsSatisfied ? onHookahBrought[0] : onHookahBrought[1], 3f); } } if (Status == ClientStatus.Smoking) { if (smokedHookah.Active) { // TODO: Add smoking animation there } else { Status = ClientStatus.Leaving; agent.SetDestination(player.entry.position); } } if (Status == ClientStatus.Leaving && NotMoving()) { player.RemoveClient(this); if (waitingTime > 0f) { CommentOnLounge(); player.Money += smokedHookah.ContainedTobacco.brand.price; } Leave(); } // NOTE: Updating chat bubble so that it does not rotate with a parent object bubble.transform.localRotation = Quaternion.Euler(0, bubble.initialRotation + -transform.localRotation.eulerAngles.y, 0); }
//----------------[ Constructor ]-----------------------// public TCPClient(string host, int port, bool autoConnect = true) { interLocker = new object(); dnsEndpoint = new DnsEndPoint(host, port); ConnectTimeout = 0; QuestTimeout = 0; AutoConnect = autoConnect; status = ClientStatus.Closed; syncConnectingEvent = new ManualResetEvent(false); errorRecorder = ClientEngine.errorRecorder; }
public void LoadAppartment(NetworkMessage netMsg) { AppartmentLoadingMessage msg = netMsg.ReadMessage <AppartmentLoadingMessage>(); GameObject appartment = Instantiate(Resources.Load <GameObject>("Appartments/" + msg.modelName + "/" + msg.modelName)); appartment.transform.position = msg.appartmentPosition; appartment.transform.localScale = msg.appartmentScale; client.Send(VirtualHausMessageTypes.APPARTMENT_LOADED, new EmptyMessage()); status = ClientStatus.APPARTMENT_LOADED; }
protected virtual void Awake() { //ReconnectTimes = GameConfig.ins.MaxConnectTimes == 0 ? 20 : GameConfig.ins.MaxConnectTimes; status = ClientStatus.None; eventDispatcher = new EventDispatch(); socket = gameObject.AddComponent <JsonSocket>(); socket.init(); socket.OnReceive = OnReceiveHandler; socket.eventDispatcher.addEventListener(SocketEvent.ERROR, onConnectedError); socket.eventDispatcher.addEventListener(SocketEvent.DISCONNECTED, onDisconnect); }
private int OnReceive() { byte[] sizeInfo = new byte[4]; byte[] receivedBuffer = new byte[1024]; int totalRead = 0, currentRead = 0; try { //Receiving package info currentRead = totalRead = socket.Receive(sizeInfo); if (totalRead <= 0) { Debug.Log("You are not connected to the server."); Status = ClientStatus.NotConnected; return(0); } else { while (totalRead < sizeInfo.Length && currentRead > 0) { currentRead = socket.Receive(sizeInfo, totalRead, sizeInfo.Length - totalRead, SocketFlags.None); totalRead += currentRead; } int messagesSize = 0; messagesSize |= sizeInfo[0]; messagesSize |= (sizeInfo[1] << 8); messagesSize |= (sizeInfo[2] << 8 * 2); messagesSize |= (sizeInfo[3] << 8 * 3); //Receiving package data byte[] data = new byte[messagesSize]; totalRead = 0; currentRead = totalRead = socket.Receive(data, totalRead, data.Length - totalRead, SocketFlags.None); while (totalRead < messagesSize && currentRead > 0) { currentRead = totalRead = socket.Receive(data, totalRead, data.Length - totalRead, SocketFlags.None); totalRead += currentRead; } HandleNetworkInformation(data); } } catch { Debug.Log("You are not connected to the server!"); Status = ClientStatus.NotConnected; return(0); } return(1); }
private void HandleCharacterSelectionMessage(String address, AbstractMessage message) { CharacterSelectionMessage characterSelectionMessage = (CharacterSelectionMessage)message; clientStatus = ClientStatus.CharacterSelection; controller.SupressUpdate(); ScreenManager.GetInstance().RemoveLastScreen(); ScreenManager.GetInstance().AddScreen(new CharacterSelectionScreen()); controller.ReleaseUpdate(); }
public StatusEventResponse(string account, string nickName, ClientStatus status, NetworkId networkId, ClientCapabilities capabilities, string objectDescriptor) : base(0, PackageType.StatusEvent) { account.NotEmpty(); nickName.NotEmpty(); this.Account = account; this.NickName = nickName; this.Status = status; this.NetworkId = networkId; this.Capabilities = capabilities; this.ObjectDescriptor = objectDescriptor; }
/// <summary> /// Converts string to the appropriate status /// </summary> /// <param name="s">THe string for conversion</param> /// <returns>The appropriate Client Status (returns Active by default if no match)</returns> public static ClientStatus ParseClientStatus(string s) { s = s.Replace(" ", string.Empty); try { ClientStatus clientStatus = (ClientStatus)Enum.Parse(typeof(ClientStatus), s, true); return(clientStatus); } catch (Exception) { return(ClientStatus.Active); } }
public IEnumerator StartServer(string configPath, string version = "0.01") { CleanupClient(); string configStr = ReadFile(configPath); AsyncIO.ForceDotNet.Force(); status = ClientStatus.QuerySent; client = new RequestSocket(); client.Connect($"{this.server_address}:{this.server_port}"); SetupMessage setupMessage = new SetupMessage(configStr: configStr); yield return(StartCoroutine(this.SendRequest(JsonConvert.SerializeObject(new VersionedRequest(setupMessage, RequestType.setup, version))))); }
public ClientReference(Socket _socket, string _name = "", int _seq = -1) { lastHeartBeatTime = float.MaxValue; socket = _socket; name = _name; seq = _seq; clientStatus = ClientStatus.Invalid; status = BrickManDesc.STATUS.PLAYER_WAITING; data = new DummyData(); ip = socket.RemoteEndPoint.ToString().Split(':')[0]; isLoaded = false; isHost = ServerEmulator.instance.clientList.Count == 0; }
void SetStatus(ClientStatus newStatus) { ClientStatus oldStatus = status; if (newStatus != oldStatus) { status = newStatus; if (onStatusChanged != null) { onStatusChanged(oldStatus, newStatus); } } }
public void SendClientReady() { Debug.Log(Status); if (Status == ClientStatus.NotReady) { PacketBuffer buffer = new PacketBuffer(); buffer.WriteInt32((int)ClientPackets.CReadySignal); SendData(buffer.ToArray()); buffer.Dispose(); Status = ClientStatus.Ready; } }
public Client(LoginNode inter, IMMOCluster cluster) { controller = cluster; log = LogManager.GetLogger("CLIENT "+this.GetHashCode().ToString().Truncate(4)); clientInfo = new ClientInfo() {Id = ClientCache.RandomId()}; status = ClientStatus.NoIdentity; passwordSalt = Path.GetRandomFileName(); heartbeat.Elapsed += (sender, args) => { log.Info("Client timed out, terminating"); DisconnectClient(); }; clientInter = inter; }
private void SetStatusAndNotify(ClientStatus status) { if (status == _clientStatus) { return; } _clientStatus = status; ClientStatusChanged?.Invoke(this, new ClientStatusChangedEventArgs() { ClientID = _clientID, IPEndPoint = (IPEndPoint)_serverEndPoint, Status = _clientStatus }); }
private NetworkClient() { client = new HPSocketCS.TcpPackClient(); client.OnPrepareConnect += new TcpClientEvent.OnPrepareConnectEventHandler(OnPrepareConnect); client.OnConnect += new TcpClientEvent.OnConnectEventHandler(OnConnect); client.OnSend += new TcpClientEvent.OnSendEventHandler(OnSend); client.OnReceive += new TcpClientEvent.OnReceiveEventHandler(OnReceive); client.OnClose += new TcpClientEvent.OnCloseEventHandler(OnClose); client.PackHeaderFlag = this.PackHeaderFlag; client.MaxPackSize = this.MaxPackSize; Status = ClientStatus.Stopped; }
private void AuthFinish(bool authStatus, int errorCode) { AuthStatusInfo currInfo; TCPClient client = null; long connectionId = 0; long currUid; lock (interLocker) { if (status != ClientStatus.Connecting) { return; } if (authStatus) { status = ClientStatus.Connected; authStatsInfo.rtmClients.Remove(rtmGate); } else { status = ClientStatus.Closed; connectionId = rtmGateConnectionId; rtmGateConnectionId = 0; client = rtmGate; rtmGate = null; } currInfo = authStatsInfo; authStatsInfo = null; currUid = uid; syncConnectingEvent.Set(); } if (currInfo != null) { currInfo.authCallback(pid, currUid, authStatus, errorCode); } if (connectionId != 0) { RTMControlCenter.UnregisterSession(connectionId); } if (client != null) { client.Close(); } }
//----------------[ Internal Configure Operations ]-----------------------// private void SetClientStatus(TCPConnection conn, ClientStatus newStatus) { lock (interLocker) { if (connection == conn) { status = newStatus; if (status == ClientStatus.Closed) { connection = null; } } } }
public async Task SetClientStatusAsync(Guid clientId, ClientStatus clientStatus) { using (var conn = await ConnectionHelper.GetOpenConnectionAsync(this.connectionString)) { var command = conn.CreateCommand(); command.CommandText = @"UPDATE [RBR].[Clients] SET [ClientStatus] = @ClientStatus WHERE ClientId = @ClientId"; command.Parameters.Add("@ClientStatus", SqlDbType.TinyInt).Value = clientStatus; command.Parameters.Add("@ClientId", SqlDbType.UniqueIdentifier).Value = clientId; await command.ExecuteNonQueryAsync(); } }
public void Stop() { if (CurrentStatus == ClientStatus.NotConnected) { return; } CurrentStatus = ClientStatus.Disconnecting; EventQueue.RemoveEvent(connectionTimeoutEvent); NetworkHandler.Stop(); MessageHandler.Stop(); ClientsById.Clear(); CurrentStatus = ClientStatus.NotConnected; OnDisconnected?.Invoke(); }
private void Disconnected() { Receive<ConnectRequest>(msg => HandleConnectRequest(msg)); Receive<ConnectionMessages.ConnectionResponse>(msg => HandleConnectionResponse(msg)); Receive<ConnectWithSettings>(msg => HandleConnectWithSettings(msg)); Receive<ReceiveTimeout>(msg => HandleConnectTimeout()); Receive<ChangeStatus>(msg => _status = msg.Status); Context.ActorSelection(ClientActorPaths.ShellViewModelActor.Path) .Tell(new ShellViewModelActor.UpdateConnectionState(false)); _clientsActor.Tell(new ClientTracking.NewClientList(new ConnectedClient[0])); _messagingActor.Tell(new ConnectionLost()); }
public void WorkWithFiles() { DataInFile = null; try { DataInFile = Engine.ReadFile("bla bla bla"); Status = ClientStatus.Ok; } catch (FileNotFoundException) { Status = ClientStatus.FileNotFound; } catch (OutOfMemoryException) { Status = ClientStatus.UnhandledError; throw; } catch (Exception) { Status = ClientStatus.UnhandledError; } }
public ClientStatusResult(ClientStatus kind, string message) : base(string.Empty) { string method; switch (kind) { case ClientStatus.Info: method = "showInfo"; break; case ClientStatus.Warning: method = "showWarning"; break; case ClientStatus.Error: method = "showError"; break; default: throw new NotImplementedException(); } Code = string.Format(@"jQuery.status.{0}(""{1}"")", method, message.Replace("\"", "\\\"")); }
public static SolidColorBrush Convert(ClientStatus status) { switch (status) { case ClientStatus.Available: return new SolidColorBrush(Colors.SeaGreen); case ClientStatus.Away: return new SolidColorBrush(Colors.Orange); case ClientStatus.Busy: return new SolidColorBrush(Colors.DarkRed); case ClientStatus.DoNotDisturb: return new SolidColorBrush(Colors.DarkRed); case ClientStatus.Offline: return new SolidColorBrush(Colors.Gray); default: throw new ArgumentOutOfRangeException(); } }
public ClientStatusPacket(ClientStatus status) { Status = status; }
public ClientData(Guid id, string username, ClientStatus status, IActorRef clientsHandler) { Id = id; Username = username; Status = status; ClientsHandler = clientsHandler; }
public NewClient(Guid id, string username, ClientStatus status, IActorRef clientsHandler, IActorRef messageHandler) { Id = id; Username = username; Status = status; ClientsHandler = clientsHandler; MessageHandler = messageHandler; }
public ClientStatusChanged(Guid client, ClientStatus status) { Client = client; Status = status; }
private void AppearAway() { _oldStatus = _status; _heartbeatActor.Tell(new HeartbeatActor.ChangeStatus(ClientStatus.Away)); }
public bool TownPortal() { BotGameData.Me.PortalId = 0; SwitchSkill(0xDC); CastOnSelf(); int timeoutStep = 100; for (int npc_timeout = 2000; npc_timeout > 0 && BotGameData.Me.PortalId == 0; npc_timeout -= timeoutStep) Thread.Sleep(timeoutStep); if (BotGameData.Me.PortalId == 0) { Console.WriteLine("{0}: [D2GS] Failed to take town portal.", Account); return false; } byte[] temp = {0x02,0x00,0x00,0x00}; SendPacket(0x13, temp, BitConverter.GetBytes(BotGameData.Me.PortalId)); Thread.Sleep(400); Status = ClientStatus.STATUS_IN_TOWN; return true; }
public void ProcessMessage(byte[] message) { if (status == ClientStatus.Disconnected) return; //Reset heartbeat heartbeat.Stop(); heartbeat.Start(); if(status > ClientStatus.NoEncryption && message.Length > 1) { //Decrypt message var decrypt = encryption.Decrypt(message.Skip(1).ToArray()); byte[] finalMessage = new byte[1+decrypt.Length]; decrypt.CopyTo(finalMessage,1); finalMessage[0] = message[0]; message = finalMessage; } var data = message.Skip(1).ToArray(); if(message[0] != (byte)MessageIdentifier.Heartbeat) log.Debug("Received message: "+System.Enum.GetName(typeof(MessageIdentifier), message[0])); switch ((MessageIdentifier)message[0]) { case MessageIdentifier.Heartbeat: clientInter.SendTo(clientInfo, BuildMessage(MessageIdentifier.Heartbeat, null)); break; case MessageIdentifier.SetIdentity: if (status != ClientStatus.NoIdentity) { break; } log.Debug("Setting up encryption with new client..."); status = ClientStatus.NoEncryption; //Begin encryption exchange clientInter.SendTo(clientInfo, BuildMessage(MessageIdentifier.BeginEncryption, null)); break; //Coming from client, this is the encryption md5. case MessageIdentifier.BeginEncryption: if (status != ClientStatus.NoEncryption) { log.Error("Unexpected BeginEncryption from host."); break; } //Get the encryption key MD5. byte[] keymd5 = data; AES encrypt = MmoEncrypt.ByHash(keymd5); if (encrypt == null) { log.Info("Key not valid for client, rejecting and disconnecting."); clientInter.SendTo(clientInfo, BuildMessage(MessageIdentifier.InvalidKey, null)); clientInter.Disconnect(clientInfo); status = ClientStatus.Disconnected; } else { log.Debug("Client accepted, beginning login."); status = ClientStatus.LoggingIn; encryption = encrypt; clientInter.SendTo(clientInfo, BuildMessage(MessageIdentifier.ConfirmEncryption, Encoding.UTF8.GetBytes(passwordSalt))); } break; case MessageIdentifier.LoginVerify: if(status != ClientStatus.LoggingIn) { log.Error("Client tried to log in when not in login state."); break; } LoginRequest request = data.Deserialize<LoginRequest>(); log.Debug("Login request, "+request.Username); User user; ISession session = MmoDatabase.Session; using(var transaction = session.BeginTransaction()) { user = session.CreateCriteria(typeof (User)) .Add(Restrictions.Eq("Username", request.Username)) .UniqueResult<User>(); } LoginResponse response; if(user == null) { response = new LoginResponse() {Success = false, Message = "User does not exist."}; }else { string hashedPassword = StringMD5.CreateMD5Hash(StringMD5.CreateMD5Hash(passwordSalt + user.Password)+passwordSalt); if (request.MD5Pass != hashedPassword) { response = new LoginResponse() { Success = false, Message = "Password is incorrect." }; } else { //check if the user is logged in if(controller.IsUserLoggedIn(user.Username)){ log.Error("User '"+user.Username.Truncate(5)+"' is already logged in, rejecting..."); response = new LoginResponse() { Success = false, Message = "User is already logged in!" }; }else{ //Here we should actually be logged in log.Debug("Client logged in, username: "******"CLIENT "+user.Username.Truncate(4)); thisUser = user; status = ClientStatus.CharacterSelect; response = new LoginResponse() {Success = true}; } } } clientInter.SendTo(clientInfo, BuildMessage(MessageIdentifier.LoginVerify, response.Serialize())); break; case MessageIdentifier.CharacterData: if(status != ClientStatus.CharacterSelect){ log.Error("Client tried to retreive characters while not in character select state."); break; } if(thisUser.Characters.Count == 0) { thisUser.Characters.Add(new Character() {Gender = true, Name = "Test Character"+(new Random().Next(0,100)), User = thisUser, XP = 5000, CurrentRealm = MmoWorld.Realms.First()}); MmoDatabase.Save(thisUser); } CharacterData[] characters = new CharacterData[thisUser.Characters.Count]; int i = 0; foreach(var character in thisUser.Characters) { if (character.CurrentRealm == null) { character.CurrentRealm = MmoWorld.Realms.First(); MmoDatabase.Save(character); } characters[i] = new CharacterData(){Id = character.Id, Name = character.Name, XP = character.XP, Gender=character.Gender, Realm = character.CurrentRealm.Name}; i++; } clientInter.SendTo(clientInfo, BuildMessage(MessageIdentifier.CharacterData, characters.Serialize())); break; case MessageIdentifier.CharacterVerify: if(status != ClientStatus.CharacterSelect){ log.Error("Client tried to select a character while not in character select state."); break; } int characterId = BitConverter.ToInt32(data, 0); Character selChar = thisUser.Characters.SingleOrDefault(x=>x.Id == characterId); clientInter.SendTo(clientInfo, BuildMessage(MessageIdentifier.CharacterVerify, BitConverter.GetBytes(selChar != null))); if(selChar != null){ //todo: do something after logging in and selecting character } selectedCharacter = selChar; break; case MessageIdentifier.Disconnect: DisconnectClient(); break; } }
private void DisconnectClient() { if(thisUser != null){ controller.OnUserLoggedOff(thisUser.Username.ToLower()); } status = ClientStatus.Disconnected; clientInter.Disconnect(clientInfo); heartbeat.Stop(); heartbeat.Dispose(); LeaveAllZones(); }
public Heartbeat(ClientStatus status) { Status = status; }
private void StopAppearingAway() { _status = _oldStatus; _heartbeatActor.Tell(new HeartbeatActor.ChangeStatus(_status)); }
public ChangeStatus(ClientStatus status) { Status = status; }
public void ReadPacket(MinecraftStream stream) { Status = (ClientStatus)stream.ReadUInt8(); }
void Start() { _ConnectToServerGUI = new ConnectToServerGUI(); _CreateServerGUI = new CreateServerGUI(); _MenuGUI = new MenuGUI(); //Resetting variables. PlayerVariables.bPlayingAgainstIA = false; _MenuGUI.OnSinglePlayerCallback(delegate { PlayerVariables.bPlayingAgainstIA = true; Application.LoadLevel("SetupAGame"); }); _MenuGUI.OnCreateServerCallback(delegate { status = ClientStatus.Hosting; }); _MenuGUI.OnJoinGameCallback(delegate { status = ClientStatus.Connecting; }); _ConnectToServerGUI.OnBackCallback(delegate { status = ClientStatus.Disconnected; }); _CreateServerGUI.OnBackCallback(delegate { status = ClientStatus.Disconnected; }); status = ClientStatus.Disconnected; }
private void HandleChangeStatus(ChangeStatus msg) { _status = msg.Status; _heartbeatActor.Tell(new HeartbeatActor.ChangeStatus(msg.Status)); }