public override void OnGUI(Rect position) { string descriptionText = ((MyHeadAttribute)attribute).Description; MyEnumColor color = ((MyHeadAttribute)attribute).TextColor; int offsetX = ((MyHeadAttribute)attribute).OffsetX; position.y += 4f; position.x += offsetX; Color firstColor = GUI.color; GUI.color = MyColor.GetColor(color); MyGUI.Text(position, descriptionText); GUI.color = firstColor; }
public override void OnInspectorGUI() // 画 GUI { ProDraw(); if (Target.activeConfiguration) { GUILayout.Label("游戏使用该配置".AddYellow()); } else { EditorGUILayout.BeginHorizontal(); GUILayout.Label("游戏不是使用这个配置"); GUILayout.FlexibleSpace(); if (GUILayout.Button("使用该配置")) { SMSceneConfigurationUtil.EnsureActiveConfiguration(Target, true); SyncBuildSettingsIfRequired(); } EditorGUILayout.EndHorizontal(); } int workWidth = Screen.width / 3 - 34; WorkflowActionEnum targetWork = Target.actionAfterGroup; bool isLevel = targetWork == WorkflowActionEnum.LoadNextLevel; MyGUI.Heng(() => { MyGUI.Text("组结束,加载:"); MyGUI.Button(isLevel?"[下一关卡]".AddGreen(): "下一关卡".AddLightGreen(), workWidth, () => { if (!isLevel) { ChangeToWorkflowAction(WorkflowActionEnum.LoadNextLevel); } }); MyGUI.AddSpace(2); MyGUI.Button(isLevel ? "标记场景".AddLightGreen() : "[标记场景]".AddGreen(), workWidth, () => { if (isLevel) { ChangeToWorkflowAction(WorkflowActionEnum.LoadScreen); } }); MyGUI.AddSpace(); GUI.enabled = sceneListData.Selection.Count == 1; MyGUI.Button("打开", workWidth - 25, () => { OpenScene(sceneListData); }); GUI.enabled = true; }); MyCreate.Box(() => { sceneListHeight = CUResizableContainer.BeginVertical(sceneListHeight); sceneListData = CUListControl.SelectionList(sceneListData, scenes, sceneRenderer); CUResizableContainer.EndVertical(); bool isChooseScene = !sceneListData.Empty; GUI.enabled = isChooseScene; // 判断有没有点击场景 int width = Screen.width / 3 - 10; MyGUI.Heng(() => { MyGUI.Button(isChooseScene ? "关卡".AddGreen() : "关卡", width, ChangeToLevel); MyGUI.Button(isChooseScene ? "场景".AddOrange() : "关卡", width, ChangeToScreen); MyGUI.Button("Ignore", width, ChangeToIgnore); }); GUI.enabled = !sceneListData.Empty && IsScreen(scenes[sceneListData.First]);// 判断点击的场景是否标记 Screen MyCreate.Heng(() => { MyGUI.Button("开始场景", width, ChangeToFirstScreen); MyGUI.Button("关卡完成后场景", width, ChangeToFirstScreenAfterLevel); GUI.enabled = GUI.enabled && Target.actionAfterGroup == WorkflowActionEnum.LoadScreen;// 是否选择了标记场景 MyGUI.Button("完成组后场景", width, ChangeToFirstScreenAfterGroup); }); }); MyGUI.AddSpace(4); GUI.enabled = true; MyCreate.Box(() => { levelListHeight = CUResizableContainer.BeginVertical(levelListHeight); EditorGUILayout.BeginHorizontal(); groupListWidth = CUResizableContainer.BeginHorizontal(groupListWidth); int lastGroup = groupListData.First; groupListData = CUListControl.SelectionList(groupListData, Target.groups, groupRenderer, "组"); if (lastGroup != groupListData.First) { levelListData.ClearSelection(); } CUResizableContainer.EndHorizontal(); GUI.enabled = SelectedGroup != null; levelListData = CUListControl.SelectionList(levelListData, currentGroupLevels, levelRenderer, "关卡"); GUI.enabled = true; EditorGUILayout.EndHorizontal(); CUResizableContainer.EndVertical(); MyGUI.Heng(() => { MyGUI.Button("+", AddGroup); GUI.enabled = !groupListData.Empty && Target.groups.Length > 1; MyGUI.Button("-", RemoveGroup); GUI.enabled = !groupListData.Empty; MyGUI.Button("改名", RenameGroup); GUI.enabled = true; MyGUI.AddSpace(); GUI.enabled = !levelListData.Empty; MyGUI.Button("First", MoveToFirst); MyGUI.Button("↑", MoveUp); MyGUI.Button("↓", MoveDown); MyGUI.Button("Last", MoveToLast); GUI.enabled = true; }); }); }