Esempio n. 1
0
        private void menuRealms_Click(object sender, EventArgs e)
        {
            //Create a new instance of the Realms editor.
            frmRealms realms = new frmRealms();

            //Show it as a dialog. This prevents other editors from starting at the same time.
            //Ensures that the static Editor Type will only be accessed by one editor at a time.
            realms.ShowDialog();

            //While the editor is visible, just keep the App responsive.
            while (realms.Visible)
            {
                Application.DoEvents();
            }

            //Null the reference we have.
            realms = null;
        }
Esempio n. 2
0
        private void zonesBtnChangeRealm_Click(object sender, EventArgs e)
        {
            //Creates a new instance of the Realms editor
            frmRealms realms = new frmRealms();

            //We want to make sure and remove this Zone from its current Relam
            if (Editor.CurrentRealm != null)
            {
                Editor.CurrentRealm.RemoveZone(Editor.CurrentZone);
            }
            //Flag changing zone as true so users can double-click and close the editor
            realms.ChangingRealm = true;

            //Show it as a dialog. This prevents other editors from starting at the same time.
            //Ensures that the static Editor Type will only be accessed by one editor at a time.
            realms.ShowDialog();

            //While the editor is visible, just keep the App responsive.
            while (realms.Visible)
            {
                Application.DoEvents();
            }

            //Null the reference we have
            realms = null;

            //if no Realm was selected, warn the user that the Zone will be lost when the editor
            //is closed or a new room is loaded.
            if (Editor.CurrentRealm == null && Editor.CurrentZone != null)
            {
                MessageBox.Show("You have not selected a Realm to place this Zone within. It will not be saved if a Realm is not choosen from the Realm editor!", this.Text);
                return;
            }

            //Add the Room to the selected Zone.
            Editor.CurrentRealm.AddZone(Editor.CurrentZone, true);

            comRealms.SelectedItem = Editor.CurrentRealm.Name;
        }
