Beispiel #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();
        }
Beispiel #2
0
        private void LoadLevelData(LevelParam LV, int worldID, int levelID)
        {
            currentWorld    = worldID - 1;
            currentLvlIndex = levelID;

            Loading = true;
            for (int i = 0; i < JapaneseStageTypes.Length; i++)
            {
                if (LV.StageType == JapaneseStageTypes[i])
                {
                    StageTypeComboBox.SelectedIndex = (int)comboSource[i];
                    break;
                }
            }
            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
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #5
0
 public void Remove(LevelParam levelParam)
 {
     levels.Remove(levelParam);
 }
Beispiel #6
0
 public int IndexOf(LevelParam levelParam) => levels.IndexOf(levelParam);
Beispiel #7
0
 public int UpdateLevelIndex(LevelParam levelParam)
 {
     levels.Remove(levelParam);
     return(Add(levelParam));
 }