public Result TryMakeTurn(int start, int end)
        {
            var gameTurn = GameTurnUtils.CreateTurnByTwoCells(_curField, Side, start, end);

            if (gameTurn == null || (gameTurn.IsSimple && _requiredJumps.Any()))
            {
                return(Result.Fail);
            }

            _turns.Add(gameTurn);

            GameFieldUtils.TryCreateField(_curField, gameTurn, out GameField newField);

            // Not the last jump
            if (!gameTurn.IsSimple && !gameTurn.IsLevelUp &&
                GameTurnUtils.FindTurnsForCell(newField, gameTurn.Steps.Last(), TurnType.Jump).Any())
            {
                _statusReporter.Status = $"{Side}: {Resources.WpfPlayer_JumpTurn_Continue}";

                DoJumpsContinue = true;

                _curField = newField;

                return(Result.Continue);
            }

            _sender?.Send(GameTurnUtils.CreateCompositeJump(_turns));

            return(Result.Ok);
        }
Esempio n. 2
0
        /// <summary>
        /// 处理POST请求
        /// </summary>
        protected override void ProcessPOST()
        {
            var extractor = GetParameterExtractor();

            object[] args = extractor.ParseArguments(this.PageContext);//提取方法参数

            var result = CallWebMethod(args);

            if (result != null)
            {
                IResultSender sender = GetResultSender();
                sender.Send(this.PageContext, result);
            }
        }
Esempio n. 3
0
 private void ProcessInternal(ProcessingElement element)
 {
     TryWhileNoSuccess(() => UpdateElementValue(element), 5);
     TryWhileNoSuccess(() => _resultSender.Send(element), 5);
 }