Exemplo n.º 1
0
        public void BtnTileSetSave_Click(object sender, EventArgs e)
        {
            int      Prefab = 0;
            int      Layer  = 0;
            XmlClass myXml  = new XmlClass()
            {
                Filename = System.IO.Path.Combine(Application.StartupPath, "Data", "AutoMapper.xml"),
                Root     = "Options"
            };

            myXml.LoadXml();

            Prefab = cmbPrefab.SelectedIndex + 1;

            for (Layer = 1; Layer <= 5; Layer++)
            {
                if (E_AutoMap.Tile[Prefab].Layer[Layer].Tileset > 0)
                {
                    myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Tileset", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].Tileset)));
                    myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "X", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].X)));
                    myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Y", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].Y)));
                    myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Layer" + System.Convert.ToString(Layer) + "Autotile", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Layer[Layer].AutoTile)));
                }
            }

            myXml.WriteString("Prefab" + System.Convert.ToString(Prefab), "Type", System.Convert.ToString(Conversion.Val(E_AutoMap.Tile[Prefab].Type)));

            myXml.CloseXml(true);

            pnlTileConfig.Visible = false;

            E_AutoMap.LoadTilePrefab();
        }
Exemplo n.º 2
0
        public void BtnSaveResource_Click(object sender, EventArgs e)
        {
            int    i           = 0;
            string ResourceStr = "";

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

            myXml.LoadXml();

            for (i = 0; i <= lstResources.Items.Count - 1; i++)
            {
                ResourceStr = Convert.ToString(ResourceStr + System.Convert.ToString(lstResources.Items[i]));
                if (i < lstResources.Items.Count - 1)
                {
                    ResourceStr = ResourceStr + ";";
                }
            }

            myXml.WriteString("Resources", "ResourcesNum", ResourceStr);

            myXml.CloseXml(true);

            pnlResources.Visible = false;
        }
Exemplo n.º 3
0
        internal static void LoadConfig()
        {
            XmlClass myXml = new XmlClass()
            {
                Filename = Application.StartupPath + "\\Data\\UIConfiguration\\MainMenu.xml",
                Root     = "MainMenuConfig"
            };

            myXml.LoadXml();

            FrmMenu.Default.Width          = int.Parse(myXml.ReadString("Window", "Width"));
            FrmMenu.Default.Height         = int.Parse(myXml.ReadString("Window", "Height"));
            FrmMenu.Default.pnlLoad.Width  = int.Parse(myXml.ReadString("Window", "Width"));
            FrmMenu.Default.pnlLoad.Height = int.Parse(myXml.ReadString("Window", "Height"));

            FrmMenu.Default.lblStatusHeader.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ServerStatusHeader", "X")), int.Parse(myXml.ReadString("ServerStatusHeader", "Y")));

            FrmMenu.Default.lblServerStatus.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ServerStatus", "X")), int.Parse(myXml.ReadString("ServerStatus", "Y")));


            FrmMenu.Default.picLogo.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("Logo", "X")), int.Parse(myXml.ReadString("Logo", "Y")));
            myXml.ReadString("Logo", "Width", FrmMenu.Default.picLogo.Width.ToString());
            myXml.ReadString("Logo", "Height", FrmMenu.Default.picLogo.Height.ToString());

            FrmMenu.Default.btnPlay.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonPlay", "X")), int.Parse(myXml.ReadString("ButtonPlay", "Y")));
            myXml.ReadString("ButtonPlay", "Width", FrmMenu.Default.btnPlay.Width.ToString());
            myXml.ReadString("ButtonPlay", "Height", FrmMenu.Default.btnPlay.Height.ToString());

            FrmMenu.Default.btnRegister.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonRegister", "X")), int.Parse(myXml.ReadString("ButtonRegister", "Y")));
            myXml.WriteString("ButtonRegister", "Width", FrmMenu.Default.btnRegister.Width.ToString());
            myXml.WriteString("ButtonRegister", "Height", FrmMenu.Default.btnRegister.Height.ToString());

            FrmMenu.Default.btnCredits.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonCredits", "X")), int.Parse(myXml.ReadString("ButtonCredits", "Y")));
            myXml.ReadString("ButtonCredits", "Width", FrmMenu.Default.btnCredits.Width.ToString());
            myXml.ReadString("ButtonCredits", "Height", FrmMenu.Default.btnCredits.Height.ToString());

            FrmMenu.Default.btnExit.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("ButtonExit", "X")), int.Parse(myXml.ReadString("ButtonExit", "Y")));
            myXml.ReadString("ButtonExit", "Width", FrmMenu.Default.btnExit.Width.ToString());
            myXml.ReadString("ButtonExit", "Height", FrmMenu.Default.btnExit.Height.ToString());

            FrmMenu.Default.pnlMainMenu.Location = new System.Drawing.Point(int.Parse(myXml.ReadString("PanelMain", "X")), int.Parse(myXml.ReadString("PanelMain", "Y")));
            myXml.ReadString("PanelMain", "Width", FrmMenu.Default.pnlMainMenu.Width.ToString());
            myXml.ReadString("PanelMain", "Height", FrmMenu.Default.pnlMainMenu.Height.ToString());

            myXml.CloseXml(true);
        }
