コード例 #1
0
 public void DisallowUnpersistPieceWithCredits()
 {
     Session.BeginUpdate();
     Assert.Throws <ConstraintException>(() =>
                                         Piece1.Unpersist(Session));
     Session.Commit();
 }
コード例 #2
0
        /// <summary>
        /// Create a piece by index
        /// </summary>
        /// <param name="pieceShape"></param>
        /// <returns>Returns the generated Piece</returns>
        private IPiece PieceShapeColor(int pieceShape)
        {
            Piece1 p1 = new Piece1();

            p1.NumberOfBits = 4;
            if (pieceShape == 0)
            {
                p1.Color      = Brushes.CornflowerBlue;
                p1.BitOfShape = new List <Rectangle>();
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X3Y0").ToList());
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X3Y1").ToList());
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X4Y1").ToList());
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X4Y0").ToList());
                p1.NoRotate = true;
                p1.BitOfShape.ForEach(p => p.Fill = p1.Color);
            }
            if (pieceShape == 1)
            {
                p1.Color      = Brushes.Black;
                p1.BitOfShape = new List <Rectangle>();
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X3Y18").ToList());
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X3Y19").ToList());
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X4Y19").ToList());
                p1.BitOfShape.AddRange(GameBoard.Children.OfType <Rectangle>().Where(x => x.Name == "id" + playerID + "X4Y18").ToList());
                p1.NoRotate = true;
                p1.BitOfShape.ForEach(p => p.Fill = p1.Color);
            }
            return(p1);
        }
コード例 #3
0
ファイル: Move.cs プロジェクト: AlexeyBuryanov/Checkers
        } // CheckJump


        public override bool Equals(System.Object obj)
        {
            if (!(obj is Move move)) {
                return false;
            } // if

            return Piece1.Equals(move.Piece1) && Piece2.Equals(move.Piece2);
        } // Equals
コード例 #4
0
    void Start()
    {
        p1 = (Piece1)FindObjectOfType(typeof(Piece1));
        p2 = (Piece2)FindObjectOfType(typeof(Piece2));
        p3 = (Piece3)FindObjectOfType(typeof(Piece3));
        p4 = (Piece4)FindObjectOfType(typeof(Piece4));

        button.SetActive(false);
    }
