void OnGUI() { if (_instance) { _instance = this; //gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManagerT2>(); } CheckScenePath(); InitGUIStyle(); GUILayout.Space(20); GUILayout.Label("机构动作展示课件编辑器", titleLabelStyle0); GUILayout.Space(20); isShowMechanismControl = EditorGUILayout.Foldout(isShowMechanismControl, "机舱", titleLabelStyle1); // 定义折叠菜单 if (isShowMechanismControl) { GUILayout.BeginHorizontal(); { GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("导入驾驶舱界面", GUILayout.Height(20), GUILayout.Width(position.width * 0.2f))) { importCabinWindow = EditorWindow.GetWindow <ImportCabinWindow>(true, "导入机舱界面"); importCabinWindow.minSize = new Vector2(350, 100); importCabinWindow.maxSize = new Vector2(350, 100); importCabinWindow.position = new Rect(600, 400, 350, 100); importCabinWindow.Show(); } GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("添加控制按钮", GUILayout.Height(20), GUILayout.Width(position.width * 0.2f))) { addButtonPanel = EditorWindow.GetWindow <AddButtonPanel>(true, "添加控制按钮"); addButtonPanel.minSize = new Vector2(400, 400); addButtonPanel.maxSize = new Vector2(400, 400); addButtonPanel.position = new Rect(600, 400, 400, 400); addButtonPanel.Show(); } } GUILayout.EndHorizontal(); } GUILayout.Space(20); isShowModleImport = EditorGUILayout.Foldout(isShowModleImport, "模型导入", titleLabelStyle1); // 定义折叠菜单 if (isShowModleImport) { GUILayout.BeginHorizontal(); { GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("添加环境模型", GUILayout.Width(position.width * 0.2f))) { impotEnvironmentalModel = EditorWindow.GetWindow <ImpotEnvironmentalModel>(true, "导入机构模型"); impotEnvironmentalModel.minSize = new Vector2(350, 100); impotEnvironmentalModel.maxSize = new Vector2(350, 100); impotEnvironmentalModel.position = new Rect(600, 400, 350, 100); impotEnvironmentalModel.Show(); } GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("导入机构模型", GUILayout.Width(position.width * 0.2f))) { importMechanismModelWindow = EditorWindow.GetWindow <ImportMechanismModelWindow>(true, "导入机构模型"); importMechanismModelWindow.minSize = new Vector2(350, 100); importMechanismModelWindow.maxSize = new Vector2(350, 100); importMechanismModelWindow.position = new Rect(600, 400, 350, 100); importMechanismModelWindow.Show(); } } GUILayout.EndHorizontal(); } GUILayout.Space(20); isShowMechanismControl = EditorGUILayout.Foldout(isShowMechanismControl, "机构控制", titleLabelStyle1); // 定义折叠菜单 if (isShowMechanismControl) { GUILayout.BeginHorizontal(); { GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("机构运动控制分步模式", GUILayout.Width(position.width * 0.2f))) { addDriveWindow = EditorWindow.GetWindow <AddDriveWindow>(true, "机构运动控制分步模式"); addDriveWindow.minSize = new Vector2(400, 400); addDriveWindow.maxSize = new Vector2(400, 400); addDriveWindow.position = new Rect(600, 400, 400, 400); addDriveWindow.Show(); } GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("机构运动控制演示模式", GUILayout.Width(position.width * 0.2f))) { addAutoDriveWindow = EditorWindow.GetWindow <AddAotuDriveWindow>(true, "机构运动控制演示模"); addAutoDriveWindow.minSize = new Vector2(350, 130); addAutoDriveWindow.maxSize = new Vector2(350, 130); addAutoDriveWindow.position = new Rect(600, 400, 350, 130); addAutoDriveWindow.Show(); } } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); { GUILayout.Space(position.width * 0.1f); GUILayout.Label("控制流程"); GUILayout.Space(position.width * 0.1f); GUILayout.Label("零件名"); GUILayout.Space(position.width * 0.1f); GUILayout.Label("控制器"); } GUILayout.EndHorizontal(); GUILayout.Space(10); } GUILayout.Space(20); isShowDisassembly = EditorGUILayout.Foldout(isShowDisassembly, "拆卸安装", titleLabelStyle1); // 定义折叠菜单 if (isShowDisassembly) { GUILayout.BeginHorizontal(); { GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("添加拆装流程", GUILayout.Width(position.width * 0.2f))) { addDisassemblyWindow = EditorWindow.GetWindow <AddDisassemblyWindow>(true, "添加拆装流程"); addDisassemblyWindow.minSize = new Vector2(400, 400); addDisassemblyWindow.maxSize = new Vector2(400, 400); addDisassemblyWindow.position = new Rect(600, 400, 400, 400); addDisassemblyWindow.Show(); } GUILayout.Space(position.width * 0.2f); if (GUILayout.Button("删除拆装流程", GUILayout.Width(position.width * 0.2f))) { } } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); { GUILayout.Space(position.width * 0.1f); GUILayout.Label("拆装流程"); GUILayout.Space(position.width * 0.1f); GUILayout.Label("零件名"); GUILayout.Space(position.width * 0.1f); GUILayout.Label("拆装工具"); } GUILayout.EndHorizontal(); GUILayout.Space(10); /* * int dsCount = gm.disassemblySteps.Count; * for (int i = 0; i < dsCount; i++) * { * GUILayout.BeginHorizontal(); * { * string part_name = gm.disassemblySteps[i].PartName; * int toolIndex = gm.disassemblySteps[i].ToolIndex; * string show_name; * string tool_name = " "; * * if (part_name.Length > 15) * { * show_name = part_name.Substring(0, 10) + "..."; * } * else * { * show_name = part_name; * } * * if(toolIndex==0) * { * tool_name = "手"; * } * * if (toolIndex == 1) * { * tool_name = "螺丝刀"; * } * * if (toolIndex == 2) * { * tool_name = "扳手"; * } * * GUILayout.Space(position.width * 0.1f); * GUILayout.Label((i+1).ToString()); * GUILayout.Space(position.width * 0.1f); * GUILayout.Label(show_name); * GUILayout.Space(position.width * 0.1f); * GUILayout.Label(tool_name); * } * GUILayout.EndHorizontal(); * }*/ } GUILayout.Space(20); GUILayout.BeginHorizontal(); { GUILayout.Space(position.width * 0.375f); if (GUILayout.Button("保存场景", GUILayout.Width(position.width * 0.25f))) { EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene()); //输出拆装流程 } } GUILayout.EndHorizontal(); }
void Awake() { _instance = this; gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManagerT2>(); }