コード例 #1
0
ファイル: CSongCategorizer.cs プロジェクト: da-ka/Vocaluxe
        private void _CreateCategories()
        {
            _AdjustCategoryNames();

            CCategory lastCategory = null;
            CCategory noCategory   = null;

            foreach (CSongPointer songPointer in CSongs.Sorter.SortedSongs)
            {
                if (songPointer.SortString != "")
                {
                    if (lastCategory == null || String.Compare(songPointer.SortString, lastCategory.Name, StringComparison.CurrentCultureIgnoreCase) != 0)
                    {
                        lastCategory = new CCategory(songPointer.SortString);
                        _Categories.Add(lastCategory);
                    }
                    lastCategory.Songs.Add(songPointer);
                }
                else
                {
                    if (noCategory == null)
                    {
                        noCategory = new CCategory(_GetNoCategoryName());
                        _Categories.Add(noCategory);
                    }
                    noCategory.Songs.Add(songPointer);
                }
            }
        }
コード例 #2
0
 private static int _GetCategoryNumber(CCategory category)
 {
     for (int i = 0; i < Categories.Count; i++)
     {
         if (Categories[i] == category)
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #3
0
        public static int GetRandomCategory()
        {
            if (_CategoriesForRandom.Count == 0)
            {
                UpdateRandomCategoryList();
            }

            if (_CategoriesForRandom.Count == 0)
            {
                return(-1);
            }

            CCategory category = _CategoriesForRandom[CGame.Rand.Next(0, _CategoriesForRandom.Count - 1)];

            _CategoriesForRandom.Remove(category);
            return(_GetCategoryNumber(category));
        }
コード例 #4
0
ファイル: CSongs.cs プロジェクト: HansMaiser/Vocaluxe
 private static int GetCategoryNumber(CCategory category)
 {
     for (int i = 0; i < Categories.Length; i++)
     {
         if (Categories[i] == category)
             return i;
     }
     return -1;
 }