コード例 #5
0
        private void GameCanvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
        {
            Gsm.GSM();
            //Player pieces intitialized
            Piece1 greenPiece1 = new Piece1(155, 35, "green", PieceImage, true);

            args.DrawingSession.DrawImage(Scaling.Img(BG));

            if (gameState == 1)
            {
                args.DrawingSession.DrawImage(Scaling.Img(greenPiece1.Image(PieceImage)), (greenPiece1.PieceX * scaleWidth) - (30 * scaleWidth), (greenPiece1.PieceY * scaleHeight) - (30 * scaleHeight));
            }

            GameCanvas.Invalidate();
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: JnS-Software-LLC/CSC153
        /// <summary>
        /// set up module for pieces and location
        /// </summary>
        private void setUp()
        {
            try
            {
                tangrampuzzle[0] = new Piece1(color[0]);
                tangrampuzzle[1] = new Piece2(color[1]);
                tangrampuzzle[2] = new Piece3(color[2]);
                tangrampuzzle[3] = new Piece4(color[3]);
                tangrampuzzle[4] = new Piece5(color[4]);
                tangrampuzzle[5] = new Piece6(color[5]);
                tangrampuzzle[6] = new Piece7(color[6]);

                for (int i = 0; i < tangrampuzzle.Length; i++)
                {

                    this.region[i] = tangrampuzzle[i].getRegion();
                    this.color[i] = tangrampuzzle[i].getColor();
                }
            }
            catch (Exception ex)
            {

                System.Windows.MessageBox.Show(ex.Message, "Can not create the pieces.");
                throw;
            }
        }
コード例 #7
0
    private void CreateAllPieces()
    {
        var player = PlayerType.Player1;

        Pieces1 = new PieceBase[15];
        for (int i = 0; i < 5; i++)
        {
            Pieces1[i]       = new Piece1(player, i);
            PiecesObject1[i] = ObjectCreator.CreateInObject(PlayerGameObject[0], piecePrefabs[0]).GetComponent <PieceProvider>();
            PiecesObject1[i].SetPieceUIInfo(player, i, PieceType.Piece1);
        }
        for (int i = 5; i < 9; i++)
        {
            Pieces1[i]       = new Piece2(player, i);
            PiecesObject1[i] = ObjectCreator.CreateInObject(PlayerGameObject[0], piecePrefabs[1]).GetComponent <PieceProvider>();
            PiecesObject1[i].SetPieceUIInfo(player, i, PieceType.Piece2);
        }
        for (int i = 9; i < 12; i++)
        {
            Pieces1[i]       = new Piece3(player, i);
            PiecesObject1[i] = ObjectCreator.CreateInObject(PlayerGameObject[0], piecePrefabs[2]).GetComponent <PieceProvider>();
            PiecesObject1[i].SetPieceUIInfo(player, i, PieceType.Piece3);
        }
        for (int i = 12; i < 14; i++)
        {
            Pieces1[i]       = new Piece4(player, i);
            PiecesObject1[i] = ObjectCreator.CreateInObject(PlayerGameObject[0], piecePrefabs[3]).GetComponent <PieceProvider>();
            PiecesObject1[i].SetPieceUIInfo(player, i, PieceType.Piece4);
        }
        Pieces1[14]       = new Piece5(player, 14);
        PiecesObject1[14] = ObjectCreator.CreateInObject(PlayerGameObject[0], piecePrefabs[4]).GetComponent <PieceProvider>();
        PiecesObject1[14].SetPieceUIInfo(player, 14, PieceType.Piece5);

        player  = PlayerType.Player2;
        Pieces2 = new PieceBase[15];
        for (int i = 0; i < 5; i++)
        {
            Pieces2[i]       = new Piece1(player, i);
            PiecesObject2[i] = ObjectCreator.CreateInObject(PlayerGameObject[1], piecePrefabs[5]).GetComponent <PieceProvider>();
            PiecesObject2[i].SetPieceUIInfo(player, i, PieceType.Piece1);
        }
        for (int i = 5; i < 9; i++)
        {
            Pieces2[i]       = new Piece2(player, i);
            PiecesObject2[i] = ObjectCreator.CreateInObject(PlayerGameObject[1], piecePrefabs[6]).GetComponent <PieceProvider>();
            PiecesObject2[i].SetPieceUIInfo(player, i, PieceType.Piece2);
        }
        for (int i = 9; i < 12; i++)
        {
            Pieces2[i]       = new Piece3(player, i);
            PiecesObject2[i] = ObjectCreator.CreateInObject(PlayerGameObject[1], piecePrefabs[7]).GetComponent <PieceProvider>();
            PiecesObject2[i].SetPieceUIInfo(player, i, PieceType.Piece3);
        }
        for (int i = 12; i < 14; i++)
        {
            Pieces2[i]       = new Piece4(player, i);
            PiecesObject2[i] = ObjectCreator.CreateInObject(PlayerGameObject[1], piecePrefabs[8]).GetComponent <PieceProvider>();
            PiecesObject2[i].SetPieceUIInfo(player, i, PieceType.Piece4);
        }
        Pieces2[14]       = new Piece5(player, 14);
        PiecesObject2[14] = ObjectCreator.CreateInObject(PlayerGameObject[1], piecePrefabs[9]).GetComponent <PieceProvider>();
        PiecesObject2[14].SetPieceUIInfo(player, 14, PieceType.Piece5);

        PutKings();
    }
コード例 #8
0
ファイル: Piece1Test.cs プロジェクト: JnS-Software-LLC/CSC153
 public void Piece1ConstructorTest()
 {
     Brush color = null; // TODO: Initialize to an appropriate value
     Piece1 target = new Piece1(color);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }