示例#1
0
        private void comRealms_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comRealms.SelectedIndex == -1)
            {
                return;
            }

            IRealm realm = Editor.Game.World.GetRealm(comRealms.SelectedItem.ToString());

            string[] values    = null;
            bool     validPath = false;

            if (!String.IsNullOrEmpty(EngineSettings.Default.InitialRoom))
            {
                values = EngineSettings.Default.InitialRoom.Split('>');

                if (values.Length == 3)
                {
                    validPath = true;
                }
            }

            if (realm == null)
            {
                MessageBox.Show("There was an error retreiving the specified realm.", this.Text);
                return;
            }
            else
            {
                //Must be set prior to setting the index of the combo box
                SelectedRealm = realm;
            }

            IZone[] zones = realm.GetZones();

            if (zones == null)
            {
                return;
            }

            foreach (IZone zone in zones)
            {
                comZones.Items.Add(zone.Name);

                if (validPath)
                {
                    if (values[1] == zone.Name)
                    {
                        comZones.SelectedItem = zone.Name;
                    }
                }
            }

            if (comZones.Items.Count > 0)
            {
                comZones.SelectedIndex = 0;
            }
        }
示例#2
0
        private void comRealms_SelectedIndexChanged(object sender, EventArgs e)
        {
            zonesLstExistingZones.Items.Clear();

            IRealm realm = Editor.Game.World.GetRealm(comRealms.SelectedItem.ToString());

            if (realm == null)
            {
                MessageBox.Show("Realm does not exist!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Editor.CurrentRealm = realm;

            IZone[] zones = realm.GetZones();
            if (zones != null)
            {
                foreach (IZone zone in zones)
                {
                    zonesLstExistingZones.Items.Add(zone.Name);
                }
            }

            UpdateUI();
        }