Exemplo n.º 4
0
        internal static void CreateOptions()
        {
            XmlClass myXml = new XmlClass()
            {
                Filename = Application.StartupPath + "\\Data\\Config.xml",
                Root     = "Options"
            };

            myXml.NewXmlDocument();

            E_Types.Options.Password  = "";
            E_Types.Options.SavePass  = false;
            E_Types.Options.Username  = "";
            E_Types.Options.IP        = "Localhost";
            E_Types.Options.Port      = 7001;
            E_Types.Options.MenuMusic = "";
            E_Types.Options.Music     = (byte)1;
            E_Types.Options.Sound     = (byte)1;
            E_Types.Options.Volume    = 100;

            myXml.LoadXml();

            myXml.WriteString("UserInfo", "Username", E_Types.Options.Username.Trim());
            myXml.WriteString("UserInfo", "Password", E_Types.Options.Password.Trim());
            myXml.WriteString("UserInfo", "SavePass", System.Convert.ToString(E_Types.Options.SavePass).Trim());

            myXml.WriteString("Connection", "Ip", E_Types.Options.IP.Trim());
            myXml.WriteString("Connection", "Port", System.Convert.ToString(E_Types.Options.Port).Trim());

            myXml.WriteString("Sfx", "MenuMusic", E_Types.Options.MenuMusic.Trim());
            myXml.WriteString("Sfx", "Music", E_Types.Options.Music.ToString());
            myXml.WriteString("Sfx", "Sound", E_Types.Options.Sound.ToString());
            myXml.WriteString("Sfx", "Volume", System.Convert.ToString(E_Types.Options.Volume).Trim());

            myXml.CloseXml(true);
        }
Exemplo n.º 5
0
        public static void CreateHouses()
        {
            XmlClass myXml = new XmlClass
            {
                Filename = Path.Combine(Application.StartupPath, "data", "houseconfig.xml"),
                Root     = "Config"
            };

            myXml.NewXmlDocument();
            myXml.LoadXml();
            myXml.WriteString("House" + Conversions.ToString(1), "BaseMap", Conversions.ToString(S_Housing.HouseConfig[1].BaseMap));
            myXml.WriteString("House" + Conversions.ToString(1), "Name", S_Housing.HouseConfig[1].ConfigName);
            myXml.WriteString("House" + Conversions.ToString(1), "MaxFurniture", Conversions.ToString(S_Housing.HouseConfig[1].MaxFurniture));
            myXml.WriteString("House" + Conversions.ToString(1), "Price", Conversions.ToString(S_Housing.HouseConfig[1].Price));
            myXml.WriteString("House" + Conversions.ToString(1), "X", Conversions.ToString(S_Housing.HouseConfig[1].X));
            myXml.WriteString("House" + Conversions.ToString(1), "Y", Conversions.ToString(S_Housing.HouseConfig[1].Y));
            myXml.CloseXml(true);
        }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
