Exemplo n.º 1
0
        private void WorldIDNumericUpDown_ValueChanged(object sender, EventArgs e)
        {
            if (Loading)
            {
                return;
            }

            itemsByWorld[currentWorld] = null;

            LevelParam current = StageList.Worlds[currentWorld].Levels[currentLvlIndex];

            StageList.Worlds[currentWorld].RemoveAt(currentLvlIndex);

            currentWorld    = (int)WorldIDNumericUpDown.Value - 1;
            currentLvlIndex = StageList.Worlds[(int)WorldIDNumericUpDown.Value - 1].Add(current);
            Changed         = true;

            itemsByWorld[currentWorld] = null;

            LevelsListView.BeginUpdate();
            WorldComboBox.SelectedIndex = (int)WorldIDNumericUpDown.Value - 1;

            Loading = true;
            LevelsListView.SelectedItems.Clear();
            LevelsListView.Items[currentLvlIndex].Selected = true;
            Loading = false;
            LevelsListView.EndUpdate();

            UpdateCourseLabel();
        }
Exemplo n.º 2
0
        private void LoadLevelData(LevelParam LV, int worldID, int levelID)
        {
            currentWorld    = worldID - 1;
            currentLvlIndex = levelID;

            Loading = true;

            StageTypeComboBox.SelectedValue = LV.StageType;
            StageNameTextBox.Text           = LV.StageName;
            UpdateCourseLabel();
            WorldIDNumericUpDown.Value       = worldID;
            LevelIDNumericUpDown.Value       = LV.StageID;
            CourseIDNumericUpDown.Value      = LV.CourseID;
            TimerNumericUpDown.Value         = LV.Timer;
            GreenStarsNumericUpDown.Value    = LV.GreenStarNum;
            GreenStarLockNumericUpDown.Value = LV.GreenStarLock;
            DoubleMarioNumericUpDown.Value   = LV.DoubleMario;
            GhostBaseTimeNumericUpDown.Value = LV.GhostBaseTime;
            GhostIDNumericUpDown.Value       = LV.GhostID;

            if (LV.IllustItemNum == 1)
            {
                StampCheckBox.Checked = true;
            }
            else if (LV.IllustItemNum > 1)
            {
                throw new Exception();
            }
            else
            {
                StampCheckBox.Checked = false;
            }

            Loading = false;

            #region Enable the form
            StageTypeComboBox.Enabled          = true;
            StageNameTextBox.Enabled           = true;
            WorldIDNumericUpDown.Enabled       = true;
            LevelIDNumericUpDown.Enabled       = true;
            CourseIDNumericUpDown.Enabled      = true;
            TimerNumericUpDown.Enabled         = true;
            GreenStarsNumericUpDown.Enabled    = true;
            GreenStarLockNumericUpDown.Enabled = true;
            DoubleMarioNumericUpDown.Enabled   = true;
            GhostBaseTimeNumericUpDown.Enabled = true;
            GhostIDNumericUpDown.Enabled       = true;
            StampCheckBox.Enabled     = true;
            DeleteLevelButton.Enabled = true;
            #endregion
        }
Exemplo n.º 3
0
        public int Add(LevelParam levelParam)
        {
            int index = -1;

            for (int i = 0; i < levels.Count; i++)
            {
                if (levelParam.StageID >= levels[i].StageID)
                {
                    index = i;
                }
            }

            levels.Insert(index + 1, levelParam);

            return(index + 1);
        }
Exemplo n.º 4
0
        private void WorldComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int i = WorldComboBox.SelectedIndex;

            currentWorld = i;

            ListViewItem[] items = itemsByWorld[i];

            if (items == null)
            {
                items = new ListViewItem[StageList.Worlds[i].Levels.Count];

                int previousStageID = -1;

                for (int j = 0; j < StageList.Worlds[i].Levels.Count; j++)
                {
                    LevelParam levelParam = StageList.Worlds[i].Levels[j];

                    items[j] = new ListViewItem(new string[]
                    {
                        levelParam.StageID.ToString(),
                        Program.CurrentLanguage.GetTranslation(levelParam.StageName) ?? levelParam.StageName
                    })
                    {
                        Tag = StageList.Worlds[i].Levels[j]
                    };

                    if (previousStageID == levelParam.StageID)
                    {
                        items[j - 1].ForeColor = Color.Red;
                        items[j].ForeColor     = Color.Red;
                    }

                    previousStageID = levelParam.StageID;
                }

                itemsByWorld[i] = items;
            }

            LevelsListView.Items.Clear();
            LevelsListView.Items.AddRange(items);
        }
Exemplo n.º 5
0
 public void Remove(LevelParam levelParam)
 {
     levels.Remove(levelParam);
 }
Exemplo n.º 6
0
 public int IndexOf(LevelParam levelParam) => levels.IndexOf(levelParam);
Exemplo n.º 7
0
 public int UpdateLevelIndex(LevelParam levelParam)
 {
     levels.Remove(levelParam);
     return(Add(levelParam));
 }