示例#1
0
 public void show()
 {
     for (int i = 0; i < shopItems.Length; i++)
     {
         WindowControls.Register(shopItems[i].button);
     }
 }
示例#2
0
        public Tile(int iX, int iY, int iWid, int iHei, GameBoard board, ButtonStyle tileStyle) : base(iX, iY, iWid, iHei, " ", tileStyle)
        {
            ownerBoard     = board;
            highlightAlpha = 128;
            highlightColor = 0xFFFFFFFF;

            clickedAction = tileClicked;
            WindowControls.Register(this);
        }
    void HideCancel(WindowControls controls)
    {
        CustomButton cancel = controls.cancel;

        if (cancel?.gameObject?.activeSelf == false)
        {
            return;
        }

        cancel.gameObject.SetActive(false);
    }
    void HideDone(WindowControls controls)
    {
        CustomButton done = controls.done;

        if (done != null)
        {
            if (done.gameObject.activeSelf)
            {
                done.gameObject.SetActive(false);
            }
        }
    }
    // Start is called before the first frame update
    void Awake()
    {
        InitWindows();

        if (windows.Count > 0)
        {
            CustomButton back = windows[0].windowControls.back;
            if (back.gameObject.activeSelf)
            {
                back.gameObject.SetActive(false);
            }

            Window lastWindow = windows[windows.Count - 1];

            CustomButton next = lastWindow.windowControls.next;
            if (next.gameObject.activeSelf)
            {
                next.gameObject.SetActive(false);
            }

            windows.ForEach(w => {
                if (w.gameObject.activeSelf || w.GetComponent <CanvasGroup>().alpha != 0)
                {
                    w.Hide(true);
                }

                WindowControls controls = w?.windowControls;
                SetMainActions(controls);

                if (hideAllCancels)
                {
                    HideCancel(controls);
                }
                else
                {
                    controls.cancel.onClick.AddListener(() => cancel?.Invoke());
                }

                HideDone(controls);
            });

            CustomButton doneButton = lastWindow?.windowControls.done;
            doneButton?.gameObject.SetActive(true);

            lastWindow?.windowControls?.done.onClick.AddListener(() =>
            {
                done?.Invoke();
                lastWindow.Hide();
                currentWindow = null;
            });
        }
    }
    void SetMainActions(WindowControls controls)
    {
        CustomButton next = controls.next;
        CustomButton back = controls?.back;

        if (next.gameObject.activeSelf)
        {
            next.onClick.AddListener(Next);
        }

        if (back.gameObject.activeSelf)
        {
            back.onClick.AddListener(Previous);
        }
    }
示例#7
0
 public void enableBoard(bool isEnabled)
 {
     for (int iX = 0; iX < TILES_WIDE; iX++)
     {
         for (int iY = 0; iY < TILES_HIGH; iY++)
         {
             if (isEnabled)
             {
                 WindowControls.Register(gameBoard[iX, iY]);
             }
             else
             {
                 WindowControls.Unregister(gameBoard[iX, iY]);
             }
         }
     }
 }
示例#8
0
        private void terminateWindow()
        {
            for (int i = 0; i < shopItems.Length; i++)
            {
                WindowControls.Unregister(shopItems[i].button);
            }

            isShowing = false;
            tempBoard.enableBoard(true);

            for (int i = 0; i < shopItems.Length; i++)
            {
                if (images[i] != null)
                {
                    fbgfx.DestroyPNG(images[i]);
                }
            }
        }
示例#9
0
        // Initalize the graphics resources
        static void initalize()
        {
            createFonts();

            // Calculate the gameboard size
            int boardSzX = (int)(SCREEN_WIDTH / 2f);
            int boardSzY = (int)(SCREEN_WIDTH / 2f);

            // Create the gameboard
            boardX = SCREEN_WIDTH / 2 - boardSzX / 2;
            boardY = (int)(SCREEN_HEIGHT / 2.5) - boardSzY / 2;
            board  = new GameBoard(boardX, boardY, boardSzX, boardSzY);


            // Calculate the region bounds
            boardRegion  = new Region(boardX, boardY, boardX + boardSzX, boardY + boardSzY);
            topRegion    = new Region(0, 0, SCREEN_WIDTH, boardRegion.top);
            bottomRegion = new Region(0, boardRegion.bottom, SCREEN_WIDTH, SCREEN_HEIGHT);
            leftRegion   = new Region(0, topRegion.bottom, boardRegion.left, bottomRegion.top);
            rightRegion  = new Region(boardRegion.right, topRegion.bottom, SCREEN_WIDTH, bottomRegion.top);

            int btnEndTurnSize = 100;

            btnEndTurn = new GameButton(bottomRegion.left, bottomRegion.top, btnEndTurnSize, btnEndTurnSize, "END TURN", changeTurn);
            WindowControls.Register(btnEndTurn);

            players[0]    = new Player(100);
            currentPlayer = players[0];

            players[1]             = new Player(100);
            players[1].isAltPlayer = true;            //plag set

            PieceShop playerShop0 = new PieceShop("res//shopE.png", 99, players[0], SCREEN_WIDTH, SCREEN_HEIGHT, new Pos(0, 0), 0xFFDDE000);
            PieceShop playerShop1 = new PieceShop("res//shop.png", 99, players[1], SCREEN_WIDTH, SCREEN_HEIGHT, new Pos(0, 0), 0xFFDDE000);

            players[0].addPiece(0, 0, playerShop0, board);
            players[1].addPiece(0, 0, playerShop1, board);

            players[0].addPiece(0, 5, new Piece("res//queenE.png", 10, players[0], Piece.MOVEMODE.QUEEN), board);
        }