0
        public static void SaveHouse(int index)
        {
            XmlClass myXml = new XmlClass
            {
                Filename = Path.Combine(Application.StartupPath, "data", "houseconfig.xml"),
                Root     = "Config"
            };

            myXml.LoadXml();
            if (index > 0 && index <= S_Housing.MAX_HOUSES)
            {
                myXml.WriteString("House" + Conversions.ToString(index), "BaseMap", Conversions.ToString(S_Housing.HouseConfig[index].BaseMap));
                myXml.WriteString("House" + Conversions.ToString(index), "Name", S_Housing.HouseConfig[index].ConfigName);
                myXml.WriteString("House" + Conversions.ToString(index), "MaxFurniture", Conversions.ToString(S_Housing.HouseConfig[index].MaxFurniture));
                myXml.WriteString("House" + Conversions.ToString(index), "Price", Conversions.ToString(S_Housing.HouseConfig[index].Price));
                myXml.WriteString("House" + Conversions.ToString(index), "X", Conversions.ToString(S_Housing.HouseConfig[index].X));
                myXml.WriteString("House" + Conversions.ToString(index), "Y", Conversions.ToString(S_Housing.HouseConfig[index].Y));
            }
            myXml.CloseXml(true);
            S_Housing.LoadHouses();
        }
Exemplo n.º 8
0
        internal static void CreateConfig()
        {
            XmlClass myXml = new XmlClass()
            {
                Filename = Application.StartupPath + "\\Data\\UIConfiguration\\MainMenu.xml",
                Root     = "MainMenuConfig"
            };

            myXml.NewXmlDocument();

            myXml.LoadXml();

            myXml.WriteString("Window", "Width", FrmMenu.Default.Width.ToString());
            myXml.WriteString("Window", "Height", FrmMenu.Default.Height.ToString());

            myXml.WriteString("ServerStatusHeader", "X", FrmMenu.Default.lblStatusHeader.Location.X.ToString());
            myXml.WriteString("ServerStatusHeader", "Y", FrmMenu.Default.lblStatusHeader.Location.Y.ToString());

            myXml.WriteString("ServerStatus", "X", FrmMenu.Default.lblServerStatus.Location.X.ToString());
            myXml.WriteString("ServerStatus", "Y", FrmMenu.Default.lblServerStatus.Location.Y.ToString());

            myXml.WriteString("Logo", "X", FrmMenu.Default.picLogo.Location.X.ToString());
            myXml.WriteString("Logo", "Y", FrmMenu.Default.picLogo.Location.Y.ToString());
            myXml.WriteString("Logo", "Width", FrmMenu.Default.picLogo.Width.ToString());
            myXml.WriteString("Logo", "Height", FrmMenu.Default.picLogo.Height.ToString());

            myXml.WriteString("ButtonPlay", "X", FrmMenu.Default.btnPlay.Location.X.ToString());
            myXml.WriteString("ButtonPlay", "Y", FrmMenu.Default.btnPlay.Location.Y.ToString());
            myXml.WriteString("ButtonPlay", "Width", FrmMenu.Default.btnPlay.Width.ToString());
            myXml.WriteString("ButtonPlay", "Height", FrmMenu.Default.btnPlay.Height.ToString());

            myXml.WriteString("ButtonRegister", "X", FrmMenu.Default.btnRegister.Location.X.ToString());
            myXml.WriteString("ButtonRegister", "Y", FrmMenu.Default.btnRegister.Location.Y.ToString());
            myXml.WriteString("ButtonRegister", "Width", FrmMenu.Default.btnRegister.Width.ToString());
            myXml.WriteString("ButtonRegister", "Height", FrmMenu.Default.btnRegister.Height.ToString());

            myXml.WriteString("ButtonCredits", "X", FrmMenu.Default.btnCredits.Location.X.ToString());
            myXml.WriteString("ButtonCredits", "Y", FrmMenu.Default.btnCredits.Location.Y.ToString());
            myXml.WriteString("ButtonCredits", "Width", FrmMenu.Default.btnCredits.Width.ToString());
            myXml.WriteString("ButtonCredits", "Height", FrmMenu.Default.btnCredits.Height.ToString());

            myXml.WriteString("ButtonExit", "X", FrmMenu.Default.btnExit.Location.X.ToString());
            myXml.WriteString("ButtonExit", "Y", FrmMenu.Default.btnExit.Location.Y.ToString());
            myXml.WriteString("ButtonExit", "Width", FrmMenu.Default.btnExit.Width.ToString());
            myXml.WriteString("ButtonExit", "Height", FrmMenu.Default.btnExit.Height.ToString());

            myXml.WriteString("PanelMain", "X", FrmMenu.Default.pnlMainMenu.Location.X.ToString());
            myXml.WriteString("PanelMain", "Y", FrmMenu.Default.pnlMainMenu.Location.Y.ToString());
            myXml.WriteString("PanelMain", "Width", FrmMenu.Default.pnlMainMenu.Width.ToString());
            myXml.WriteString("PanelMain", "Height", FrmMenu.Default.pnlMainMenu.Height.ToString());

            myXml.CloseXml(true);
        }
