public static void DrawMenuView(Menu menu) { menu.RefreshViewPanels(); if (menu.DefaultSettings.AttachUI) { AUITool.AttachRectTransform(menu.gameObject); if (menu.HorizontalPanel != null) { AUITool.AttachRectTransform(menu.HorizontalPanel); } if (menu.VerticalPanel != null) { AUITool.AttachRectTransform(menu.VerticalPanel); } } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Orientation:", GUILayout.Width(SMALL_WIDTH)); menu.OrientationStyle = (EMenuOrientationStyle)EditorGUILayout.EnumPopup(menu.OrientationStyle, GUILayout.Width(LARGE_WIDTH)); EditorGUILayout.EndHorizontal(); GUILayout.Space(SMALL_VERTICAL_OFFSET); switch (menu.OrientationStyle) { case EMenuOrientationStyle.Both: DrawOrientationBlock(menu, menu.DefaultSettings.RealOrientation); DrawOrientationBlock(menu, menu.DefaultSettings.RealOrientation == ERealOrientation.Horizontal ? ERealOrientation.Vertical : ERealOrientation.Horizontal); break; case EMenuOrientationStyle.Horizontal: DrawOrientationBlock(menu, ERealOrientation.Horizontal); menu.CurrentOrientation = ERealOrientation.Horizontal; break; case EMenuOrientationStyle.Vertical: DrawOrientationBlock(menu, ERealOrientation.Vertical); menu.CurrentOrientation = ERealOrientation.Vertical; break; } if (menu.HorizontalPanel != null) { if (menu.HorizontalPanel.layer != menu.gameObject.layer) { menu.HorizontalPanel.layer = menu.gameObject.layer; } } if (menu.VerticalPanel != null) { if (menu.VerticalPanel.layer != menu.gameObject.layer) { menu.VerticalPanel.layer = menu.gameObject.layer; } } }
override public void OnInspectorGUI() { serializedObject.Update(); GUILayout.Space(AEditorValues.LARGE_OFFSET); _current.DefaultSettings.DrawInspector(); SortAllMenuOrientation(); if (_current.DefaultSettings.AttachUI) { AUITool.AttachRectTransform(_current.gameObject); } GUILayout.Space(AEditorValues.MIN_OFFSET); AEditorTool.DrawSeparator(AEditorTool.SeparationStyle.Default); GUILayout.Space(AEditorValues.LARGE_OFFSET); AEditorTool.DrawListButtons(_current.MenuList, "Add new menu", AddMenu, "Clear menu list", ClearMenuList); GUILayout.Space(AEditorValues.LARGE_OFFSET); _current.MenuList = _current.MenuList.Where(x => x != null).ToList(); UpdateNames(); for (int i = 0; i < _current.Count; i++) { DrawMenuView(_current[i], i); } _sortModule.SortInvoke(_current.MenuList); _current.UpdateActiveMenuState(); AEditorTool.DrawSeparator(AEditorTool.SeparationStyle.Default); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Save menu names in enum " + BaseEngineConstants.MenuDataEnumForMenu); EditorGUILayout.EndHorizontal(); AEditorTool.DrawListButtons(_current.MenuList, "Clear all names", ClearMenuData, "Apply menu names", SaveMenuData); this.SaveGuiChanges(); }