Beispiel #1
0
        // Show Window / Close Dialog
        //------------------------------------------------------------------------
        public static object ShowDialog(apEditor editor, apBone targetBone, apMeshGroup targetMeshGroup, REQUEST_TYPE requestType, FUNC_SELECT_LINKED_BONE funcResult)
        {
            CloseDialog();

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

            string windowName = "";

            switch (requestType)
            {
            case REQUEST_TYPE.AttachChild:
                windowName = "Select a Bone as Child";
                break;

            case REQUEST_TYPE.ChangeParent:
                windowName = "Select a Bone as Parent";
                break;

            case REQUEST_TYPE.SelectIKTarget:
                windowName = "Select a Bone as IK Target";
                break;

            case REQUEST_TYPE.SelectIKPositionControllerEffector:
            case REQUEST_TYPE.SelectIKLookAtControllerEffector:
            case REQUEST_TYPE.SelectIKLookAtControllerStartBone:
                windowName = "Select a Bone as IK Effector";
                break;

            case REQUEST_TYPE.Mirror:
                windowName = "Select a Mirror Bone";
                break;
            }
            EditorWindow curWindow            = EditorWindow.GetWindow(typeof(apDialog_SelectLinkedBone), true, windowName, true);
            apDialog_SelectLinkedBone curTool = curWindow as apDialog_SelectLinkedBone;

            object loadKey = new object();

            if (curTool != null && curTool != s_window)
            {
                //기본 Dialog보다 조금 더 크다. Hierarchy 방식으로 가로 스크롤이 포함되기 때문
                int width  = 350;
                int height = 600;
                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, targetBone, targetMeshGroup, requestType, funcResult);

                return(loadKey);
            }
            else
            {
                return(null);
            }
        }
Beispiel #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;
            }
        }