public override void OnInspectorGUI()
{
this.Initialize();
if (styles == null)
{
styles = new Styles();
}
if (this.m_Terrain.terrainData == null)
{
GUI.enabled = false;
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.Toolbar(-1, styles.toolIcons, styles.command, new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUI.enabled = true;
GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
GUILayout.Label("Terrain Asset Missing", new GUILayoutOption[0]);
this.m_Terrain.terrainData = EditorGUILayout.ObjectField("Assign:", this.m_Terrain.terrainData, typeof(TerrainData), false, new GUILayoutOption[0]) as TerrainData;
GUILayout.EndVertical();
}
else
{
if (Event.current.type == EventType.Layout)
{
this.m_TerrainCollider = this.m_Terrain.gameObject.GetComponent<TerrainCollider>();
}
if ((this.m_TerrainCollider != null) && (this.m_TerrainCollider.terrainData != this.m_Terrain.terrainData))
{
GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
GUILayout.Label(styles.mismatchedTerrainData, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
GUILayout.Space(3f);
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
if (GUILayout.Button(styles.assign, options))
{
Undo.RecordObject(this.m_TerrainCollider, "Assign TerrainData");
this.m_TerrainCollider.terrainData = this.m_Terrain.terrainData;
}
GUILayout.Space(3f);
GUILayout.EndVertical();
}
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUI.changed = false;
int selectedTool = (int) this.selectedTool;
this.selectedTool = (TerrainTool) GUILayout.Toolbar(selectedTool, styles.toolIcons, styles.command, new GUILayoutOption[0]);
if ((this.selectedTool != selectedTool) && (Toolbar.get != null))
{
Toolbar.get.Repaint();
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
this.CheckKeys();
GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
if ((selectedTool >= 0) && (selectedTool < styles.toolIcons.Length))
{
GUILayout.Label(styles.toolNames[selectedTool].text, new GUILayoutOption[0]);
GUILayout.Label(styles.toolNames[selectedTool].tooltip, EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
}
else
{
GUILayout.Label("No tool selected", new GUILayoutOption[0]);
GUILayout.Label("Please select a tool", EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
}
GUILayout.EndVertical();
switch (((TerrainTool) selectedTool))
{
case TerrainTool.PaintHeight:
this.ShowRaiseHeight();
break;
case TerrainTool.SetHeight:
this.ShowSetHeight();
break;
case TerrainTool.SmoothHeight:
this.ShowSmoothHeight();
break;
case TerrainTool.PaintTexture:
this.ShowTextures();
break;
case TerrainTool.PlaceTree:
this.ShowTrees();
break;
case TerrainTool.PaintDetail:
this.ShowDetails();
break;
case TerrainTool.TerrainSettings:
this.ShowSettings();
break;
}
GUILayout.Space(5f);
}
}