예제 #1
0
 public static void Write(this BinaryWriter writer, HallOfFameBrowser.HallOfFameSorter sorter)
 {
     Log.Detail("writing sorter " + sorter.GetScene() + ": " + sorter.GetMode() + " > " + sorter.GetDirection() + " - stats=" + sorter.GetStatsPredicate() + ", skill=" + sorter.GetSkillPredicate());
     writer.Write((Int64)sorter.GetScene());
     writer.Write((Int16)sorter.GetMode());
     writer.Write((Int16)sorter.GetDirection());
     writer.Write((Int16)sorter.GetStatsPredicate());
     writer.Write((Int16)sorter.GetSkillPredicate());
 }
예제 #2
0
 public HallOfFameBrowser.HallOfFameSorter GetHallOfFameSorterForScene(GameScenes scene)
 {
     HallOfFameBrowser.HallOfFameSorter sorter = hallOfFameSorter[scene];
     if (sorter != null)
     {
         return(sorter);
     }
     hallOfFameSorter[scene] = new HallOfFameBrowser.HallOfFameSorter(scene);
     return(hallOfFameSorter[scene]);
 }
예제 #3
0
            private void ReadHallOfFameSorter(BinaryReader reader)
            {
                Log.Detail("reading hall of fame sorter from config");
                Int16 cnt = (Int16)reader.ReadInt16();

                for (int i = 0; i < cnt; i++)
                {
                    HallOfFameBrowser.HallOfFameSorter sorter = reader.ReadSorter();
                    if (sorter != null)
                    {
                        hallOfFameSorter[sorter.GetScene()] = sorter;
                        Log.Detail("hall of fame display sorter loaded: " + sorter);
                    }
                }
            }
예제 #4
0
            public static HallOfFameBrowser.HallOfFameSorter ReadSorter(this BinaryReader reader)
            {
                long sceneCode = reader.ReadInt64();

                HallOfFameBrowser.HallOfFameSorter.SortDirection sortDirection =
                    (HallOfFameBrowser.HallOfFameSorter.SortDirection)reader.ReadInt16();
                HallOfFameBrowser.HallOfFameSorter.SortMode      mode = (HallOfFameBrowser.HallOfFameSorter.SortMode)reader.ReadInt16();
                HallOfFameBrowser.HallOfFameSorter.SortableStats sortableStatsSort =
                    (HallOfFameBrowser.HallOfFameSorter.SortableStats)reader.ReadInt16();
                HallOfFameBrowser.HallOfFameSorter.SortableSkills skill_sort =
                    (HallOfFameBrowser.HallOfFameSorter.SortableSkills)reader.ReadInt16();
                //
                GameScenes scene = (GameScenes)sceneCode;

                //
                // check values
                // TODO: remove magic numbers
                if ((int)sortDirection > 2 || (int)sortDirection < 1)
                {
                    sortDirection = HallOfFameBrowser.HallOfFameSorter.SortDirection.Ascending;
                }
                if ((int)mode > 2 || (int)mode < 1)
                {
                    mode = HallOfFameBrowser.HallOfFameSorter.SortMode.Stat;
                }
                if ((int)sortableStatsSort > 9 || (int)sortableStatsSort < 1)
                {
                    sortableStatsSort = HallOfFameBrowser.HallOfFameSorter.SortableStats.Name;
                }
                if ((int)skill_sort > 4 || (int)skill_sort < 1)
                {
                    skill_sort = HallOfFameBrowser.HallOfFameSorter.SortableSkills.Specialist;
                }
                if (Log.IsLogable(Log.LEVEL.DETAIL))
                {
                    Log.Detail("Sorter fro scene " + scene + ": SortDirection=" + sortDirection + " / mode=" + mode + " / stats=" +
                               sortableStatsSort + " / skill=" + skill_sort);
                }
                //
                HallOfFameBrowser.HallOfFameSorter sorter = new HallOfFameBrowser.HallOfFameSorter(scene, sortDirection, mode,
                                                                                                   sortableStatsSort, skill_sort);
                return(sorter);
            }
예제 #5
0
            public static HallOfFameBrowser.HallOfFameSorter ReadSorter(this BinaryReader reader)
            {
                long sceneCode = reader.ReadInt64();

                HallOfFameBrowser.HallOfFameSorter.DIRECTION     direction  = (HallOfFameBrowser.HallOfFameSorter.DIRECTION)reader.ReadInt16();
                HallOfFameBrowser.HallOfFameSorter.SORT_MODE     mode       = (HallOfFameBrowser.HallOfFameSorter.SORT_MODE)reader.ReadInt16();
                HallOfFameBrowser.HallOfFameSorter.STATS_SORTING stats_sort = (HallOfFameBrowser.HallOfFameSorter.STATS_SORTING)reader.ReadInt16();
                HallOfFameBrowser.HallOfFameSorter.SKILL_SORTING skill_sort = (HallOfFameBrowser.HallOfFameSorter.SKILL_SORTING)reader.ReadInt16();
                //
                GameScenes scene = (GameScenes)sceneCode;

                //
                // check values
                // TODO: remove magic numbers
                if ((int)direction > 2 || (int)direction < 1)
                {
                    direction = HallOfFameBrowser.HallOfFameSorter.DIRECTION.ASCENDING;
                }
                if ((int)mode > 2 || (int)mode < 1)
                {
                    mode = HallOfFameBrowser.HallOfFameSorter.SORT_MODE.STATISTIC;
                }
                if ((int)stats_sort > 9 || (int)stats_sort < 1)
                {
                    stats_sort = HallOfFameBrowser.HallOfFameSorter.STATS_SORTING.NAME;
                }
                if ((int)skill_sort > 4 || (int)skill_sort < 1)
                {
                    skill_sort = HallOfFameBrowser.HallOfFameSorter.SKILL_SORTING.SPECIALIST;
                }
                if (Log.IsLogable(Log.LEVEL.DETAIL))
                {
                    Log.Detail("Sorter fro scene " + scene + ": direction=" + direction + " / mode=" + mode + " / stats=" + stats_sort + " / skill=" + skill_sort);
                }
                //
                HallOfFameBrowser.HallOfFameSorter sorter = new HallOfFameBrowser.HallOfFameSorter(scene, direction, mode, stats_sort, skill_sort);
                return(sorter);
            }
 public HallOfFameBrowser.HallOfFameSorter GetHallOfFameSorterForScene(GameScenes scene)
 {
    HallOfFameBrowser.HallOfFameSorter sorter = hallOfFameSorter[scene];
    if (sorter != null) return sorter;
    hallOfFameSorter[scene] = new HallOfFameBrowser.HallOfFameSorter(scene);
    return hallOfFameSorter[scene];
 }