/// <summary> /// Draw the reorderable list header with a variable category label. /// </summary> private void DrawAreaSettingsListHeader(Rect inRect, AreaSettingsCategory inCategory) { int previousIndentLevel = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; Rect maskIDRect, colorRect, areaNameRect; EditorHelper.VariableRect settingsRect; GetAreaSettingsListRects(inRect, out maskIDRect, out colorRect, out areaNameRect, out settingsRect); Rect areaLabelRect = new Rect(colorRect.x, colorRect.y, colorRect.width + areaNameRect.width, colorRect.height); // Shared labels. EditorGUI.LabelField(maskIDRect, new GUIContent("#", "The area's unique ID.")); EditorGUI.LabelField(areaLabelRect, "Area"); // Setting label. EditorGUI.LabelField(settingsRect.Full, AREA_SETTINGS_DROPDOWN_OPTIONS[(int)inCategory]); EditorGUI.indentLevel = previousIndentLevel; }
/// <summary> /// Draw a variable setting field depending on the passed in category. /// </summary> private void DrawAreaSetting(SerializedProperty inAreaSettingsProperty, EditorHelper.VariableRect inSettingsRect, AreaSettingsCategory inCategory) { switch (inCategory) { case AreaSettingsCategory.Speed: DrawSpeedSetting(inAreaSettingsProperty, inSettingsRect); break; case AreaSettingsCategory.AnimationTriggerName: DrawAnimationTriggerNameSetting(inAreaSettingsProperty, inSettingsRect); break; default: break; } }
/// <summary> /// Draw the reorderable list elements with a variable setting field depending on the passed in category. /// </summary> private void DrawAreaSettingsListElement(Rect inRect, int inIndex, bool inSelected, bool inFocused, AreaSettingsCategory inCategory) { int previousIndentLevel = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; SerializedProperty areaSettingsProperty = _areaSettingsListProperty.GetArrayElementAtIndex(inIndex); if (areaSettingsProperty == null) { return; } int areaIndex = areaSettingsProperty.FindPropertyRelative("AreaIndex").intValue; NavTileArea area = NavTileManager.Instance.AreaManager.AllAreas[areaIndex]; inRect.height -= 2; Rect maskIDRect, colorRect, areaNameRect; EditorHelper.VariableRect settingsRect; GetAreaSettingsListRects(inRect, out maskIDRect, out colorRect, out areaNameRect, out settingsRect); // Draw area info. EditorGUI.LabelField(maskIDRect, areaIndex.ToString()); EditorHelper.DrawRectWithOutline(colorRect, area.Color, new Color(area.Color.r / 4f, area.Color.g / 4f, area.Color.b / 4f), 1); EditorGUI.LabelField(areaNameRect, area.Name); DrawAreaSetting(areaSettingsProperty, settingsRect, inCategory); EditorGUI.indentLevel = previousIndentLevel; }