コード例 #1
0
        public static void Read(Nettention.Proud.Message msg, out ShipObjectArray objArray)
        {
            int count = 0;

            msg.Read(out count);

            if (count > 0)
            {
                ShipObject[] worldData = new ShipObject[count];

                for (int i = 0; i < count; i++)
                {
                    ShipObject data = new ShipObject();

                    msg.Read(out data.Owner);
                    msg.Read(out data.LocalID);
                    msg.Read(out data.Position.x);
                    msg.Read(out data.Position.y);
                    msg.Read(out data.Position.z);
                    msg.Read(out data.resIndex);

                    worldData[i] = data;
                }

                objArray = new ShipObjectArray(worldData);
            }
            else
            {
                objArray = new ShipObjectArray();
            }
        }
コード例 #2
0
        public static void Write(Nettention.Proud.Message msg, ShipObjectArray objArray)
        {
            if (objArray == null)
            {
                return;
            }

            msg.Write(objArray.Count);

            for (int i = 0; i < objArray.Count; i++)
            {
                ShipObject data = objArray.data[i];

                msg.Write(data.Owner);
                msg.Write(data.LocalID);
                msg.Write(data.Position.x);
                msg.Write(data.Position.y);
                msg.Write(data.Position.z);
                msg.Write(data.resIndex);
            }
        }