Exemplo n.º 9
0
        internal static void SaveOptions()
        {
            XmlClass myXml = new XmlClass()
            {
                Filename = Application.StartupPath + "\\Data\\Config.xml",
                Root     = "Options"
            };

            myXml.LoadXml();

            myXml.WriteString("UserInfo", "Username", C_Types.Options.Username);
            myXml.WriteString("UserInfo", "Password", C_Types.Options.Password);
            myXml.WriteString("UserInfo", "SavePass", System.Convert.ToString(C_Types.Options.SavePass));

            myXml.WriteString("Connection", "Ip", C_Types.Options.Ip.Trim());
            myXml.WriteString("Connection", "Port", System.Convert.ToString(C_Types.Options.Port));

            myXml.WriteString("Sfx", "MenuMusic", C_Types.Options.MenuMusic);
            myXml.WriteString("Sfx", "Music", C_Types.Options.Music.ToString());
            myXml.WriteString("Sfx", "Sound", C_Types.Options.Sound.ToString());
            myXml.WriteString("Sfx", "Volume", System.Convert.ToString(C_Types.Options.Volume));

            myXml.WriteString("Misc", "ScreenSize", C_Types.Options.ScreenSize.ToString());
            myXml.WriteString("Misc", "VSync", C_Types.Options.VSync.ToString());
            myXml.WriteString("Misc", "UnlockFPS", C_Types.Options.UnlockFPS.ToString());
            myXml.WriteString("Misc", "ShowNpcBar", C_Types.Options.ShowNpcBar.ToString());

            myXml.WriteString("Misc", "ApplicationID", C_Types.Options.ApplicationID);
            myXml.WriteString("Misc", "LargeImageKey", C_Types.Options.LargeImageKey);
            myXml.WriteString("Misc", "LargeImageText", C_Types.Options.LargeImageText);
            myXml.WriteString("Misc", "SmallImageKey", C_Types.Options.SmallImageKey);

            myXml.CloseXml(true);
        }
