Ejemplo n.º 1
0
        private void AddLightsetButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameArtDirectory + "\\lightsets";

            d.Filter      = "ES Lightset File (*.gls)|*.gls";
            d.FilterIndex = 0;

            if (d.ShowDialog() == DialogResult.OK)
            {
                string filename = d.FileName.Replace(CoreGlobals.getWorkPaths().mGameArtDirectory, "");

                // Remove extension
                filename = filename.Remove(filename.Length - 4);

                //kill leading \\
                filename = filename.TrimStart(new char[] { '\\' });

                // Check to see if this is a duplicate
                if (!CoreGlobals.getGameResources().ContainsLightset(filename))
                {
                    // Add to data
                    EditorLightset set = CoreGlobals.getGameResources().AddLightset(filename);

                    // Pause painting
                    LightsetListBox.BeginUpdate();

                    // Add to list box
                    LightsetListBox.Items.Add(set.getIDString());

                    // Assign list box selection to the new objective
                    LightsetListBox.SelectedIndex = LightsetListBox.Items.IndexOf(filename);

                    // Resume painting
                    LightsetListBox.EndUpdate();
                }
                else
                {
                    MessageBox.Show("The Lightset you have selected is already on the list");
                }
            }

            SettingsChanged();
        }
Ejemplo n.º 2
0
        private void DeleteLightsetButton_Click(object sender, EventArgs e)
        {
            if (LightsetListBox.SelectedItem == null)
            {
                return;
            }

            // Delete objective from local list
            string name = LightsetListBox.SelectedItem.ToString().Split('#')[1];

            CoreGlobals.getGameResources().RemoveLightset(name);

            // Pause painting
            LightsetListBox.BeginUpdate();

            // Grab objective from list box
            object deletedLightset = LightsetListBox.SelectedItem;

            // Select the next Lightset in the list box
            if ((LightsetListBox.SelectedIndex + 1) < LightsetListBox.Items.Count)
            {
                LightsetListBox.SelectedIndex += 1;
            }
            else if (LightsetListBox.Items.Count >= 2)
            {
                LightsetListBox.SelectedIndex -= 1;
            }

            // Delete the objective from list box
            LightsetListBox.Items.Remove(deletedLightset);

            // Continue painting
            LightsetListBox.EndUpdate();

            SettingsChanged();
        }