コード例 #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (instance == null)
            {
                Awake();
            }

            GUI.changed = false;

            Undo.RecordObject(instance, "Collectible");

            EditorGUILayout.Space();


            //EditorGUILayout.HelpBox("Editing Collectible component using Inspector is not recommended.\nPlease use the editor window instead", MessageType.Info);
            if (GUILayout.Button("Collectible Editor Window"))
            {
                CollectibleEditorWindow.Init();
            }


            if (TDSEditor.IsPrefab(instance.gameObject))
            {
                if (!TDSEditor.ExistInDB(instance))
                {
                    EditorGUILayout.Space();

                    EditorGUILayout.HelpBox("This prefab hasn't been added to database hence it won't be accessible by other editor.", MessageType.Warning);
                    GUI.color = new Color(1f, 0.7f, .2f, 1f);
                    if (GUILayout.Button("Add Prefab to Database"))
                    {
                        CollectibleEditorWindow.Init();
                        CollectibleEditorWindow.NewItem(instance);
                        CollectibleEditorWindow.Init();                         //call again to select the instance in editor window
                    }
                    GUI.color = Color.white;
                }

                EditorGUILayout.Space();
            }

            EditorGUILayout.Space();

            DrawFullEditor();

            EditorGUILayout.Space();

            DefaultInspector();

            serializedObject.ApplyModifiedProperties();
            if (GUI.changed)
            {
                EditorUtility.SetDirty(instance);
            }
        }
コード例 #2
0
        public static void Init()
        {
            // Get existing open window or if none, make a new one:
            window         = (CollectibleEditorWindow)EditorWindow.GetWindow(typeof(CollectibleEditorWindow), false, "Collectible Editor");
            window.minSize = new Vector2(400, 300);
            //~ window.maxSize=new Vector2(375, 800);

            LoadDB();

            InitLabel();

            window.SetupCallback();

            window.OnSelectionChange();
        }
コード例 #3
0
        public static void Init()
        {
            // Get existing open window or if none, make a new one:
            window = (CollectibleEditorWindow)EditorWindow.GetWindow(typeof (CollectibleEditorWindow), false, "Collectible Editor");
            window.minSize=new Vector2(400, 300);
            //~ window.maxSize=new Vector2(375, 800);

            LoadDB();

            InitLabel();

            window.SetupCallback();

            window.OnSelectionChange();
        }
コード例 #4
0
 static void OpenCollectibleEditor()
 {
     CollectibleEditorWindow.Init();
 }