Exemplo n.º 1
0
 public GUISkinWrapper(GUISkin s)
 {
     this.skin = s;
     if(this.skin != null)
     {
         this.box = new SkinBG(this.skin.box.normal.background, this.skin.box.border);
         this.window = new SkinBG(this.skin.window.normal.background, this.skin.window.border);
         this.windowSelected = new SkinBG(this.skin.window.onNormal.background, this.skin.window.border);
         this.button = new SkinBG(this.skin.button.normal.background, this.skin.button.border);
         this.verticalScrollbar = new SkinBG(this.skin.verticalScrollbar.normal.background, this.skin.verticalScrollbar.border);
         this.verticalScrollbarThumb = new SkinBG(this.skin.verticalScrollbarThumb.normal.background, this.skin.verticalScrollbarThumb.border);
     }
 }
Exemplo n.º 2
0
Arquivo: Help.cs Projeto: x00568/Snake
 //关闭皮肤面板
 public void CloseSkin()
 {
     BG.SetActive(true);
     SkinBG.SetActive(false);
 }
Exemplo n.º 3
0
    public static Texture2D AddImageTexture(Texture2D texture, Rect bounds, SkinBG bg)
    {
        int yPos = (int)(texture.height-bounds.y-bounds.height);

        Color[] colors = null;
        if(bg.border.left > 0)
        {
            // bottom left
            texture.SetPixels((int)bounds.x, yPos, bg.border.left, bg.border.bottom,
                    TextureDrawer.PasteColors(
                        bg.bl, texture.GetPixels((int)bounds.x, yPos, bg.border.left, bg.border.bottom)));
            // left center
            colors = TextureDrawer.GetScaledColors(
                    bg.cl, bg.border.left, (int)(bg.size.y-bg.border.vertical), bg.border.left, (int)(bounds.height-bg.border.vertical));
            texture.SetPixels((int)bounds.x, yPos+bg.border.bottom, bg.border.left, (int)(bounds.height-bg.border.vertical),
                    TextureDrawer.PasteColors(colors,
                        texture.GetPixels((int)bounds.x, yPos+bg.border.bottom, bg.border.left, (int)(bounds.height-bg.border.vertical))));
            // top left
            texture.SetPixels((int)bounds.x, yPos+(int)(bounds.height-bg.border.top), bg.border.left, bg.border.top,
                    TextureDrawer.PasteColors(bg.tl, texture.GetPixels((int)bounds.x, yPos+(int)(bounds.height-bg.border.top), bg.border.left, bg.border.top)));
        }

        int hAdd = 0;
        //if(bg.border.right > 0) hAdd = 1;
        // bottom center
        colors = TextureDrawer.GetScaledColors(
                bg.bc, (int)(bg.size.x-bg.border.horizontal), bg.border.bottom, (int)(bounds.width-bg.border.horizontal+hAdd), bg.border.bottom);
        texture.SetPixels((int)(bounds.x+bg.border.left), yPos, (int)(bounds.width-bg.border.horizontal+hAdd), bg.border.bottom,
                TextureDrawer.PasteColors(colors,
                    texture.GetPixels((int)(bounds.x+bg.border.left), yPos, (int)(bounds.width-bg.border.horizontal+hAdd), bg.border.bottom)));

        // center center
        colors = TextureDrawer.GetScaledColors(
                bg.cc, (int)(bg.size.x-bg.border.horizontal), (int)(bg.size.y-bg.border.vertical),
                (int)(bounds.width-bg.border.horizontal+hAdd), (int)(bounds.height-bg.border.vertical));
        texture.SetPixels((int)bounds.x+bg.border.left, yPos+bg.border.bottom,
                (int)(bounds.width-bg.border.horizontal+hAdd), (int)(bounds.height-bg.border.vertical),
                TextureDrawer.PasteColors(colors,
                    texture.GetPixels((int)bounds.x+bg.border.left, yPos+bg.border.bottom,
                    (int)(bounds.width-bg.border.horizontal+hAdd), (int)(bounds.height-bg.border.vertical))));

        // top center
        colors = TextureDrawer.GetScaledColors(
                bg.tc, (int)(bg.size.x-bg.border.horizontal), bg.border.top, (int)(bounds.width-bg.border.horizontal+hAdd), bg.border.top);
        texture.SetPixels((int)bounds.x+bg.border.left, yPos+(int)(bounds.height-bg.border.top), (int)(bounds.width-bg.border.horizontal+hAdd), bg.border.top,
                TextureDrawer.PasteColors(colors,
                    texture.GetPixels((int)bounds.x+bg.border.left, yPos+(int)(bounds.height-bg.border.top),
                    (int)(bounds.width-bg.border.horizontal+hAdd), bg.border.top)));

        if(bg.border.right > 0)
        {
            // bottom right
            texture.SetPixels((int)(bounds.x+bounds.width-bg.border.right), yPos, bg.border.right, bg.border.bottom,
                    TextureDrawer.PasteColors(
                        bg.br, texture.GetPixels((int)(bounds.x+bounds.width-bg.border.right), yPos, bg.border.right, bg.border.bottom)));
            // right center
            colors = TextureDrawer.GetScaledColors(
                    bg.cr, bg.border.right, (int)(bg.size.y-bg.border.vertical), bg.border.right, (int)(bounds.height-bg.border.vertical));
            texture.SetPixels((int)(bounds.x+bounds.width-bg.border.right), yPos+bg.border.bottom, bg.border.right, (int)(bounds.height-bg.border.vertical),
                    TextureDrawer.PasteColors(colors,
                        texture.GetPixels((int)(bounds.x+bounds.width-bg.border.right),
                        yPos+bg.border.bottom, bg.border.right, (int)(bounds.height-bg.border.vertical))));
            // top right
            texture.SetPixels((int)(bounds.x+bounds.width-bg.border.right), yPos+(int)(bounds.height-bg.border.top), bg.border.right, bg.border.top,
                    TextureDrawer.PasteColors(
                        bg.tr, texture.GetPixels((int)(bounds.x+bounds.width-bg.border.right), yPos+(int)(bounds.height-bg.border.top), bg.border.right, bg.border.top)));
        }

        return texture;
    }
Exemplo n.º 4
0
Arquivo: Help.cs Projeto: x00568/Snake
 //打开皮肤面板
 public void OpenSkin()
 {
     BG.SetActive(false);
     SkinBG.SetActive(true);
 }