Beispiel #1
0
        public StudyScoreExcessPercentCheckStep(IPlayContext context) : base(context)
        {
            var s = _context.Score;

            _context.Score.OnStudyScoreChanged    += AskForCheck;
            _context.Score.OnMaxStudyScoreChanged += AskForCheck;
        }
Beispiel #2
0
 public static List <BaseCheck> GetChecks(IPlayContext context)
 {
     return(new List <BaseCheck>()
     {
         new BaseCheck(ExclusionType.PersonalLife, new List <ICheckStep>
         {
             new StudyScoreExcessPercentCheckStep(context)
             {
                 Percent = 0.5
             },
             new PersonalLifeScoreShortagePercentCheckStep(context)
             {
                 Percent = 0.5, ExclusionProbability = 0.1
             },
         }),
         new BaseCheck(ExclusionType.PersonalLife, new List <ICheckStep>
         {
             new PersonalLifeScoreShortageCheckStep(context)
             {
                 MinScore = 0, ExclusionProbability = 1
             },
         })
         {
             Priority = 1
         },
         new NeedDeductionCheck(context)
         {
         },
     });
 }
Beispiel #3
0
 public Play(INumberGenerator numberGenerator, IPlayContext context)
 {
     _numberGenerator = numberGenerator;
     _context         = context;
     InitExamStore();
     //InitCheckStore();
 }
Beispiel #4
0
 public virtual T OnClickFunc(IPlayContext context = null)
 {
     OnClickEvent?.Invoke();
     if (ClickFuncReturn != null)
     {
         return(ClickFuncReturn.Invoke(context));
     }
     return(default(T));
 }
Beispiel #5
0
 public BaseExclusionCheck
 (
     IPlayContext context,
     IStore <BaseCheck> checks,
     IExclusionService exclusionStore
 )
 {
     _context        = context ?? throw new ArgumentNullException("Context must be not null");
     _exclusionStore = exclusionStore ?? throw new ArgumentNullException("Exclusion store must be not null");
     _generator      = new DefaultNumberGenerator();
     InitChecks(checks.GetAll());
 }
Beispiel #6
0
        public override ExamPage OnClickFunc(IPlayContext context = null)
        {
            base.OnClickFunc(context);
            if (NextPage != null)
            {
                NextPage.SetProbability(CurrProbability);
                return(NextPage);
            }

            var probability = _numberGenerator.NextDouble01();

            if (probability > CurrProbability || probability >= 0.999)
            {
                SuccessPage = SuccessPage ?? new ExamSuccessPage();
                return(SuccessPage);
            }

            FailPage = FailPage ?? new ExamFailPage();
            return(FailPage);
        }
Beispiel #7
0
 public NeedDeductionCheck(IPlayContext context)
 {
     _context = context;
     _context.Study.OnNeedExclusionChanged += NeedCheck;
 }
Beispiel #8
0
 public ChecksStore(INumberGenerator generator, IPlayContext context)
     : base(GetChecks(context), generator)
 {
 }
Beispiel #9
0
 public StudyScoreShortageCheckStep(IPlayContext context) : base(context)
 {
     _context.Score.OnStudyScoreChanged += AskForCheck;
 }
Beispiel #10
0
 public PlayEventsService(IPlayContext context, INumberGenerator generator, IPlayEventStore eventService)
 {
     _context       = context;
     _generator     = generator ?? new DefaultNumberGenerator();
     _eventsService = eventService ?? throw new ArgumentNullException();
 }
Beispiel #11
0
 public PersonalLifeScoreShortagePercentCheckStep(IPlayContext context) : base(context)
 {
     _context.Score.OnPersonalLifeScoreChanged    += AskForCheck;
     _context.Score.OnMaxPersonalLifeScoreChanged += AskForCheck;
 }
Beispiel #12
0
 public Controller(IPlayEventsService eventsStore, IPlayContext playContext, IPlayerInfoHolder playerHolder)
 {
     _eventsStore  = eventsStore;
     _context      = playContext;
     _playerHolder = playerHolder;
 }
Beispiel #13
0
 public ExamService(IPlayContext context, INumberGenerator generator, IStore <IExam> examStore)
 {
     _context   = context ?? throw new ArgumentNullException();
     _generator = generator ?? throw new ArgumentNullException();
     _examStore = examStore ?? throw new ArgumentNullException();
 }
Beispiel #14
0
 public BaseCheckStep(IPlayContext context)
 {
     _context = context;
 }
Beispiel #15
0
 public virtual bool IsAvailable(IPlayContext context = null)
 {
     return(IsAvailableFunc?.Invoke(context) ?? true);
 }
Beispiel #16
0
 public StudyScoreExcessCheckStep(IPlayContext context) : base(context)
 {
     _context.Score.OnPersonalLifeScoreChanged    += AskForCheck;
     _context.Score.OnMaxPersonalLifeScoreChanged += AskForCheck;
 }