示例#1
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);
 }
        private void WriteMe(Lidgren.Network.NetOutgoingMessage msg)
        {
            msg.Write(Id);
            msg.Write(EmmitingDirection);
            msg.Write(EmitingTime);
            msg.Write(MinAngle);
            msg.Write(MaxAngle);
            msg.Write(MaxForce);
            msg.Write(MinForce);
            msg.Write(MaxLife);
            msg.Write(MinLife);
            msg.Write(MaxSize);
            msg.Write(MinSize);
            msg.Write(MaxRotation);
            msg.Write(MinRotation);
            msg.Write(MaxStartingRotation);
            msg.Write(MinStartingRotation);
            msg.Write(Delay);
            msg.Write(SizeMultiplier);
            msg.Write(Amount);
            msg.Write(FireAll);
            msg.Write(Infinite);
            msg.Write(Position);
            msg.Write(Direction);

            NetDataHelper.WriteParticleFactory(msg, factory);
            NetDataHelper.WriteControls(msg, GetControlsCopy());
        }
示例#3
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);
 }
示例#4
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);
                }
            }
        }
        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);
            }
        }
示例#6
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);
 }
示例#7
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);
 }
示例#8
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);
 }
示例#9
0
        public override NetworkMessage Write(Lidgren.Network.NetOutgoingMessage msgOut)
        {
            base.Write(msgOut);

            NetworkMessage.WriteByteBuffer(values.ToByteArray(), msgOut);

            return(this);
        }
示例#10
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);
 }
示例#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");
        }
示例#12
0
文件: Item.cs 项目: sokol815/Exilania
 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);
     }
 }
示例#13
0
        public static void Write(this Lidgren.Network.NetOutgoingMessage om, Quaternion q)
        {
            var maxIndex = 0;
            var maxValue = float.MinValue;
            var sign     = 1f;

            maxValue = Math.Abs(q.X);
            sign     = q.X < 0 ? -1 : 1;

            if (Math.Abs(q.Y) > maxValue)
            {
                maxValue = Math.Abs(q.Y);
                maxIndex = 1;
                sign     = q.Y < 0 ? -1 : 1;
            }
            if (Math.Abs(q.Z) > maxValue)
            {
                maxValue = Math.Abs(q.Z);
                maxIndex = 2;
                sign     = q.Z < 0 ? -1 : 1;
            }
            if (Math.Abs(q.W) > maxValue)
            {
                maxValue = Math.Abs(q.W);
                maxIndex = 3;
                sign     = q.W < 0 ? -1 : 1;
            }
            om.WriteRangedInteger(0, 3, maxIndex);

            if (maxIndex == 0)
            {
                om.WriteRangedSingle(q.Y * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.Z * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.W * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
            }
            else if (maxIndex == 1)
            {
                om.WriteRangedSingle(q.X * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.Z * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.W * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
            }
            else if (maxIndex == 2)
            {
                om.WriteRangedSingle(q.X * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.Y * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.W * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
            }
            else
            {
                om.WriteRangedSingle(q.X * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.Y * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
                om.WriteRangedSingle(q.Z * sign, UNIT_MIN, UNIT_MAX, BITS_COMPONENT);
            }
            om.WritePadBits();
        }
示例#14
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);
 }
示例#15
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);
 }
示例#16
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);
     }
 }
示例#17
0
        public static void Send(Lidgren.Network.NetOutgoingMessage message, Canvas canvas, Palette pal)
        {
            using (var stream = new MemoryStream()) {
                Pablo.Save(stream, canvas, pal);
                stream.Flush();
                stream.Seek(0, SeekOrigin.Begin);

                message.WriteVariableInt32(canvas.Width);
                message.WriteVariableInt32(canvas.Height);
                message.WritePadBits();
                message.WriteStream((Stream)stream);
            }
        }
示例#18
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]);
     }
 }
示例#19
0
文件: Item.cs 项目: sokol815/Exilania
 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);
     }
 }
示例#20
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);
         }
     }
 }
示例#21
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);
     }
 }
示例#22
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);
         }
     }
 }
示例#23
0
        public void WriteObject(Lidgren.Network.NetOutgoingMessage msg)
        {
            msg.Write(BulletFired);
            msg.Write(BulletHit);
            msg.Write(MineFired);
            msg.Write(MineHit);
            msg.Write(HookFired);
            msg.Write(HookHit);
            msg.Write(Healed);
            msg.Write(GoldEarned);
            msg.Write(DamageTaken);
            msg.Write(DeadTime);
            msg.Write(Time);
            msg.Write(PoweredActions);

            msg.WriteSpecialActions(Actions);
            msg.WriteStats(Stats);
        }
示例#24
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);
            }
        }
示例#25
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);
 }
示例#26
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);
 }
示例#28
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);
 }
示例#29
0
        public override void WriteOutUpdateData(Lidgren.Network.NetOutgoingMessage om)
        {
            base.WriteOutUpdateData(om);

            om.Write(this.WorkDone);
        }
 public abstract void WriteObject(Lidgren.Network.NetOutgoingMessage msg);