Esempio n. 1
0
 private void PublishIsGameOver(bool isOver)
 {
     _isGameOver = isOver;
     MoveCommand.RaiseCanExecuteChanged();
     HintMoveCommand.RaiseCanExecuteChanged();
     GoForwardCommand.RaiseCanExecuteChanged();
     GoBackCommand.RaiseCanExecuteChanged();
     IsGameOverEvent_EA_PUB(isOver);
 }
Esempio n. 2
0
        private void MoveHelper(object param, bool isGoBackOrForth, Direction backOrForth)
        {
            try
            {
                var num = Convert.ToInt32(param);
                if (MainBoard.IsAllowSwitch(num))
                {
                    MainBoard.Switch(num);
                }
                else
                {
                    return;
                }

                HintTileProp = -1;
                if (!isGoBackOrForth)
                {
                    _isHint = true;
                    if (_breadCrumbsList.Count > _crumb)
                    {
                        _breadCrumbsList.RemoveRange(_crumb, _breadCrumbsList.Count - _crumb);
                    }
                    _breadCrumbsList.Add(num);
                }

                switch (backOrForth)
                {
                case Direction.BACK:
                    _crumb--;
                    TileClickEvent_EA_PUB(--_moveCnt);
                    break;

                case Direction.FORTH:
                    _crumb++;
                    TileClickEvent_EA_PUB(++_moveCnt);
                    break;
                }
            }
            catch (Exception) { }

            if (IsGameOver())
            {
                PublishIsGameOver(true);
            }
            else
            {
                HintMoveCommand.RaiseCanExecuteChanged();
                GoForwardCommand.RaiseCanExecuteChanged();
                GoBackCommand.RaiseCanExecuteChanged();
                MoveCommand.RaiseCanExecuteChanged();
            }
        }