in SupportingScripts/Editor/Scripts/MapRendererEditor.cs [263:479]
public override void OnInspectorGUI()
{
Initialize();
var mapRenderer = (MapRenderer)target;
serializedObject.UpdateIfRequiredOrScript();
EditorGUI.indentLevel++;
// Location Section
EditorGUILayout.BeginVertical(_boxStyle);
_showLocationOptions = EditorGUILayout.Foldout(_showLocationOptions, "Location", true, _foldoutTitleStyle);
if (_showLocationOptions)
{
var latitudeProperty = _centerProperty.FindPropertyRelative("_latitude");
latitudeProperty.doubleValue = EditorGUILayout.DoubleField("Latitude", latitudeProperty.doubleValue);
var longitudeProperty = _centerProperty.FindPropertyRelative("_longitude");
longitudeProperty.doubleValue = EditorGUILayout.DoubleField("Longitude", longitudeProperty.doubleValue);
EditorGUILayout.Slider(_zoomLevelProperty, MapConstants.MinimumZoomLevel, MapConstants.MaximumZoomLevel);
// Get the zoomlevel values
var minZoomLevel = _minZoomLevelProperty.floatValue;
var maxZoomLevel = _maxZoomLevelProperty.floatValue;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Zoom Level Range");
EditorGUI.indentLevel--;
minZoomLevel = EditorGUILayout.FloatField((float)Math.Round(minZoomLevel, 2), _minMaxLabelsLayoutOptions);
EditorGUILayout.MinMaxSlider(ref minZoomLevel, ref maxZoomLevel, MapConstants.MinimumZoomLevel, MapConstants.MaximumZoomLevel);
maxZoomLevel = EditorGUILayout.FloatField((float)Math.Round(maxZoomLevel, 2), _minMaxLabelsLayoutOptions);
EditorGUI.indentLevel++;
EditorGUILayout.EndHorizontal();
// Update it back
_minZoomLevelProperty.floatValue = minZoomLevel;
_maxZoomLevelProperty.floatValue = maxZoomLevel;
GUILayout.Space(4);
}
EditorGUILayout.EndVertical();
// Map Layout Section
EditorGUILayout.BeginVertical(_boxStyle);
_showLayoutOptions = EditorGUILayout.Foldout(_showLayoutOptions, "Map Layout", true, _foldoutTitleStyle);
if (_showLayoutOptions)
{
// Map Shape Controls
GUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Map Shape");
_mapShapeProperty.enumValueIndex = GUILayout.Toolbar(_mapShapeProperty.enumValueIndex, _shapeOptions);
GUILayout.EndHorizontal();
GUILayout.Space(6f);
if (_mapShapeProperty.enumValueIndex == (int)MapShape.Block)
{
EditorGUILayout.PropertyField(_localMapDimensionProperty);
EditorGUILayout.LabelField(" ", "Scaled Map Dimension: " + mapRenderer.MapDimension.ToString());
}
else if (_mapShapeProperty.enumValueIndex == (int)MapShape.Cylinder)
{
EditorGUILayout.PropertyField(_localMapRadiusProperty);
EditorGUILayout.LabelField(" ", "Scaled Map Radius: " + (mapRenderer.MapDimension.x / 2.0f).ToString());
}
GUILayout.Space(6f);
EditorGUILayout.PropertyField(_localMapBaseHeightProperty);
EditorGUILayout.LabelField(" ", "Scaled Map Base Height: " + mapRenderer.MapBaseHeight.ToString());
GUILayout.Space(6f);
// Map Collider Type Controls
GUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Map Collider Type");
_mapColliderTypeProperty.enumValueIndex = GUILayout.Toolbar(_mapColliderTypeProperty.enumValueIndex, _colliderOptions);
GUILayout.EndHorizontal();
GUILayout.Space(6f);
}
EditorGUILayout.EndVertical();
// Render Settings Section
EditorGUILayout.BeginVertical(_boxStyle);
_showRenderingOptions = EditorGUILayout.Foldout(_showRenderingOptions, "Render Settings", true, _foldoutTitleStyle);
if (_showRenderingOptions)
{
// Map Terrain Type Controls
GUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Map Terrain Type");
_mapTerrainType.enumValueIndex = GUILayout.Toolbar(_mapTerrainType.enumValueIndex, _layerOptions);
GUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_elevationScaleProperty);
EditorGUILayout.PropertyField(_castShadowsProperty, _castShadowsLabel);
EditorGUILayout.PropertyField(_receiveShadowsProperty, _receiveShadowsLabel);
EditorGUILayout.PropertyField(_enableMrtkMaterialIntegrationProperty, _enableMrtkIntegrationLabel);
{
var useCustomTerrainMaterial = EditorGUILayout.Toggle("Use Custom Terrain Material", _useCustomTerrainMaterial);
if (_useCustomTerrainMaterial && !useCustomTerrainMaterial)
{
// If the we were previously using a custom material, and have switched back to the default materials,
// reset the material to null which will cause the MapRenderer to reload the default material.
_terrainMaterialProperty.objectReferenceValue = null;
}
if (useCustomTerrainMaterial)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_terrainMaterialProperty, _materialLabel);
EditorGUI.indentLevel--;
}
_useCustomTerrainMaterial = useCustomTerrainMaterial;
}
EditorGUILayout.PropertyField(_isClippingVolumeWallEnabledProperty, _renderClippingVolumeWallLabel);
if (_isClippingVolumeWallEnabledProperty.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_mapEdgeColorProperty, _colorLabel);
_mapEdgeColorFadeDistanceProperty.floatValue =
EditorGUILayout.Slider(_edgeFageLabel, _mapEdgeColorFadeDistanceProperty.floatValue, 0, 1);
{
var useCustomClippingVolumeMaterial =
EditorGUILayout.Toggle("Use Custom Clipping Volume Material", _useCustomClippingVolumeMaterial);
if (_useCustomClippingVolumeMaterial && !useCustomClippingVolumeMaterial)
{
// If the we were previously using a custom material, and have switched back to the default materials,
// reset the material to null which will cause the MapRenderer to reload the default material.
_clippingVolumeMaterialProperty.objectReferenceValue = null;
}
if (useCustomClippingVolumeMaterial)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_clippingVolumeMaterialProperty, _materialLabel);
EditorGUI.indentLevel--;
}
_useCustomClippingVolumeMaterial = useCustomClippingVolumeMaterial;
}
// Texture Camera Resolution
GUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Clipping Edge Resolution");
_clippingVolumeDistanceTextureResolutionProperty.enumValueIndex = GUILayout.Toolbar(
_clippingVolumeDistanceTextureResolutionProperty.enumValueIndex, _clippingVolumeDistanceTextureResolutionOptions);
GUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_clippingDistanceLayerProperty);
EditorGUI.indentLevel--;
}
GUILayout.Space(6f);
}
EditorGUILayout.EndVertical();
// Quality options.
EditorGUILayout.BeginVertical(_boxStyle);
_showQualityOptions = EditorGUILayout.Foldout(_showQualityOptions, "Quality", true, _foldoutTitleStyle);
if (_showQualityOptions)
{
var position = EditorGUILayout.GetControlRect(false, 2 * EditorGUIUtility.singleLineHeight);
position.height = EditorGUIUtility.singleLineHeight;
position = EditorGUI.PrefixLabel(position, _detailOffsetLabel);
EditorGUI.indentLevel--;
_detailOffsetProperty.floatValue = EditorGUI.Slider(position, _detailOffsetProperty.floatValue, -1f, 1f);
float labelWidth = position.width;
// Render the sub-text labels.
{
position.y += EditorGUIUtility.singleLineHeight;
position.width -= EditorGUIUtility.fieldWidth;
var color = GUI.color;
GUI.color = color * new Color(1f, 1f, 1f, 0.5f);
_subtextStyle.alignment = TextAnchor.UpperLeft;
EditorGUI.LabelField(position, "Low", _subtextStyle);
_subtextStyle.alignment = TextAnchor.UpperCenter;
EditorGUI.LabelField(position, "Default", _subtextStyle);
_subtextStyle.alignment = TextAnchor.UpperRight;
EditorGUI.LabelField(position, "High", _subtextStyle);
GUI.color = color;
}
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_numElevationTileFallbackLodsProperty, new GUIContent("Elevation Tile Fallack LODs"));
EditorGUILayout.PropertyField(_requestTilesAroundViewProperty);
}
EditorGUILayout.EndVertical();
// Texture Tile Providers
EditorGUILayout.BeginVertical(_boxStyle);
_showTileLayerOptions = EditorGUILayout.Foldout(_showTileLayerOptions, "Tile Layers", true, _foldoutTitleStyle);
if (_showTileLayerOptions)
{
EditorGUILayout.PropertyField(_textureTileLayersProperty, true);
EditorGUILayout.PropertyField(_elevationTileLayersProperty, true);
EditorGUILayout.PropertyField(_hideTileLayerComponentsProperty);
GUILayout.Space(12f);
}
EditorGUILayout.EndVertical();
GUILayout.Space(4);
EditorGUILayout.PropertyField(_mapSessionProperty);
serializedObject.ApplyModifiedProperties();
}