Esempio n. 3
0
        private void zonesBtnAddZone_Click(object sender, EventArgs e)
        {
            //Ensure we have a Realm loaded.
            if (Editor.CurrentRealm == null)
            {
                //Will become true when a Realm is selected
                bool loaded = false;

                while (!loaded)
                {
                    //If the user doesn't want to load a Realm, we abort.
                    DialogResult results = MessageBox.Show("There is currently no Realm loaded.  Would you like to load one?", "Mud Designer Editor : Zones", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (results == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }
                    //Otherwise we display the Realms form and let them choose one.
                    else
                    {
                        frmRealms realms = new frmRealms();
                        realms.ChangingRealm = true;
                        realms.ShowDialog();
                        while (realms.Visible)
                        {
                            Application.DoEvents();
                        }
                        realms = null;
                        //If we now have a Realm, consider it true.
                        if (Editor.CurrentRealm != null)
                        {
                            loaded = true;
                        }
                    }
                }
            }

            //We need to make sure we never have a duplicate name.
            int    value     = 1;
            string newName   = "New Zone" + value;
            bool   validName = false;

            while (!validName)
            {
                //In the event this is the first Zone.
                //Prevents infinit loop
                if (Editor.CurrentRealm.Zones.Count == 0)
                {
                    validName = true;
                }

                foreach (var z in Editor.CurrentRealm.Zones)
                {
                    if (z.Name == newName)
                    {
                        value++;
                        newName = "New Zone" + value;
                    }
                    else
                    {
                        validName = true;
                    }
                }
            }

            IZone zone = (IZone)ScriptFactory.GetScript(EngineSettings.Default.ZoneScript, null);

            if (zone == null)
            {
                MessageBox.Show("There are currently no Zone scripts that exist.  Please create a script that inherits from MudDesigner.Engine.Environment.BaseZone", "Mud Designer Editor : Zone", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            zone.Name          = newName;
            Editor.CurrentZone = zone;
            Editor.CurrentRealm.AddZone(zone, true);

            zonesLstExistingZones.Items.Add(zone.Name);
            zonesLstExistingZones.SelectedItem = zone.Name;
        }
Esempio n. 4
0
        private void zonesBtnChangeRealm_Click(object sender, EventArgs e)
        {
            //Creates a new instance of the Realms editor
            frmRealms realms = new frmRealms();

            //We want to make sure and remove this Zone from its current Relam
            if (Editor.CurrentRealm != null)
                Editor.CurrentRealm.RemoveZone(Editor.CurrentZone);
            //Flag changing zone as true so users can double-click and close the editor
            realms.ChangingRealm = true;

            //Show it as a dialog. This prevents other editors from starting at the same time.
            //Ensures that the static Editor Type will only be accessed by one editor at a time.
            realms.ShowDialog();

            //While the editor is visible, just keep the App responsive.
            while (realms.Visible)
            {
                Application.DoEvents();
            }

            //Null the reference we have
            realms = null;

            //if no Realm was selected, warn the user that the Zone will be lost when the editor
            //is closed or a new room is loaded.
            if (Editor.CurrentRealm == null && Editor.CurrentZone != null)
            {
                MessageBox.Show("You have not selected a Realm to place this Zone within. It will not be saved if a Realm is not choosen from the Realm editor!", this.Text);
                return;
            }

            //Add the Room to the selected Zone.
            Editor.CurrentRealm.AddZone(Editor.CurrentZone, true);

            comRealms.SelectedItem = Editor.CurrentRealm.Name;
        }
Esempio n. 5
0
        private void zonesBtnAddZone_Click(object sender, EventArgs e)
        {
            //Ensure we have a Realm loaded.
            if (Editor.CurrentRealm == null)
            {
                //Will become true when a Realm is selected
                bool loaded = false;

                while (!loaded)
                {
                    //If the user doesn't want to load a Realm, we abort.
                    DialogResult results = MessageBox.Show("There is currently no Realm loaded.  Would you like to load one?", "Mud Designer Editor : Zones", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (results == System.Windows.Forms.DialogResult.No)
                        return;
                        //Otherwise we display the Realms form and let them choose one.
                    else
                    {
                        frmRealms realms = new frmRealms();
                        realms.ChangingRealm = true;
                        realms.ShowDialog();
                        while (realms.Visible)
                        {
                            Application.DoEvents();
                        }
                        realms = null;
                        //If we now have a Realm, consider it true.
                        if (Editor.CurrentRealm != null)
                            loaded = true;
                    }
                }
            }

            //We need to make sure we never have a duplicate name.
            int value = 1;
            string newName = "New Zone" + value;
            bool validName = false;

            while (!validName)
            {
                //In the event this is the first Zone.
                //Prevents infinit loop
                if (Editor.CurrentRealm.Zones.Count == 0)
                    validName = true;

                foreach (var z in Editor.CurrentRealm.Zones)
                {
                    if (z.Name == newName)
                    {
                        value++;
                        newName = "New Zone" + value;
                    }
                    else
                    {
                        validName = true;
                    }
                }
            }

            IZone zone = (IZone)ScriptFactory.GetScript(EngineSettings.Default.ZoneScript, null);

            if (zone == null)
            {
                MessageBox.Show("There are currently no Zone scripts that exist.  Please create a script that inherits from MudDesigner.Engine.Environment.BaseZone", "Mud Designer Editor : Zone", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            zone.Name = newName;
            Editor.CurrentZone = zone;
            Editor.CurrentRealm.AddZone(zone, true);

            zonesLstExistingZones.Items.Add(zone.Name);
            zonesLstExistingZones.SelectedItem = zone.Name;
        }
Esempio n. 6
0
        private void menuRealms_Click(object sender, EventArgs e)
        {
            //Create a new instance of the Realms editor.
            frmRealms realms = new frmRealms();

            //Show it as a dialog. This prevents other editors from starting at the same time.
            //Ensures that the static Editor Type will only be accessed by one editor at a time.
            realms.ShowDialog();

            //While the editor is visible, just keep the App responsive.
            while (realms.Visible)
            {
                Application.DoEvents();
            }

            //Null the reference we have.
            realms = null;
        }