Example #1
0
        // Show Window
        //--------------------------------------------------------------
        public static object ShowDialog(apEditor editor, bool isPresetTarget, string msg, bool isNoneSelectable, FUNC_SELECT_MATERIALSET_RESULT funcResult, object savedObject)
        {
            CloseDialog();

            if (editor == null || editor._portrait == null || editor.MaterialLibrary == null)
            {
                return(null);
            }

            EditorWindow curWindow             = EditorWindow.GetWindow(typeof(apDialog_SelectMaterialSet), true, "Select Material Set", true);
            apDialog_SelectMaterialSet curTool = curWindow as apDialog_SelectMaterialSet;

            object loadKey = new object();

            if (curTool != null && curTool != s_window)
            {
                int width  = 250;
                int height = 400;
                s_window          = curTool;
                s_window.position = new Rect((editor.position.xMin + editor.position.xMax) / 2 - (width / 2),
                                             (editor.position.yMin + editor.position.yMax) / 2 - (height / 2),
                                             width, height);
                s_window.Init(editor, loadKey, isPresetTarget, msg, isNoneSelectable, funcResult, savedObject);

                return(loadKey);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        private static void CloseDialog()
        {
            if (s_window != null)
            {
                try
                {
                    s_window.Close();
                }
                catch (Exception ex)
                {
                    Debug.LogError("Close Exception : " + ex);
                }

                s_window = null;
            }
        }