예제 #1
0
 public SyncEventFieldHandler(ViewDispatcher dispatcher, EntityRef entity, string path, IEventField field)
 {
     this.dispatcher = dispatcher;
     this.entity     = entity;
     this.path       = path;
     this.field      = field;
 }
예제 #2
0
파일: Server.cs 프로젝트: leelnfei/RPGCore
        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;
 }
예제 #4
0
 public EntitySyncCollectionHandler(ViewDispatcher dispatcher)
 {
     this.dispatcher = dispatcher;
 }