Пример #1
0
 public SUILoaderInfo(int id, string path, int layer, bool pre_loader, bool destroy, eAligeType alige)
 {
     mID          = id;
     mPathName    = path;
     mLayer       = layer;
     mIsPreLoader = pre_loader;
     mHideDestroy = destroy;
     mAlige       = alige;
 }
Пример #2
0
    public void setup(int numRows, int numCols, float gridW = 1, float gridH = 1, float pickW = 1, float pickH = 1, eAligeType alige = eAligeType.LEFT_BOTTOM)
    {
        m_numRows        = numRows;
        m_numCols        = numCols;
        m_gridWidth      = gridW;
        m_gridHeight     = gridH;
        m_gridPickWidth  = pickW;
        m_gridPickHeight = pickH;
        m_numPickCols    = (int)((m_numCols * m_gridWidth) / m_gridPickWidth);
        m_numPickRows    = (int)((m_numRows * m_gridHeight) / m_gridPickHeight);
        m_alige          = alige;

        m_nodes = new PathGrid[m_numRows, m_numCols];
        for (int row = 0; row < m_numRows; row++)
        {
            for (int col = 0; col < m_numCols; col++)
            {
                m_nodes[row, col] = new PathGrid(row, col, m_gridWidth, m_gridHeight);
                switch (m_alige)
                {
                case eAligeType.LEFT_BOTTOM:
                {    //(0,0)格子在左下方
                    float x = -(numCols * gridW) * 0.5f + m_nodes[row, col].rect.x;
                    float y = -(numRows * gridH) * 0.5f + m_nodes[row, col].rect.y;
                    m_nodes[row, col].setPosition(x, y);
                }
                break;

                case eAligeType.LEFT_TOP:
                {    //(0,0)格子在左上方
                    float x = m_nodes[row, col].rect.x;
                    float y = m_nodes[row, col].rect.y;
                    m_nodes[row, col].setPosition(x, y);
                }
                break;
                }
            }
        }
    }