public override void OnInspectorGUI()
    {
        tk2dSpriteAnimation anim = (tk2dSpriteAnimation)target;

        GUILayout.Space(8);
        if (anim != null)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Open Editor...", GUILayout.MinWidth(120)))
            {
                tk2dSpriteAnimationEditorPopup v = EditorWindow.GetWindow(typeof(tk2dSpriteAnimationEditorPopup), false, "SpriteAnimation") as tk2dSpriteAnimationEditorPopup;
                v.SetSpriteAnimation(anim);
                v.Show();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        if (viewData)
        {
            GUILayout.BeginVertical("box");
            DrawDefaultInspector();
            GUILayout.EndVertical();
        }

        GUILayout.Space(64);
    }
示例#2
0
    public static void Edit()
    {
        var go   = Selection.activeGameObject;
        var gen  = go?.GetComponent <tk2dSpriteCollection>();
        var anim = go?.GetComponent <tk2dSpriteAnimation>();

        if (gen != null)
        {
            tk2dSpriteCollectionEditorPopup v = EditorWindow.GetWindow(typeof(tk2dSpriteCollectionEditorPopup), false, "SpriteCollection") as tk2dSpriteCollectionEditorPopup;
            v.SetGenerator(gen);
            v.Show();
        }
        if (anim != null)
        {
            tk2dSpriteAnimationEditorPopup v = EditorWindow.GetWindow(typeof(tk2dSpriteAnimationEditorPopup), false, "SpriteAnimation") as tk2dSpriteAnimationEditorPopup;
            v.SetSpriteAnimation(anim);
            v.Show();
        }
    }