Ejemplo n.º 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            SaveProperties();
            TableSerializer.Save("lstMaps", lstMaps.SaveState());

            if ((Loc.Pid != LoadedPid) && !LocParser.IsFreeLocationPID(Loc.Pid))
            {
                Message.Show("Location PID is already in use.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(Loc.Name))
            {
                Message.Show("You have to select a name for the location.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Loc.Maps.Count == 0)
            {
                Message.Show("The location has no maps.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Loc.Size == 0)
            {
                Message.Show("Location has no size.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            this.Close();
        }
Ejemplo n.º 2
0
        private void frmEditLocation_Load(object sender, EventArgs e)
        {
            this.olvMusic.AspectToStringConverter = delegate(object x)
            {
                List <String> MusicNames = (List <String>)x;
                return(String.Format("{0}", Utils.ToCSV(", ", MusicNames)));
            };

            if (!NewLoc)
            {
                this.Text              = "Location - " + Loc.Name + ", PID = " + Loc.Pid;
                txtName.Text           = Loc.Name;
                txtWMName.Text         = Loc.WorldMapName;
                txtDescription.Text    = Loc.WorldMapDescription;
                txtEntranceScript.Text = Loc.EntranceScript;
                txtEntrance.Text       = Loc.Entrance;
                txtSignImagePath.Text  = Loc.WorldMapSignImagePath;
                txtTownImagePath.Text  = Loc.WorldMapTownImagePath;
                numXPos.Value          = Loc.X;
                numYPos.Value          = Loc.Y;
                numSize.Value          = Loc.Size;
                numPID.Value           = Loc.Pid;
                numMaxCopies.Value     = Loc.MaxPlayers;
                chkGeck.Checked        = Loc.GeckVisible;

                chkVisible.Checked   = Loc.Visible;
                chkEncounter.Checked = Loc.AutoGarbage;

                numPID.Enabled       = false;
                btnAssignPID.Enabled = false;

                txtFlags.Lines = Loc.Flags.ToArray();

                if (String.IsNullOrEmpty(txtTownImagePath.Text))
                {
                    btnEditTownMap.Enabled = false;
                }

                if (!Loc.OnWorldmap)
                {
                    btnRemoveFromWM.Visible = false;
                }
            }
            else
            {
                this.Text = "Location";
                btnRemoveFromWM.Visible = false;
                Loc           = new Location();
                numPID.Value  = LocParser.GetFreeLocationPID(1);
                numSize.Value = 24;
                if (chkEncounter.Checked)
                {
                    numMaxCopies.Enabled = false;
                    txtEntrance.Enabled  = false;
                }
                numMaxCopies.Value = 1;
                txtEntrance.Text   = "1";

                Loc.Modified = true;
                Loc.Maps     = new List <Map>();
            }

            lstMaps.RestoreState(TableSerializer.Load("lstMaps"));
            lstMaps.Items.Clear();
            if (Loc.Maps == null)
            {
                return;
            }
            lstMaps.SetObjects(Loc.Maps);
        }
Ejemplo n.º 3
0
 private void frmEditMaps_Load(object sender, EventArgs e)
 {
     lstMaps.SetObjects(parser.GetMaps());
     lstMaps.RestoreState(TableSerializer.Load("lstMaps"));
 }
Ejemplo n.º 4
0
 private void btnDone_Click(object sender, EventArgs e)
 {
     TableSerializer.Save("lstMaps", lstMaps.SaveState());
     this.Close();
 }
Ejemplo n.º 5
0
 private void frmLocationEditor_Load(object sender, EventArgs e)
 {
     lstLocations.RestoreState(TableSerializer.Load("lstLocations"));
     lstLocations.SetObjects(Locations);
 }