Beispiel #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();
        }
Beispiel #2
0
        public void BtnStart_Click(object sender, EventArgs e)
        {
            E_AutoMap.MapStart     = System.Convert.ToInt32(Conversion.Val(txtMapStart.Text));
            E_AutoMap.MapSize      = System.Convert.ToInt32(Conversion.Val(txtMapSize.Text));
            E_AutoMap.MapX         = System.Convert.ToInt32(Conversion.Val(txtMapX.Text));
            E_AutoMap.MapY         = System.Convert.ToInt32(Conversion.Val(txtMapY.Text));
            E_AutoMap.SandBorder   = System.Convert.ToInt32(Conversion.Val(txtSandBorder.Text));
            E_AutoMap.DetailFreq   = System.Convert.ToInt32(Conversion.Val(txtDetail.Text));
            E_AutoMap.ResourceFreq = System.Convert.ToInt32(Conversion.Val(txtResourceFreq.Text));

            E_AutoMap.SendSaveAutoMapper();

            this.Dispose();
        }
Beispiel #3
0
        public static void UpdateUI()
        {
            if (E_Globals.InitEditor == true)
            {
                FrmLogin.Default.pnlAdmin.Visible = true;
                E_Globals.InitEditor = false;
            }

            if (E_Pets.InitPetEditor == true)
            {
                E_Globals.Editor = E_Pets.EDITOR_PET;
                frmPet.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= Constants.MAX_PETS; i++)
                {
                    if (E_Pets.Pet[(int)i].Name != null)
                    {
                        frmPet.Default.lstIndex.Items.Add(i + ": " + E_Pets.Pet[(int)i].Name.Trim());
                    }
                    else
                    {
                        frmPet.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                frmPet.Default.cmbEvolve.Items.Clear();

                frmPet.Default.cmbEvolve.Items.Add("None");

                // Add the names
                for (var i = 1; i <= Constants.MAX_PETS; i++)
                {
                    if (E_Pets.Pet[(int)i].Name != null)
                    {
                        frmPet.Default.cmbEvolve.Items.Add(i + ": " + E_Pets.Pet[(int)i].Name.Trim());
                    }
                    else
                    {
                        frmPet.Default.cmbEvolve.Items.Add(i + ": " + "Null");
                    }
                }

                frmPet.Default.Show();
                frmPet.Default.Visible = true;
                frmPet.Default.lstIndex.SelectedIndex  = 0;
                frmPet.Default.cmbEvolve.SelectedIndex = 0;
                E_Pets.PetEditorInit();
                E_Pets.InitPetEditor = false;
            }

            if (E_Quest.QuestEditorShow == true)
            {
                E_Globals.Editor = E_Quest.EDITOR_TASKS;
                FrmQuest.Default.lstIndex.Items.Clear();
                FrmQuest.Default.cmbQuestReq.Items.Clear();
                FrmQuest.Default.cmbQuestReq.Items.Add("None");
                // Add the names
                for (var I = 1; I <= E_Quest.MAX_QUESTS; I++)
                {
                    if (E_Quest.Quest[(int)I].Name != null)
                    {
                        FrmQuest.Default.lstIndex.Items.Add(I + ": " + E_Quest.Quest[(int)I].Name.Trim());
                        FrmQuest.Default.cmbQuestReq.Items.Add(I + ": " + E_Quest.Quest[(int)I].Name.Trim());
                    }
                    else
                    {
                        FrmQuest.Default.lstIndex.Items.Add(I + ": " + "");
                        FrmQuest.Default.cmbQuestReq.Items.Add(I + ": " + "");
                    }
                }

                FrmQuest.Default.Show();
                FrmQuest.Default.Visible = true;
                FrmQuest.Default.lstIndex.SelectedIndex = 0;
                E_Quest.QuestEditorInit();
                E_Quest.QuestEditorShow = false;
            }

            if (E_Globals.InitAnimationEditor == true)
            {
                E_Globals.Editor = E_Globals.EDITOR_ANIMATION;
                FrmAnimation.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= Constants.MAX_ANIMATIONS; i++)
                {
                    if (Types.Animation[(int)i].Name != null)
                    {
                        FrmAnimation.Default.lstIndex.Items.Add(i + ": " + Types.Animation[(int)i].Name.Trim());
                    }
                    else
                    {
                        FrmAnimation.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                FrmAnimation.Default.Show();
                FrmAnimation.Default.Visible = true;
                FrmAnimation.Default.lstIndex.SelectedIndex = 0;
                E_Editors.AnimationEditorInit();
                E_Globals.InitAnimationEditor = false;
            }

            if (E_Globals.InitMapEditor == true)
            {
                E_Editors.MapEditorInit();
                E_Globals.InitMapEditor = false;
            }

            if (E_Globals.InitMapProperties == true)
            {
                E_Editors.MapPropertiesInit();
                E_Globals.InitMapProperties = false;
            }

            if (E_Globals.InitItemEditor == true)
            {
                E_Items.ItemEditorPreInit();
                E_Globals.InitItemEditor = false;
            }

            if (E_Crafting.InitRecipeEditor == true)
            {
                E_Crafting.RecipeEditorPreInit();
                E_Crafting.InitRecipeEditor = false;
            }

            if (E_Globals.InitClassEditor == true)
            {
                E_Editors.ClassEditorInit();
                E_Globals.InitClassEditor = false;
            }

            if (E_Globals.LoadClassInfo == true)
            {
                E_Editors.LoadClass();
                E_Globals.LoadClassInfo = false;
            }

            if (E_Globals.InitResourceEditor == true)
            {
                int i = 0;

                E_Globals.Editor = E_Globals.EDITOR_RESOURCE;
                FrmResource.Default.lstIndex.Items.Clear();

                // Add the names
                for (i = 1; i <= Constants.MAX_RESOURCES; i++)
                {
                    if (Types.Resource[i].Name == null)
                    {
                        Types.Resource[i].Name = "";
                    }
                    if (Types.Resource[i].SuccessMessage == null)
                    {
                        Types.Resource[i].SuccessMessage = "";
                    }
                    if (Types.Resource[i].EmptyMessage == null)
                    {
                        Types.Resource[i].EmptyMessage = "";
                    }
                    FrmResource.Default.lstIndex.Items.Add(i + ": " + Types.Resource[i].Name.Trim());
                }

                FrmResource.Default.Show();
                FrmResource.Default.Visible = true;
                FrmResource.Default.lstIndex.SelectedIndex = 0;
                E_Editors.ResourceEditorInit();
                E_Globals.InitResourceEditor = false;
            }

            if (E_Globals.InitNPCEditor == true)
            {
                E_Globals.Editor = E_Globals.EDITOR_NPC;
                frmNPC.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= Constants.MAX_NPCS; i++)
                {
                    if (Types.Npc[(int)i].Name != null)
                    {
                        frmNPC.Default.lstIndex.Items.Add(i + ": " + Types.Npc[(int)i].Name.Trim());
                    }
                    else
                    {
                        frmNPC.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                frmNPC.Default.Show();
                frmNPC.Default.Visible = true;
                frmNPC.Default.lstIndex.SelectedIndex = 0;
                E_Editors.NpcEditorInit();
                E_Globals.InitNPCEditor = false;
            }

            if (E_Globals.InitSkillEditor == true)
            {
                E_Globals.Editor = E_Globals.EDITOR_SKILL;
                frmSkill.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= Constants.MAX_SKILLS; i++)
                {
                    if (Types.Skill[(int)i].Name != null)
                    {
                        frmSkill.Default.lstIndex.Items.Add(i + ": " + Types.Skill[(int)i].Name.Trim());
                    }
                    else
                    {
                        frmSkill.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                frmSkill.Default.Show();
                frmSkill.Default.Visible = true;
                frmSkill.Default.lstIndex.SelectedIndex = 0;
                E_Editors.SkillEditorInit();
                E_Globals.InitSkillEditor = false;
            }

            if (E_Globals.InitShopEditor == true)
            {
                E_Globals.Editor = E_Globals.EDITOR_SHOP;
                frmShop.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= Constants.MAX_SHOPS; i++)
                {
                    if (Types.Shop[(int)i].Name != null)
                    {
                        frmShop.Default.lstIndex.Items.Add(i + ": " + Types.Shop[(int)i].Name.Trim());
                    }
                    else
                    {
                        frmShop.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                frmShop.Default.Show();
                frmShop.Default.Visible = true;

                frmShop.Default.Visible = true;
                frmShop.Default.lstIndex.SelectedIndex = 0;
                E_Editors.ShopEditorInit();
                E_Globals.InitShopEditor = false;
            }

            if (E_Globals.InitAnimationEditor == true)
            {
                E_Globals.Editor = E_Globals.EDITOR_ANIMATION;
                FrmAnimation.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= Constants.MAX_ANIMATIONS; i++)
                {
                    if (Types.Animation[(int)i].Name != null)
                    {
                        FrmAnimation.Default.lstIndex.Items.Add(i + ": " + Types.Animation[(int)i].Name.Trim());
                    }
                    else
                    {
                        FrmAnimation.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                FrmAnimation.Default.Show();
                FrmAnimation.Default.Visible = true;
                FrmAnimation.Default.lstIndex.SelectedIndex = 0;
                E_Editors.AnimationEditorInit();
                E_Globals.InitAnimationEditor = false;
            }

            if (E_Housing.HouseEdit == true)
            {
                E_Globals.Editor = E_Globals.EDITOR_HOUSE;
                FrmHouse.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= E_Housing.MAX_HOUSES; i++)
                {
                    if (E_Housing.House[(int)i].ConfigName != null)
                    {
                        FrmHouse.Default.lstIndex.Items.Add(i + ": " + E_Housing.House[(int)i].ConfigName.Trim());
                    }
                    else
                    {
                        FrmHouse.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                FrmHouse.Default.Show();
                FrmHouse.Default.Visible = true;
                FrmHouse.Default.lstIndex.SelectedIndex = 0;

                E_Housing.HouseEditorInit();

                E_Housing.HouseEdit = false;
            }

            if (E_EventSystem.InitEventEditorForm == true)
            {
                frmEvents.Default.InitEventEditorForm();

                // populate form
                // set the tabs
                frmEvents.Default.tabPages.TabPages.Clear();

                for (var i = 1; i <= E_EventSystem.TmpEvent.PageCount; i++)
                {
                    frmEvents.Default.tabPages.TabPages.Add(Conversion.Str(i));
                }
                // items
                frmEvents.Default.cmbHasItem.Items.Clear();
                frmEvents.Default.cmbHasItem.Items.Add("None");
                for (var i = 1; i <= Constants.MAX_ITEMS; i++)
                {
                    if (Types.Item[(int)i].Name != null)
                    {
                        frmEvents.Default.cmbHasItem.Items.Add(i + ": " + Types.Item[(int)i].Name.Trim());
                    }
                    else
                    {
                        frmEvents.Default.cmbHasItem.Items.Add(i + ": " + "");
                    }
                }
                // variables
                frmEvents.Default.cmbPlayerVar.Items.Clear();
                frmEvents.Default.cmbPlayerVar.Items.Add("None");
                for (var i = 1; i <= E_EventSystem.MaxVariables; i++)
                {
                    if (E_EventSystem.Variables[(int)i] != null)
                    {
                        frmEvents.Default.cmbPlayerVar.Items.Add(i + ". " + E_EventSystem.Variables[(int)i]);
                    }
                    else
                    {
                        frmEvents.Default.cmbPlayerVar.Items.Add(i + ". " + "");
                    }
                }
                // variables
                frmEvents.Default.cmbPlayerSwitch.Items.Clear();
                frmEvents.Default.cmbPlayerSwitch.Items.Add("None");
                for (var i = 1; i <= E_EventSystem.MaxSwitches; i++)
                {
                    if (E_EventSystem.Switches[(int)i] != null)
                    {
                        frmEvents.Default.cmbPlayerSwitch.Items.Add(i + ". " + E_EventSystem.Switches[(int)i]);
                    }
                    else
                    {
                        frmEvents.Default.cmbPlayerSwitch.Items.Add(i + ". " + "");
                    }
                }
                // name
                frmEvents.Default.txtName.Text = E_EventSystem.TmpEvent.Name;
                // enable delete button
                if (E_EventSystem.TmpEvent.PageCount > 1)
                {
                    frmEvents.Default.btnDeletePage.Enabled = true;
                }
                else
                {
                    frmEvents.Default.btnDeletePage.Enabled = false;
                }
                frmEvents.Default.btnPastePage.Enabled = false;
                // Load page 1 to start off with
                E_EventSystem.CurPageNum = 1;
                E_EventSystem.EventEditorLoadPage(E_EventSystem.CurPageNum);

                frmEvents.Default.nudShowTextFace.Maximum    = E_Graphics.NumFaces;
                frmEvents.Default.nudShowChoicesFace.Maximum = E_Graphics.NumFaces;
                // show the editor
                frmEvents.Default.Show();
                frmEvents.Default.Visible = true;

                E_EventSystem.InitEventEditorForm = false;
            }

            if (E_Projectiles.InitProjectileEditor == true)
            {
                E_Globals.Editor = E_Projectiles.EDITOR_PROJECTILE;
                frmProjectile.Default.lstIndex.Items.Clear();

                // Add the names
                for (var i = 1; i <= E_Projectiles.MAX_PROJECTILES; i++)
                {
                    if (E_Projectiles.Projectiles[(int)i].Name != null)
                    {
                        frmProjectile.Default.lstIndex.Items.Add(i + ": " + E_Projectiles.Projectiles[(int)i].Name.Trim());
                    }
                    else
                    {
                        frmProjectile.Default.lstIndex.Items.Add(i + ": " + "");
                    }
                }

                frmProjectile.Default.Show();
                frmProjectile.Default.Visible = true;
                frmProjectile.Default.lstIndex.SelectedIndex = 0;
                E_Projectiles.ProjectileEditorInit();

                E_Projectiles.InitProjectileEditor = false;
            }

            if (frmProjectile.Default.Visible)
            {
                E_Projectiles.EditorProjectile_DrawProjectile();
            }

            if (E_Globals.InitAutoMapper == true)
            {
                E_AutoMap.OpenAutomapper();
                E_Globals.InitAutoMapper = false;
            }
        }
Beispiel #4
0
 public void BtnAutoMapper_Click(object sender, EventArgs e)
 {
     E_AutoMap.SendRequestAutoMapper();
 }