Example #1
0
            public override void ReadMethodInvoke(Entity entity, Buffer buffer)
            {
                Syncronizer  syncronizer = entity.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                object[] arguments = ReadArguments(buffer);

                if (actor.IsServer())
                {
                    Invoke(entity.GetTarget(), arguments);
                }
            }
Example #2
0
            public override void ReadMethodInvoke(System system, Buffer buffer)
            {
                Syncronizer  syncronizer = system.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                object[] arguments = ReadArguments(buffer);

                if (actor.IsServer())
                {
                    SendMethodInvoke(system, arguments);
                }
                else
                {
                    Invoke(system.GetTarget(), arguments);
                }
            }
Example #3
0
            public override void SendMethodInvoke(Entity entity, object[] arguments)
            {
                Syncronizer  syncronizer = entity.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                syncronizer.CreateMessage(MessageType.InvokeEntityMethod, delivery_method, delegate(Buffer buffer) {
                    buffer.WriteEntityReference(entity);
                    buffer.WriteEntityMethod(this);

                    WriteArguments(arguments, buffer);

                    if (actor.IsServer())
                    {
                        Invoke(entity.GetTarget(), arguments);
                    }
                }).Send();
            }
Example #4
0
            public override void SendMethodInvoke(System system, object[] arguments)
            {
                Syncronizer  syncronizer = system.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                if (actor.IsServer())
                {
                    object spawned        = Invoke(system.GetTarget(), arguments);
                    Entity spawned_entity = syncronizer.entity_manager.RegisterEntityTarget(spawned, system, this, arguments);

                    SendConstructorReplay(system, NetworkRecipient_All.INSTANCE, arguments, spawned_entity);
                }
                else
                {
                    SendConstructorReplay(system, NetworkRecipient_All.INSTANCE, arguments, null);
                }
            }
Example #5
0
            public void SendConstructorReplay(System system, NetworkRecipient recipient, object[] arguments, Entity spawned_entity)
            {
                Syncronizer  syncronizer = system.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                syncronizer.CreateMessage(MessageType.InvokeSystemMethod, NetDeliveryMethod.ReliableOrdered, delegate(Buffer buffer) {
                    buffer.WriteSystemReference(system);
                    buffer.WriteSystemMethod(this);

                    WriteArguments(arguments, buffer);

                    if (actor.IsServer())
                    {
                        buffer.WriteInt32(spawned_entity.GetId());
                        spawned_entity.WriteSync(buffer);
                    }
                }).Send(recipient);
            }
Example #6
0
            public override void ReadMethodInvoke(System system, Buffer buffer)
            {
                Syncronizer  syncronizer = system.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                object[] arguments = ReadArguments(buffer);

                if (actor.IsServer())
                {
                    SendMethodInvoke(system, arguments);
                }
                else
                {
                    object spawned        = Invoke(system.GetTarget(), arguments);
                    Entity spawned_entity = syncronizer.entity_manager.RegisterEntityTarget(buffer.ReadInt32(), spawned, system, this, arguments);

                    spawned_entity.ReadSync(buffer);
                }
            }
Example #7
0
            public Message(NetworkEnvelope e, Syncronizer s)
            {
                envelope = e;

                buffer = new Buffer(envelope.GetMessage(), s.GetNetworkActor(), s);
            }