internal void NewMessage(PlayerActor player, string message) { RemotePlayer p; connectedPlayers.TryGetValue(player.LastUpdatedBy, out p); if (p == null) { return; //Just In Case } ConcurrentDictionary <RemotePlayer, List <string> > areamessages; _broadcaster.sentMessages.TryGetValue(p.areaname, out areamessages); if (areamessages == null) { Debug.WriteLine("Invalid areaname '{0}' on player", p.areaname); return; } //TODO: Possible race condition on messages list? //if NewMessage is called with the same PlayerActor //multiple times concurrently ... somehow List <string> messages; if (areamessages.TryGetValue(p, out messages)) { messages.Add(player.name + ": " + message); } else { messages = new List <string>(); messages.Add(player.name + ": " + message); areamessages.TryAdd(p, messages); } _broadcaster.newMessage = true; }
public void NewMessage(PlayerActor p, string message) { p.LastUpdatedBy = Context.ConnectionId; _broadcaster.game.NewMessage(p, message); }
public void UpdateModel(PlayerActor player) { player.LastUpdatedBy = Context.ConnectionId; // Update the shape model within our broadcaster _broadcaster.game.UpdateShape(player); }
public void UpdateBattle(PlayerActor player, BattleAction action) { player.LastUpdatedBy = Context.ConnectionId; _broadcaster.game.UpdateBattle(player, action); }
public void SendUpdatedStatus(string connectionId, PlayerActor player) { _hubContext.Clients.Client(connectionId).updateMyStatus(player.inventory, player.stats); }