public SyncEventFieldHandler(ViewDispatcher dispatcher, EntityRef entity, string path, IEventField field)
 {
     this.dispatcher = dispatcher;
     this.entity     = entity;
     this.path       = path;
     this.field      = field;
 }
Example #2
0
        public void Run()
        {
            serverView = new GameView();
            clientView = new GameView();

            var dispatcher = new ViewDispatcher(serverView);

            dispatcher.OnPacketGenerated += packet =>
            {
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.WriteLine(packet);
                Console.ResetColor();
            };
            dispatcher.OnPacketGenerated += clientView.Apply;


            var character = new ViewCharacter
            {
                Traits = new TraitCollection()
                {
                    States = new EventCollection <StateIdentifier, StateInstance> ()
                }
            };

            character.Name.Value = "Unknown";
            serverView.Entities.Add(character.Id, character);

            LogCurrentState();

            character.Name.Value = "New Name";

            LogCurrentState();

            character.Traits.States.Add("Health", new StateInstance());

            LogCurrentState();

            serverView.Entities.Remove(character.Id);

            LogCurrentState();
        }
 public SyncEventCollectionHandler(ViewDispatcher dispatcher, EntityRef parent, string path)
 {
     this.dispatcher = dispatcher;
     this.parent     = parent;
     this.path       = path;
 }
Example #4
0
 public EntitySyncCollectionHandler(ViewDispatcher dispatcher)
 {
     this.dispatcher = dispatcher;
 }