コード例 #1
0
ファイル: ChessboardView.cs プロジェクト: ArthurHsieh/Konane
    public void ShowCheckerboard(Model.Chessboard checkerboardData, Controller.IChessboardNodeListener listener)
    {
        if (mBoardSize != checkerboardData.BoardSize)
        {
            mBoardSize = checkerboardData.BoardSize;
            m_GridLayoutGroup.cellSize        = m_Root.rect.size / checkerboardData.BoardSize;
            m_GridLayoutGroup.constraintCount = checkerboardData.BoardSize;
        }

        var nodesData = checkerboardData.Nodes;

        if (mNodes.Count < nodesData.Length)
        {
            LoadNodes(nodesData.Length - mNodes.Count);
        }

        for (int i = 0; i < mNodes.Count; ++i)
        {
            if (i < nodesData.Length)
            {
                if (!mNodes[i].gameObject.activeSelf)
                {
                    mNodes[i].gameObject.SetActive(true);
                }
                mNodes[i].SetNode(nodesData[i]);
                mNodes[i].SetListener(listener);
            }
            else
            {
                if (mNodes[i].gameObject.activeSelf)
                {
                    mNodes[i].gameObject.SetActive(false);
                }
            }
        }
    }
コード例 #2
0
 public static Chessboard GetChessboard(int boardSize, bool isVacancy = false)
 {
     mChessboard = new Chessboard(boardSize, isVacancy);
     return(mChessboard);
 }