コード例 #1
0
        private void LunchGame(object sender, RoutedEventArgs e)
        {
            if (RacePlayer1.Text == RacePlayer2.Text)
            {
                MessageBoxResult msg = MessageBox.Show("Players must have different races");
                return;
            }
            GameCreator gc = new GameCreator();

            gc.setPeopleJ1(RacePlayer1.Text);
            gc.setPeopleJ2(RacePlayer2.Text);
            GameBuilder gb;

            switch (TypeOfGame.Text)
            {
            case "Demo Game":
                gb = new DemoGameBuilder();
                break;

            case "Small Game":
                gb = new SmallGameBuilder();
                break;

            case "Classic Game":
                gb = new ClassicGameBuilder();
                break;

            default:
                gb = new DemoGameBuilder();
                break;
            }

            gc.gameBuilder = gb;
            gc.createGame();
            parent.game = gc.getGame();

            parent.game.list_players[0].name = NamePlayer1.Text;
            parent.game.list_players[1].name = NamePlayer2.Text;

            PageGame pg   = new PageGame();
            score    scJ1 = new score(parent.game.list_players[0]);
            score    scJ2 = new score(parent.game.list_players[1]);

            parent.center.Navigate(pg);
            parent.ScoreJ1.Navigate(scJ1);
            parent.ScoreJ2.Navigate(scJ2);
            parent.ScoreJ1.Visibility = Visibility.Visible;
            parent.ScoreJ2.Visibility = Visibility.Visible;
            parent.listScore.Add(scJ1);
            parent.listScore.Add(scJ2);
        }
コード例 #2
0
        public unsafe void TestDemoBuilder()
        {
            GameCreator gc = new GameCreator();

            gc.setPeopleJ1("elf");
            gc.setPeopleJ2("human");
            GameBuilder gb = new DemoGameBuilder();

            gc.gameBuilder = gb;
            gc.createGame();
            Game game = gc.getGame();

            Assert.AreEqual(game.maxTurnNumber, 5);
        }
コード例 #3
0
ファイル: GameLogic.cs プロジェクト: alecmilne/LineFill-Unity
    void Start()
    {
        gameArraySize.x = gameArrayWidth;
        gameArraySize.y = gameArrayHeight;

        screenSize = new IntVector2(Screen.width, Screen.height);

        float blockWidthTemp  = screenSize.x / gameArraySize.x;
        float blockHeightTemp = screenSize.y / gameArraySize.y;

        float minTemp = Mathf.Min(blockWidthTemp, blockHeightTemp);

        blockPixelSize.x = Mathf.RoundToInt(Mathf.Floor(minTemp));
        blockPixelSize.y = Mathf.RoundToInt(Mathf.Floor(minTemp));



        blockArrayHolder = new GameObject("blockArrayHolder");
        blockArrayHolder.transform.SetParent(this.transform);

        gameCreator = new GameCreator();

        gameCreator.createGame(this.transform, blockArrayHolder.transform, gameArraySize, texCircle, texLine, texDashed, texBlock, texClear, blockPixelSize, screenSize, percentFree);
    }