Пример #1
0
        public MainPage()
        {
            InitializeComponent();

            NavigateNewBattleField.Subscribe(_ =>
            {
                reversi.Board.Init();
                BlackCounter.InIt();
                WhiteCounter.InIt();
                BoardUI.BoardPlayers         = reversi.Board.Board;
                BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
                BoardUI.ReRendering();
                CPUPieceCount.Value    = reversi.Board.CountWhiteColor();
                PlayerPieceCount.Value = reversi.Board.CountBlackColor();
            });
            NavigateHome.Subscribe(_ => this.Frame.Navigate(typeof(HomePage)));
            NavigateBattleResult.Subscribe(_ => this.Frame.Navigate(typeof(BattleResultPage), new ScoreData(reversi.Board.CountBlackColor(), reversi.Board.CountWhiteColor())));

            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile")
            {
            }

            BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
            BoardUI.BoardPlayers         = reversi.Board.Board;
            BoardUI.ReRendering();
            CPUPieceCount.Value    = reversi.Board.CountWhiteColor();
            PlayerPieceCount.Value = reversi.Board.CountBlackColor();

            IntelliService = new CPU(reversi.Board);
        }
Пример #2
0
        private async void NewGameStart(object sender, RoutedEventArgs e)
        {
            var Dialog = new MessageDialog("新規ゲームを開始しますか?");

            Dialog.Commands.Add(new UICommand("はい", null, true));
            Dialog.Commands.Add(new UICommand("いいえ", null, false));
            var dialogResult = await Dialog.ShowAsync();

            if (!(bool)dialogResult.Id)
            {
                return;
            }
            reversi.Board.Init();
            BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
            RefreshInfomatinText();
            BoardUI.ReRendering();
        }
Пример #3
0
        private void SetColor(Tuple <int, int> point)
        {
            effect.Play();
            reversi.SetStone(point.Item1, point.Item2, Player.NowPlayer);
            Player.ChangePlayer();
            BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
            BoardUI.ReRendering();
            RefreshInfomatinText();
            var latestInput = new ColorData(new Tuple <int, int>(point.Item1, point.Item2), 0);

            BoardUI.BeforeInputColor = latestInput;
            BattleLog.Add(new BattleLoginTurn {
                player = Player.NowPlayer, PositionList = reversi.Board.GetPieceReversiAllDirection(point.Item1, point.Item2, Player.NowPlayer)
            });

            CPUPieceCount.Value    = reversi.Board.CountWhiteColor();
            PlayerPieceCount.Value = reversi.Board.CountBlackColor();
        }
Пример #4
0
        private async Task GameEndProcess()
        {
            if (!WhiteCounter.IsContinue() || !BlackCounter.IsContinue() || (reversi.Board.CountNoneColor() == 0))
            {
                await
                ShowDialog(
                    $"ゲームが終了しました。\n プレイヤー:{reversi.Board.CountBlackColor()}  CPU:{reversi.Board.CountWhiteColor()}");

                var scoreData = new ScoreData(reversi.Board.CountBlackColor(), reversi.Board.CountWhiteColor());
                await new ScoreClient().AddScore(scoreData);
                reversi.Board.Init();
                BlackCounter.InIt();
                WhiteCounter.InIt();
                BoardUI.BoardPlayers         = reversi.Board.Board;
                BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
                BoardUI.ReRendering();
                NavigateBattleResult.Subscribe();
            }
        }