//Called from PlayerStatusWorker public void SendPlayerStatus(PlayerStatus playerStatus) { byte[] messageBytes; using (MessageWriter mw = new MessageWriter()) { mw.Write<string>(playerStatus.playerName); mw.Write<string>(playerStatus.vesselText); mw.Write<string>(playerStatus.statusText); messageBytes = mw.GetMessageBytes(); } ClientMessage newMessage = new ClientMessage(); newMessage.type = ClientMessageType.PLAYER_STATUS; newMessage.data = messageBytes; QueueOutgoingMessage(newMessage, true); }
private void HandlePlayerStatus(byte[] messageData) { using (MessageReader mr = new MessageReader(messageData, false)) { string playerName = mr.Read<string>(); string vesselText = mr.Read<string>(); string statusText = mr.Read<string>(); PlayerStatus newStatus = new PlayerStatus(); newStatus.playerName = playerName; newStatus.vesselText = vesselText; newStatus.statusText = statusText; PlayerStatusWorker.fetch.AddPlayerStatus(newStatus); } }
public void AddPlayerStatus(PlayerStatus playerStatus) { addStatusQueue.Enqueue(playerStatus); }
public PlayerStatusWorker() { myPlayerStatus = new PlayerStatus(); myPlayerStatus.playerName = Settings.fetch.playerName; myPlayerStatus.statusText = "Syncing"; }
private void DrawPlayerEntry(PlayerStatus playerStatus) { if (playerStatus == null) { //Just connected or disconnected. return; } GUILayout.BeginHorizontal(); if (!playerNameStyle.ContainsKey(playerStatus.playerName)) { playerNameStyle[playerStatus.playerName] = new GUIStyle(GUI.skin.label); playerNameStyle[playerStatus.playerName].normal.textColor = PlayerColorWorker.fetch.GetPlayerColor(playerStatus.playerName); playerNameStyle[playerStatus.playerName].hover.textColor = PlayerColorWorker.fetch.GetPlayerColor(playerStatus.playerName); playerNameStyle[playerStatus.playerName].active.textColor = PlayerColorWorker.fetch.GetPlayerColor(playerStatus.playerName); playerNameStyle[playerStatus.playerName].fontStyle = FontStyle.Bold; playerNameStyle[playerStatus.playerName].stretchWidth = true; playerNameStyle[playerStatus.playerName].wordWrap = false; } GUILayout.Label(playerStatus.playerName, playerNameStyle[playerStatus.playerName]); GUILayout.FlexibleSpace(); GUILayout.Label(playerStatus.statusText, stateTextStyle); GUILayout.EndHorizontal(); if (playerStatus.vesselText != "") { GUILayout.Label("Pilot: " + playerStatus.vesselText, vesselNameStyle); } }
private void DrawPlayerEntry(PlayerStatus playerStatus) { if (playerStatus == null) { //Just connected or disconnected. return; } GUILayout.BeginHorizontal(); GUILayout.Label(playerStatus.playerName, playerNameStyle); GUILayout.FlexibleSpace(); GUILayout.Label(playerStatus.statusText, stateTextStyle); GUILayout.EndHorizontal(); if (playerStatus.vesselText != "") { GUILayout.Label("Pilot: " + playerStatus.vesselText, vesselNameStyle); } }