Esempio n. 1
0
    public void ResizeBlock()
    {
        int hsep = (int)container.Get("custom_constants/hseparation");
        int vsep = (int)container.Get("custom_constants/vseparation");

        // assuming heps are always the same for now, since it has to be a square
        if (hsep == 0)
        {
            blockSize.x = this.GetSize().x / width;
            blockSize.y = this.GetSize().y / height;
        }
        else
        {
            blockSize.x = (this.GetSize().x) / width - hsep;
            blockSize.y = (this.GetSize().y) / height - vsep;
        }

        for (int i = 0; i < width * height; i++)
        {
            ColorRect rect = container.GetChild(i) as ColorRect;
            rect.SetCustomMinimumSize(blockSize);
        }
    }