// Show Window //------------------------------------------------------------------ public static object ShowDialog(apEditor editor, apBone bone, FUNC_DUPLICATE_BONE_RESULT funcResult) { CloseDialog(); if (editor == null || editor._portrait == null || editor._portrait._controller == null || bone == null || funcResult == null) { return(null); } EditorWindow curWindow = EditorWindow.GetWindow(typeof(apDialog_DuplicateBone), true, "Duplicate", true); apDialog_DuplicateBone curTool = curWindow as apDialog_DuplicateBone; object loadKey = new object(); if (curTool != null && curTool != s_window) { int width = 300; int height = 150; 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, bone, loadKey, funcResult); return(loadKey); } else { return(null); } }
// Init //------------------------------------------------------------------ public void Init(apEditor editor, apBone targetBone, object loadKey, FUNC_DUPLICATE_BONE_RESULT funcResult) { _editor = editor; _loadKey = loadKey; _targetBone = targetBone; _offsetX = 0.0f; _offsetY = 0.0f; _isDuplicateChildren = true; _funcResult = funcResult; }