Esempio n. 1
0
 /// <summary>
 /// serialize to the stream
 /// </summary>
 /// <param name="message"></param>
 public void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
 {
     message.Write(quaternion.X);
     message.Write(quaternion.Y);
     message.Write(quaternion.Z);
     message.Write(quaternion.W);
 }
Esempio n. 2
0
 /// <summary>
 /// serialize quaternion into the stream
 /// </summary>
 /// <param name="message"></param>
 public void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
 {
     message.Write(quaternion.x);
     message.Write(quaternion.y);
     message.Write(quaternion.z);
     message.Write(quaternion.w);
 }
Esempio n. 3
0
        /// <summary>
        /// Serialize the array to the message
        /// </summary>
        /// <param name="message"></param>
        public void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
        {
            if (items == null || items.Length == 0)
            {
                message.Write(0);
                return;
            }

            message.Write(items.Length);
            foreach (var item in items)
            {
                if (!IsValueType)
                {
                    if (PreserveIndex)
                    {
                        message.Write(item != null);
                    }
                    if (item != null)
                    {
                        item.OnSerialize(message);
                    }
                }
                else
                {
                    item.OnSerialize(message);
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// serialize to the stream
 /// </summary>
 /// <param name="message"></param>
 public override void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
 {
     message.Write(Value.X);
     message.Write(Value.Y);
     message.Write(Value.Z);
     message.Write(Value.W);
 }
Esempio n. 5
0
 /// <summary>
 /// Serialize the quaternion to the message
 /// </summary>
 /// <param name="quaternion"></param>
 /// <param name="message"></param>
 public static void Serialize(this Quaternion quaternion, Lidgren.Network.NetOutgoingMessage message)
 {
     message.Write(quaternion.x);
     message.Write(quaternion.y);
     message.Write(quaternion.z);
     message.Write(quaternion.w);
 }
Esempio n. 6
0
 /// <summary>
 /// serialize quaternion into the stream
 /// </summary>
 /// <param name="message"></param>
 public override void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
 {
     message.Write(Value.x);
     message.Write(Value.y);
     message.Write(Value.z);
     message.Write(Value.w);
 }
Esempio n. 7
0
 public void send_connector(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write((byte)conn_type);
     w.Write((byte)target_type);
     w.Write(target_id);
     w.Write(data_one);
     w.Write(data_two);
 }
Esempio n. 8
0
 public void send_item(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write(item_name);
     w.Write(pieces.Count);
     for (int x = 0; x < pieces.Count; x++)
     {
         pieces[x].send_block_enum(w);
     }
 }
Esempio n. 9
0
 public void send_chunk(Lidgren.Network.NetOutgoingMessage o, World w)
 {
     o.Write((UInt16)area.X);
     o.Write((UInt16)area.Y);
     o.Write((UInt16)area.Width);
     o.Write((UInt16)area.Height);
     for (int x = area.X; x < area.Right; x++)
     {
         for (int y = area.Y; y < area.Bottom; y++)
         {
             w.map[x, y].send_voxel(o);
         }
     }
 }
        public void Start(bool send = false)
        {
            particles.Clear();
            ending    = false;
            amount    = Amount;
            delayTime = Delay;
            timeLap   = 0;
            time      = 0;

            if (Dead)
            {
                Dead = false;
                SceneMgr.DelayedAttachToScene(this);
            }

            if (send)
            {
                Lidgren.Network.NetOutgoingMessage msg = SceneMgr.CreateNetMessage();

                msg.Write((int)PacketType.PARTICLE_EMMITOR_CREATE);
                WriteMe(msg);

                SceneMgr.SendMessage(msg);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Sends a disconnection packet then disconnects our connection from a server
        /// </summary>
        public void Destroy()
        {
            Lidgren.Network.NetOutgoingMessage msg = new Lidgren.Network.NetOutgoingMessage();
            msg.Write((byte)PacketHeaders.Packets.CS_Disconnect);
            this.SendMessage(msg, Lidgren.Network.NetDeliveryMethod.ReliableOrdered);

            this.Disconnect("Quit");
        }
Esempio n. 12
0
 public void send_damage(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write(time_execute);
     w.Write((byte)attacker);
     w.Write((ushort)attacker_id);
     w.Write((byte)target);
     w.Write((ushort)target_id);
     w.Write((short)damage);
     w.Write((byte)damage_code);
     w.Write((ushort)range);
 }
Esempio n. 13
0
 public void Serialize(ref Lidgren.Network.NetOutgoingMessage buff)
 {
     buff.Write((int)DataItem.DATA_TYPE.SIM_DATA);
     buff.Write((int)_player);
     buff.Write((int)_obj);
     buff.Write((int)_action);
     buff.Write(_pos[0]);
     buff.Write(_pos[1]);
     buff.Write(_angle);
     buff.Write(_inst_id);
 }
Esempio n. 14
0
 public void send_block_enum(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write(itempiece_id);
     w.Write((short)loc.X);
     w.Write((short)loc.Y);
     w.Write((byte)rotation);
     w.Write(children.Count);
     foreach (var ped in children)
     {
         w.Write(ped.Key);
         w.Write(ped.Value);
     }
 }
Esempio n. 15
0
 public void send_unit(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write((ushort)top_left.X);
     w.Write((ushort)top_left.Y);
     w.Write((byte)width);
     w.Write((byte)height);
     w.Write(piece_type);
     w.Write((byte)images.Length);
     for (int x = 0; x < images.Length; x++)
     {
         w.Write((ushort)images[x]);
     }
 }
Esempio n. 16
0
 public static void Write(this Lidgren.Network.NetOutgoingMessage om, string[] array)
 {
     if (array == null)
     {
         om.WriteVariableUInt32(0);
     }
     else
     {
         om.WriteVariableUInt32((uint)array.Length);
         foreach (var s in array)
         {
             om.Write(s);
         }
     }
 }
Esempio n. 17
0
 public void send_chest(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write(destroyable);
     w.Write(chest_name);
     w.Write(security);
     w.Write((ushort)world_top_left.X);
     w.Write((ushort)world_top_left.Y);
     w.Write((ushort)furniture_id);
     w.Write((byte)items.Count);
     for (int i = 0; i < items.Count; i++)
     {
         items[i].send_cubby(w);
     }
 }
Esempio n. 18
0
 public void send_plant(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write(plant_index);
     w.Write(name);
     w.Write((ushort)top_left.X);
     w.Write((ushort)top_left.Y);
     w.Write((byte)height);
     w.Write((byte)pieces.Count);
     for (int x = 0; x < pieces.Count; x++)
     {
         pieces[x].send_unit(w);
     }
 }
Esempio n. 19
0
        protected override void WriteTo(Lidgren.Network.NetOutgoingMessage outgoingMessage)
        {
            base.WriteTo(outgoingMessage);

            for (var i = 0; i < 4; i++)
            {
                outgoingMessage.Write(StartUpPositions[i].X);
                outgoingMessage.Write(StartUpPositions[i].Y);
            }

            outgoingMessage.Write(TileSetAssetName);

            for (var i = 0; i < Data.Length; i++)
            {
                outgoingMessage.Write((byte)Data[i].GroundBlockType);
                outgoingMessage.Write((byte)Data[i].FringeBlockType);
                outgoingMessage.Write((byte)Data[i].FringeItemType);
            }
        }
Esempio n. 20
0
 /// <summary>
 /// serialize to the stream
 /// </summary>
 /// <param name="message"></param>
 public void OnSerialize(Lidgren.Network.NetOutgoingMessage message)
 {
     message.Write(vector3.X);
     message.Write(vector3.Y);
     message.Write(vector3.Z);
 }
 public override void WriteObject(Lidgren.Network.NetOutgoingMessage msg)
 {
     msg.Write(Color);
     msg.Write(RenderSize);
     msg.Write(Source.OriginalString);
 }
Esempio n. 22
0
 public void send_growth_event(Lidgren.Network.NetOutgoingMessage m)
 {
     m.Write((ushort)loc.X);
     m.Write((ushort)loc.Y);
     m.Write((byte)growth_id);
 }
Esempio n. 23
0
        public override void WriteOutUpdateData(Lidgren.Network.NetOutgoingMessage om)
        {
            base.WriteOutUpdateData(om);

            om.Write(this.WorkDone);
        }
Esempio n. 24
0
 public void send_ActorStats(Lidgren.Network.NetOutgoingMessage w)
 {
     life.send_container(w);
     breath.send_FloatContainer(w);
     power.send_container(w);
     w.Write(share_power);
     ammo.send_container(w);
     w.Write(experience);
     w.Write(complexity);
     w.Write(armor);
     w.Write(jump_speed);
     w.Write(run_speed);
     w.Write(jump_max_time);
     w.Write(can_swim);
     w.Write(boyant);
     w.Write(jump_can_resume);
     w.Write(life_regen);
     w.Write(ammo_regen);
     w.Write(energy_regen);
     w.Write(water_jump_proficiency);
     w.Write(max_safe_fall);
 }
Esempio n. 25
0
 public static void Write(this Lidgren.Network.NetOutgoingMessage om, Vector3 vec)
 {
     om.Write(vec.X);
     om.Write(vec.Y);
     om.Write(vec.Z);
 }
Esempio n. 26
0
 public override void WriteObject(Lidgren.Network.NetOutgoingMessage msg)
 {
     base.WriteObject(msg);
     msg.Write(Name);
 }
 public override void WriteObject(Lidgren.Network.NetOutgoingMessage msg)
 {
     msg.Write(Color);
 }
Esempio n. 28
0
 public void send_container(Lidgren.Network.NetOutgoingMessage w)
 {
     w.Write(max_val);
     w.Write(cur_val);
 }
Esempio n. 29
0
 public static void WriteDirection(Lidgren.Network.NetOutgoingMessage om, Vector3 vec)
 {
     om.Write((short)(vec.X * short.MaxValue));
     om.Write((short)(vec.Y * short.MaxValue));
     om.Write((short)(vec.Z * short.MaxValue));
 }
Esempio n. 30
0
 /// <summary>
 /// serialize the vector3 to the message
 /// </summary>
 /// <param name="vector3"></param>
 /// <param name="message"></param>
 public static void Serialize(this Vector3 vector3, Lidgren.Network.NetOutgoingMessage message)
 {
     message.Write(vector3.x);
     message.Write(vector3.y);
     message.Write(vector3.z);
 }