コード例 #1
0
ファイル: SongInformation.cs プロジェクト: KHCmaster/PPD
        /// <summary>
        /// 難易度を変換します。
        /// </summary>
        /// <param name="difficulty">難易度。</param>
        /// <returns>利用可能な難易度。</returns>
        public static AvailableDifficulty ConvertDifficulty(Difficulty difficulty)
        {
            AvailableDifficulty diff = AvailableDifficulty.None;

            switch (difficulty)
            {
            case PPDFrameworkCore.Difficulty.Easy:
                diff = AvailableDifficulty.Easy;
                break;

            case PPDFrameworkCore.Difficulty.Normal:
                diff = AvailableDifficulty.Normal;
                break;

            case PPDFrameworkCore.Difficulty.Hard:
                diff = AvailableDifficulty.Hard;
                break;

            case PPDFrameworkCore.Difficulty.Extreme:
                diff = AvailableDifficulty.Extreme;
                break;
            }

            return(diff);
        }
コード例 #2
0
ファイル: ScriptListDockForm.cs プロジェクト: KHCmaster/PPD
        public void ReadScript(string projectDirPath, AvailableDifficulty difficulty, string disableList)
        {
            var queue = new Queue <TreeNode>();

            queue.Enqueue(ScriptNode);
            while (queue.Count > 0)
            {
                var node = queue.Dequeue();
                var dir  = Path.Combine(projectDirPath, String.Format("{0}_{1}", difficulty, node.FullPath));
                Utility.SafeCreateDirectory(dir);
                foreach (string childDir in Directory.GetDirectories(dir))
                {
                    queue.Enqueue(CreateFolderNode(node.Nodes, Path.GetFileName(childDir)));
                }

                foreach (string childFile in Directory.GetFiles(dir))
                {
                    if (Path.GetExtension(childFile).ToLower() == ".fsml")
                    {
                        CreateScriptNode(node.Nodes, Path.GetFileNameWithoutExtension(childFile));
                    }
                }
            }

            var disables = disableList.Split('|');

            foreach (string disable in disables)
            {
                var node = Utility.GetTreeNodeFromPath(treeView1.Nodes, disable);
                if (node != null)
                {
                    Win32.SetTreeViewOverlay(node, 1);
                }
            }
        }
コード例 #3
0
ファイル: SongInformation.cs プロジェクト: KHCmaster/PPD
        private static SongInformation FindSongInformationByHash(byte[] hash, AvailableDifficulty difficulty)
        {
            var queue = new Queue <SongInformation>();

            queue.Enqueue(Root);
            while (queue.Count > 0)
            {
                var info = queue.Dequeue();
                if (info.IsPPDSong)
                {
                    if (difficulty.HasFlag(AvailableDifficulty.Easy))
                    {
                        if (info.EasyHash != null && PPDDatabase.SameHash(hash, info.EasyHash))
                        {
                            return(info);
                        }
                    }
                    if (difficulty.HasFlag(AvailableDifficulty.Normal))
                    {
                        if (info.NormalHash != null && PPDDatabase.SameHash(hash, info.NormalHash))
                        {
                            return(info);
                        }
                    }
                    if (difficulty.HasFlag(AvailableDifficulty.Hard))
                    {
                        if (info.HardHash != null && PPDDatabase.SameHash(hash, info.HardHash))
                        {
                            return(info);
                        }
                    }
                    if (difficulty.HasFlag(AvailableDifficulty.Extreme))
                    {
                        if (info.ExtremeHash != null && PPDDatabase.SameHash(hash, info.ExtremeHash))
                        {
                            return(info);
                        }
                    }
                }
                else
                {
                    foreach (SongInformation child in info.Children)
                    {
                        queue.Enqueue(child);
                    }
                }
            }
            return(null);
        }
コード例 #4
0
        private void ChangeDifficultySound(AvailableDifficulty difficulty, int removedIndex)
        {
            var path = Path.Combine(WindowUtility.MainForm.CurrentProjectDir, String.Format("{0}.scd", difficulty));

            if (!File.Exists(path))
            {
                return;
            }
            var data = SCDReader.Read(path);

            SCDWriter.Write(path, data.Select(d =>
            {
                var newIndex = removedIndex == d.SoundIndex ? 0 : (d.SoundIndex > removedIndex ? d.SoundIndex - 1 : d.SoundIndex);
                return(new SCDData(d.Time, d.ButtonType, (ushort)newIndex));
            }).ToArray());
        }
