예제 #1
0
        internal static void SendRequestAutoMapper()
        {
            Asfw.ByteStream buffer = new Asfw.ByteStream(4);

            buffer.WriteInt32((System.Int32)Packets.EditorPackets.RequestAutoMap);
            E_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);
            buffer.Dispose();
        }
예제 #2
0
        internal static void SendSaveAutoMapper()
        {
            XmlClass myXml = new XmlClass()
            {
                Filename = Application.StartupPath + "\\Data\\AutoMapper.xml",
                Root     = "Options"
            };

            Asfw.ByteStream buffer = new Asfw.ByteStream(4);

            buffer.WriteInt32((System.Int32)Packets.EditorPackets.SaveAutoMap);

            buffer.WriteInt32(MapStart);
            buffer.WriteInt32(MapSize);
            buffer.WriteInt32(MapX);
            buffer.WriteInt32(MapY);
            buffer.WriteInt32(SandBorder);
            buffer.WriteInt32(DetailFreq);
            buffer.WriteInt32(ResourceFreq);

            myXml.LoadXml();

            //send xml info
            buffer.WriteString(myXml.ReadString("Resources", "ResourcesNum"));

            for (var Prefab = 1; Prefab <= (int)TilePrefab.Count - 1; Prefab++)
            {
                for (var Layer = 1; Layer <= (int)Enums.LayerType.Count - 1; Layer++)
                {
                    if (Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset")) > 0)
                    {
                        buffer.WriteInt32(System.Convert.ToInt32(Layer));
                        buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset"))));
                        buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "X"))));
                        buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Y"))));
                        buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Autotile"))));
                    }
                }
                buffer.WriteInt32(System.Convert.ToInt32(Conversion.Val(myXml.ReadString("Prefab" + System.Convert.ToString(Prefab), "Type"))));
            }

            myXml.CloseXml(false);

            E_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);
            buffer.Dispose();
        }
예제 #3
0
        public static void Packet_AutoMapper(ref byte[] data)
        {
            int Layer = 0;

            Asfw.ByteStream buffer = new Asfw.ByteStream(data);
            MapStart     = buffer.ReadInt32();
            MapSize      = buffer.ReadInt32();
            MapX         = buffer.ReadInt32();
            MapY         = buffer.ReadInt32();
            SandBorder   = buffer.ReadInt32();
            DetailFreq   = buffer.ReadInt32();
            ResourceFreq = buffer.ReadInt32();

            XmlClass myXml = new XmlClass()
            {
                Filename = System.IO.Path.Combine(Application.StartupPath, "Data", "AutoMapper.xml"),
                Root     = "Options"
            };

            myXml.LoadXml();

            myXml.WriteString("Resources", "ResourcesNum", buffer.ReadString());

            for (var Prefab = 1; Prefab <= (int)TilePrefab.Count - 1; Prefab++)
            {
                Tile[(int)Prefab].Layer = new Types.TileDataRec[(int)Enums.LayerType.Count];

                Layer = buffer.ReadInt32();
                myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset", System.Convert.ToString(buffer.ReadInt32()));
                myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "X", System.Convert.ToString(buffer.ReadInt32()));
                myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Y", System.Convert.ToString(buffer.ReadInt32()));
                myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Autotile", System.Convert.ToString(buffer.ReadInt32()));

                myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Type", System.Convert.ToString(buffer.ReadInt32()));
            }

            myXml.CloseXml(true);

            buffer.Dispose();

            E_Globals.InitAutoMapper = true;
        }