Exemplo n.º 10
0
        internal static void CreateOptions()
        {
            XmlClass myXml = new XmlClass()
            {
                Filename = Application.StartupPath + "\\Data\\Config.xml",
                Root     = "Options"
            };

            myXml.NewXmlDocument();

            C_Types.Options.Password       = "";
            C_Types.Options.SavePass       = false;
            C_Types.Options.Username       = "";
            C_Types.Options.Ip             = "127.0.0.1";
            C_Types.Options.Port           = 7001;
            C_Types.Options.MenuMusic      = "";
            C_Types.Options.Music          = (byte)1;
            C_Types.Options.Sound          = (byte)1;
            C_Types.Options.Volume         = 100;
            C_Types.Options.ScreenSize     = (byte)0;
            C_Types.Options.VSync          = (byte)0;
            C_Types.Options.UnlockFPS      = (byte)0;
            C_Types.Options.ShowNpcBar     = (byte)0;
            C_Types.Options.ApplicationID  = "";
            C_Types.Options.LargeImageKey  = "";
            C_Types.Options.LargeImageText = "";
            C_Types.Options.SmallImageKey  = "";

            myXml.LoadXml();

            myXml.WriteString("UserInfo", "Username", C_Types.Options.Username.Trim());
            myXml.WriteString("UserInfo", "Password", C_Types.Options.Password.Trim());
            myXml.WriteString("UserInfo", "SavePass", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.SavePass)));

            myXml.WriteString("Connection", "Ip", C_Types.Options.Ip.Trim());
            myXml.WriteString("Connection", "Port", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Port)));

            myXml.WriteString("Sfx", "MenuMusic", C_Types.Options.MenuMusic.Trim());
            myXml.WriteString("Sfx", "Music", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Music.ToString()));
            myXml.WriteString("Sfx", "Sound", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Sound.ToString()));
            myXml.WriteString("Sfx", "Volume", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Volume)));

            myXml.WriteString("Misc", "ScreenSize", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ScreenSize.ToString()));
            myXml.WriteString("Misc", "VSync", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.VSync.ToString()));
            myXml.WriteString("Misc", "UnlockFPS", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.UnlockFPS.ToString()));
            myXml.WriteString("Misc", "ShowNpcBar", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ShowNpcBar.ToString()));

            myXml.WriteString("Misc", "ApplicationID", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ApplicationID));
            myXml.WriteString("Misc", "LargeImageKey", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.LargeImageKey));
            myXml.WriteString("Misc", "LargeImageText", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.LargeImageText));
            myXml.WriteString("Misc", "SmallImageKey", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.SmallImageKey));

            myXml.CloseXml(true);
        }
Exemplo n.º 11
0
        internal static void SaveOptions()
        {
            XmlClass myXml = new XmlClass()
            {
                Filename = Application.StartupPath + "\\Data\\Config.xml",
                Root     = "Options"
            };

            myXml.LoadXml();

            myXml.WriteString("UserInfo", "Username", C_Types.Options.Username.Trim());
            myXml.WriteString("UserInfo", "Password", C_Types.Options.Password.Trim());
            myXml.WriteString("UserInfo", "SavePass", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.SavePass)));

            myXml.WriteString("Connection", "Ip", C_Types.Options.Ip.Trim());
            myXml.WriteString("Connection", "Port", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Port)));

            myXml.WriteString("Sfx", "MenuMusic", C_Types.Options.MenuMusic.Trim());
            myXml.WriteString("Sfx", "Music", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Music.ToString()));
            myXml.WriteString("Sfx", "Sound", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.Sound.ToString()));
            myXml.WriteString("Sfx", "Volume", Microsoft.VisualBasic.Strings.Trim(System.Convert.ToString(C_Types.Options.Volume)));

            myXml.WriteString("Misc", "ScreenSize", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ScreenSize.ToString()));
            myXml.WriteString("Misc", "HighEnd", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.HighEnd.ToString()));
            myXml.WriteString("Misc", "ShowNpcBar", Microsoft.VisualBasic.Strings.Trim(C_Types.Options.ShowNpcBar.ToString()));

            myXml.CloseXml(true);
        }