예제 #1
0
    public void GetColorsFromChilds()
    {
        if (hasColors)
        {
            return;
        }
        if (childs == null || childs.Any(c => c == null || c.status != OnlineMapsTileStatus.loaded))
        {
            return;
        }

        const int s  = OnlineMapsUtils.tileSize;
        const int hs = s / 2;

        _colors = new Color[OnlineMapsUtils.sqrTileSize];

        for (int i = 0; i < 4; i++)
        {
            int            cx   = i / 2;
            int            cy   = 1 - i % 2;
            OnlineMapsTile tile = childs[i];
            if (tile == null)
            {
                OnlineMapsUtils.ApplyColorArray(ref _colors, cx * hs, cy * hs, hs, hs, ref defaultColors, cx * hs, cy * hs);
            }
            else
            {
                OnlineMapsUtils.ApplyColorArray2(ref _colors, cx * hs, cy * hs, hs, hs, ref tile._colors);
            }
        }
        hasColors = true;
    }