コード例 #5
0
ファイル: MergeForm.cs プロジェクト: KHCmaster/PPD
        private void CheckEnable()
        {
            AvailableDifficulty mergeDifficulty = MergeDifficulty;

            button1.Enabled = mergeDifficulty != AvailableDifficulty.None && this.textBox1.Text != string.Empty;
            comboBox1.Items.Clear();
            foreach (AvailableDifficulty difficulty in EditorForm.DifficultyArray)
            {
                if (difficulty != AvailableDifficulty.None && (mergeDifficulty & difficulty) == difficulty)
                {
                    comboBox1.Items.Add(difficulty.ToString());
                }
            }
            if (comboBox1.Items.Count > 0 && comboBox1.SelectedIndex < 0)
            {
                comboBox1.SelectedIndex = 0;
            }
        }
コード例 #6
0
ファイル: SongInformation.cs プロジェクト: KHCmaster/PPD
        /// <summary>
        /// 利用可能な難易度を変換します。
        /// </summary>
        /// <param name="difficulty">利用可能な難易度。</param>
        /// <returns>難易度。</returns>
        public static Difficulty ConvertAvailable(AvailableDifficulty difficulty)
        {
            switch (difficulty)
            {
            case AvailableDifficulty.Easy:
                return(PPDFrameworkCore.Difficulty.Easy);

            case AvailableDifficulty.Normal:
                return(PPDFrameworkCore.Difficulty.Normal);

            case AvailableDifficulty.Hard:
                return(PPDFrameworkCore.Difficulty.Hard);

            case AvailableDifficulty.Extreme:
                return(PPDFrameworkCore.Difficulty.Extreme);
            }
            return(PPDFrameworkCore.Difficulty.Other);
        }
コード例 #7
0
ファイル: MergeForm.cs プロジェクト: KHCmaster/PPD
        public MergeInfo GetMergeInfo(AvailableDifficulty difficulty)
        {
            string projectPath    = "";
            AvailableDifficulty d = AvailableDifficulty.None;
            int version           = 0;

            switch (difficulty)
            {
            case AvailableDifficulty.Easy:
                projectPath = mergeGroupBox1.ProjectPath;
                d           = EditorForm.GetDifficultyFromString(mergeGroupBox1.ComboBox.SelectedItem.ToString());
                version     = mergeGroupBox1.ProjectVersion;
                break;

            case AvailableDifficulty.Normal:
                projectPath = mergeGroupBox2.ProjectPath;
                d           = EditorForm.GetDifficultyFromString(mergeGroupBox2.ComboBox.SelectedItem.ToString());
                version     = mergeGroupBox2.ProjectVersion;
                break;

            case AvailableDifficulty.Hard:
                projectPath = mergeGroupBox3.ProjectPath;
                d           = EditorForm.GetDifficultyFromString(mergeGroupBox3.ComboBox.SelectedItem.ToString());
                version     = mergeGroupBox3.ProjectVersion;
                break;

            case AvailableDifficulty.Extreme:
                projectPath = mergeGroupBox4.ProjectPath;
                d           = EditorForm.GetDifficultyFromString(mergeGroupBox4.ComboBox.SelectedItem.ToString());
                version     = mergeGroupBox4.ProjectVersion;
                break;

            case AvailableDifficulty.Base:
                projectPath = mergeGroupBox5.ProjectPath;
                d           = EditorForm.GetDifficultyFromString(mergeGroupBox5.ComboBox.SelectedItem.ToString());
                version     = mergeGroupBox5.ProjectVersion;
                break;

            case AvailableDifficulty.None:
                return(null);
            }
            return(new MergeInfo(projectPath, version, d));
        }
コード例 #8
0
ファイル: MergeInfo.cs プロジェクト: KHCmaster/PPD
 public MergeInfo(string projectPath, int version, AvailableDifficulty difficulty)
 {
     ProjectPath    = projectPath;
     Difficulty     = difficulty;
     ProjectVersion = version;
 }
コード例 #9
0
ファイル: ScriptManager.cs プロジェクト: KHCmaster/PPD
 public void ReadScript(string projectDirPath, AvailableDifficulty difficulty, string disableList)
 {
     scriptListForm.ReadScript(projectDirPath, difficulty, disableList);
 }