public LogEntry(bool Outwards, double time, PML Event) { if (Outwards) { TargetClient = "Sent"; SourceClient = ""; } else { TargetClient = ""; SourceClient = "Received"; } this.Event = Event; this.EventInfo = Event.ToString(); this.EventName = Event.Name; this.CharacterName = CharacterName; this.Time = time; }
public void PublishEvent(string messageId, string clientId, string eventName, bool dontLogDescription, string[] parameters, string[] types, string[] values, string syncEvent = "") { ThalamusClientProxy sourceClient = null; inboundEventsCounter++; if (remoteClients.ContainsKey(clientId)) sourceClient = remoteClients[clientId]; PML pml = new PML(eventName, parameters, types, values); pml.DontLogDescription = dontLogDescription; if (sourceClient != null) { Environment.Instance.DebugIf("messages", "[T][" + sourceClient.Name + "]Publishing... " + pml.ToString() + "."); } else { Environment.Instance.DebugIf("messages", "[T][Unknown]Publishing... " + pml.ToString() + "."); } Environment.Instance.LogEvent(false, character, sourceClient, pml); if (syncEvent != "") { Behavior b = new Behavior(); b.AddNode(new Actions.SyncAction(new Actions.SyncPoint(eventName), sourceClient, pml)); BehaviorPlan.Instance.Add(b); } else { Character.SendPerception(pml); BroadcastEvent(messageId, sourceClient, eventName, parameters, types, values, pml); } }
public void BroadcastEvent(string messageId, ThalamusClientProxy sourceClient, string eventName, string[] parameters, string[] types, string[] values, PML ev) { List<ThalamusClientProxy> clients; lock (remoteClients) { clients = new List<ThalamusClientProxy>(remoteClients.Values); } foreach (ThalamusClientProxy client in clients) { if (sourceClient != client && client.SubscribedEvents.Contains(eventName)) { Environment.Instance.LogEvent(true, character, client, ev); client.QueueEvent(messageId, eventName, parameters, types, values, ev.DontLogDescription); outboundEventsCounter++; } } if (sourceClient != null) Environment.Instance.DebugIf("messages", "[T][" + sourceClient.Name + "]Published " + ev.ToString() + "."); else Environment.Instance.DebugIf("messages", "[T][Unknown]Published " + ev.ToString() + "."); }