Ejemplo n.º 1
0
    public static Color GetSkin(SkinTag tag)
    {
        if (!IsReady())
        {
            Debug.LogError("<b>[Skinning]</b> : skinning is not ready (skin data has not been assigned)");
            return(Color.black);
        }

        return(actual_skin.GetSkin(tag));
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        data = target as SkinData;

        if (!data.are_slots_valid)
        {
            data.FixSlots();
        }

        // container
        Vector2 container_size   = new Vector2(sample_square_size * 3 + spacing * 4, sample_square_size * 2 + spacing * 3);
        Vector2 container_offset = Vector2.one * edge_offset;

        EditorGUI.DrawRect(new Rect(container_offset, container_size), data.GetSkin(SkinTag.BACKGROUND));

        // samples
        float first  = edge_offset + spacing;
        float second = edge_offset + spacing * 2 + sample_square_size;
        float third  = edge_offset + spacing * 3 + sample_square_size * 2;

        EditorGUI.DrawRect(new Rect(Vector2.one * first, Vector2.one * sample_square_size), data.GetSkin(SkinTag.PICTO));
        EditorGUI.DrawRect(new Rect(Vector2.one * (first + (sample_square_size - (sample_square_size - border_size)) / 2), Vector2.one * (sample_square_size - border_size)), data.GetSkin(SkinTag.BACKGROUND));

        DrawSample(new Vector2(second, first), SkinTag.PRIMARY_WINDOW);
        DrawInset(new Vector2(second, first), SkinTag.PRIMARY_ELEMENT);

        DrawSample(new Vector2(third, first), SkinTag.SECONDARY_WINDOW);
        DrawInset(new Vector2(third, first), SkinTag.SECONDARY_ELEMENT);

        DrawSample(new Vector2(first, second), SkinTag.CONTRAST);

        DrawSample(Vector2.one * second, SkinTag.VALIDATE);
        DrawSample(new Vector2(third, second), SkinTag.DELETE);

        GUILayout.Space(container_size.y + edge_offset * 2);

        if (GUILayout.Button("Test Skin"))
        {
            TestSkin();
        }

        base.OnInspectorGUI();
    }
Ejemplo n.º 3
0
 void DrawSample(Vector2 offset, SkinTag tag)
 {
     EditorGUI.DrawRect(new Rect(offset.x, offset.y, sample_square_size, sample_square_size), data.GetSkin(tag));
 }