示例#1
0
        public int MapPriority(PartyMember member, JobSort sortStrategy = JobSort.TanksFirst)
        {
            var main = App.Jobs.GetMainJob(member);
            var sub  = App.Jobs.GetMainJob(member);

            if (sortStrategy == JobSort.TanksFirst)
            {
                return
                    (new[] { "PLD", "RUN", "WHM" }.Contains(main) ? 1 :
                     new[] { "SCH", "RDM", "BRD", "BLM" }.Contains(main) ? 2 :
                     new[] { "NIN" }.Contains(sub) ? 3 : 4);
            }
            else if (sortStrategy == JobSort.HealersFirst)
            {
                return
                    (new[] { "WHM", "SCH", "RDM" }.Contains(main) ? 1 :
                     new[] { "PLD", "RUN" }.Contains(main) ? 2 :
                     new[] { "BRD", "BLM" }.Contains(main) ? 3 :
                     new[] { "NIN" }.Contains(sub) ? 4 : 5);
            }
            else if (sortStrategy == JobSort.MeleeFirst)
            {
                return
                    (new[] { "MNK", "SAM", "WAR", "DRK", "DRG" }.Contains(main) ? 1 :
                     new[] { "BRD", "COR", "THF", "NIN" }.Contains(main) ? 2 :
                     new[] { "PLD", "RUN" }.Contains(main) ? 3 : 4);
            }
            else
            {
                return(1);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine($"Input your jobs here line by line in this formt \"a => b\" " +
                              $"(type {EXIT_STRING} to terminate & porcess the jobs): ");
            var jobs = new List <string>();
            // reading job list entries
            string line;

            while ((line = Console.ReadLine()) != null)
            {
                if (line.ToUpper() == EXIT_STRING)
                {
                    Console.WriteLine("Processing jobs, and the output is:");
                    break;
                }
                jobs.Add(line);
            }
            var jobSorter = new JobSort();

            Console.WriteLine(jobSorter.ProcessJobs(jobs.ToArray()));
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
示例#3
0
 private static IOrderedEnumerable <PlayerViewModel> SortByJobInternal(IEnumerable <PlayerViewModel> players, JobSort sortStrategy)
 {
     return(players.OrderBy(p => p.AppData.Jobs.MapPriority(p.Member, sortStrategy)));
 }
示例#4
0
 public static IOrderedEnumerable <PlayerViewModel> SortByJob(this IEnumerable <PlayerViewModel> players, JobSort sortStrategy = JobSort.TanksFirst)
 {
     return(memoizedSortByJobInternal(players, sortStrategy));
 }
示例#5
0
 public void Setup()
 {
     JobSorterObject = new JobSort();
 }