Ejemplo n.º 1
0
    void SpriteList()
    {
        GUILayout.Label("Sprites", "HeaderLabel");

        bool hasMissingTextures = false;

        EditorGUI.BeginChangeCheck();

        MadGUI.Indent(() => {
            for (int i = 0; i < atlas.ListItems().Count; ++i)
            {
                MadAtlas.Item item = atlas.ListItems()[i];

                EditorGUILayout.BeginHorizontal();
                var texture = MadAtlasUtil.GetItemOrigin(item);
                bool valid  = MadGUI.Validate(() => texture != null, () => {
                    item.name = EditorGUILayout.TextField(item.name);
                });

                GUI.enabled = valid;
                GUI.color   = Color.yellow;
                if (GUILayout.Button("Ping", GUILayout.Width(40)))
                {
                    EditorGUIUtility.PingObject(texture);
                }
                GUI.enabled = true;

                GUI.color = Color.red;
                if (GUILayout.Button("X", GUILayout.Width(20)))
                {
                    MadAtlasBuilder.RemoveFromAtlas(atlas, item);
                }
                GUI.color = Color.white;

                EditorGUILayout.EndHorizontal();

                if (!valid)
                {
                    hasMissingTextures = true;
                }
            }

            if (hasMissingTextures)
            {
                MadGUI.Error("There are sprites with missing origin texture. This will for them to dissapear on edit.");
            }
        });

        if (EditorGUI.EndChangeCheck())
        {
            EditorUtility.SetDirty(atlas);
        }
    }
Ejemplo n.º 2
0
    void OnGUI()
    {
        var style = new GUIStyle(GUI.skin.label);

        style.fontSize         = 25;
        style.normal.textColor = Color.white;
        //style.fontStyle = FontStyle.Bold;
        GUI.color = new Color(1, 61 / 255f, 61 / 255f);
        GUI.DrawTexture(new Rect(0, 0, Screen.width, 50), Texture2D.whiteTexture);
        GUI.color = Color.white;
        GUILayout.Space(10);
        GUILayout.Label("Energy Bar Toolkit Upgrade Info", style);

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        style = new GUIStyle(GUI.skin.label);

        GUILayout.Label("Thank you for upgrading Energy Bar Toolkit to " + Version.current + "!");

        EditorGUILayout.Space();

        style.fontSize = 15;
        GUILayout.Label("Important!", style);

        MadGUI.Error("Remember to backup your project before upgrading Energy Bar Toolkit to newer version!");

        GUILayout.Label("Remember that...", style);

        MadGUI.Warning("If you see errors after upgrading Energy Bar Toolkit, please remove Energy Bar Toolkit " +
                       "directory and import it again.");

        MadGUI.Warning("OnGUI bars will not work with Unity 5 and those are no longer maintained.");

        GUILayout.Label("Tips", style);

        MadGUI.Info("Mesh bars are now deprecated. We strongly recommend to use new uGUI bars!");

        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginHorizontal();
        doNotShow = EditorGUILayout.ToggleLeft("Do not show again until next upgrade", doNotShow);
        if (GUILayout.Button("Changelog"))
        {
            Application.OpenURL(string.Format("http://energybartoolkit.madpixelmachine.com/doc/{0}/changelog.html", Version.current));
        }
        EditorGUILayout.EndHorizontal();
    }
Ejemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        serializedObject.UpdateIfDirtyOrScript();

        EditorGUILayout.IntSlider(valueCurrent, valueMin.intValue, valueMax.intValue, "Value Current");

        EditorGUILayout.Space();

        MadGUI.PropertyField(valueMin, "Value Min");
        MadGUI.PropertyField(valueMax, "Value Max");

        if (valueMin.intValue >= valueMax.intValue)
        {
            MadGUI.Error("Value Min should be lower than Value Max.");
        }

        serializedObject.ApplyModifiedProperties();
    }