Esempio n. 1
0
        public static void Do(string[] args)
        {
            var caveBuilder = new RankingBoard.Builder(BoardType.Weekly);
            var ranking     = caveBuilder.SetName("cave").AddFixRewardProcess(builder =>
            {
                builder.UseMailDelivery();
                builder.SetMaxRank(100);
            }).AddPercentageRewardProcess(builder =>
            {
                builder.UseDirectDelivery();
                builder.SetExcludeMinRank(100);
            }).Build();

            var rankings = RankingCreator.Create(new RankingInfo[11]);
        }
Esempio n. 2
0
        public static IList <IRankingBoard> Create(RankingInfo[] infos)
        {
            var boards = new List <IRankingBoard>();

            foreach (var rankingInfo in infos)
            {
                var builder = new RankingBoard.Builder(rankingInfo.BoardType);
                foreach (var process in rankingInfo.RewardProcesses)
                {
                    switch (process.RewardProcessType)
                    {
                    case RewardProcessType.Fix:
                        builder.AddFixRewardProcess(processBuilder =>
                        {
                            UseDelivery(processBuilder, process).SetMaxRank(process.MaxRank)
                            .SetMinRank(process.MaxRank);
                        });
                        break;

                    case RewardProcessType.Percent:
                        builder.AddPercentageRewardProcess(processBuilder =>
                        {
                            UseDelivery(processBuilder, process).SetExcludeMinRank(process.MinRank);
                        });
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                var board = builder.SetName(rankingInfo.Name)
                            .SetExcludeRewardChannels(rankingInfo.ExcludeRewardChannelNames)
                            .SetSeasonEndDay(rankingInfo.SeasonEndDay).Build();

                boards.Add(board);
            }

            return(boards);
        }