Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 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() + ".");
 }