void CheckCourse() { PopupToolUI.Clear(); if (CourseBase.Holes.Any(x => x.pins.Count == 0 || x.tees.Count == 0 || x.flyBys.Count == 0)) { PopupToolUI.Add("Course doesn't have 18 pins/tees/flybys."); } if (CourseBase.Info.Splash == null || CourseBase.Info.Cameo == null) { PopupToolUI.Add("Course doesn't have Course Images."); } if (CourseBase.Hazards.Any(x => x.Layer.name == Utility.GetName(HazardBase.Type.Out_of_Bounds)) == false) { PopupToolUI.Add("Course doesn't have 'Out Of Bounds' hazard."); } }
public override void OnUI(bool selected) { #region Key Events if (Event.current.keyCode == KeyCode.Tab && Event.current.type == EventType.keyDown) { if (EULA == false) { EULA = true; } else if (SceneView.lastActiveSceneView.orthographic) { SceneView.lastActiveSceneView.orthographic = false; } else if (Tools.current != UnityEditor.Tool.View) { Tools.current = UnityEditor.Tool.View; } else if (PlatformBase.IO.IsEditor) { if (PlatformBase.Editor.ActiveTransform == null) { PlatformBase.Editor.ActiveTransform = CourseBase.Terrain.transform; } else { PlatformBase.Editor.ActiveTransform = null; } } Event.current.Use(); } #endregion BeginUI(); MoveToRight(); Move(-3, 0); Background(); if (Button(xTexture)) { DisablePerform(); } MoveToLeft(); Background(); if (!ToolLocked) { Move(0, 1); Background(1, Screen.height / BoxSize - 1); Move(0, -1); } Move(1, 0); if (SelectedTool != Tool.None) { Background(Screen.width / BoxSize - 3); } Move(-1, 0); #region Banner Messages if (EULA == false) { if (Button(wwwTexture)) { SelectedTool = SelectedTool; } Move(1, 0); SetColor(HalfGreen); if (Button("End User License Agreement - Press TAB to agree", 8)) { EULA = true; } SetColor(); Move(-1, 0); Move(0, 1); Background(Screen.width / BoxSize - 2, Screen.height / BoxSize - 1); Background(Screen.width / BoxSize - 2, Screen.height / BoxSize - 1); GUIStyle labelStyle = new GUIStyle(GUI.skin.label); labelStyle.wordWrap = true; labelStyle.normal.textColor = Color.white; Rect scrollViewRect = GetRect(Screen.width / BoxSize - 2, (Screen.height - TopBoxHeight) / BoxSize - 1); float textHeight = 0; for (int i = 0; i < eulaText.Length; i += 4096) { string text = eulaText.Substring(i, Mathf.Min(eulaText.Length - i, 4096)); if (text.Contains("\n") && text.Length == 4096) { int index = text.LastIndexOf("\n"); text = eulaText.Substring(i, index); i += index; i -= 4096; } textHeight += labelStyle.CalcHeight(new GUIContent(text), scrollViewRect.width - 20); } Rect textRect = new Rect(0, 0, scrollViewRect.width - 20, textHeight); eulaScrollPos = GUI.BeginScrollView(scrollViewRect, eulaScrollPos, textRect); for (int i = 0; i < eulaText.Length; i += 4096) { string text = eulaText.Substring(i, Mathf.Min(eulaText.Length - i, 4096)); if (text.Contains("\n") && text.Length == 4096) { int index = text.LastIndexOf("\n"); text = eulaText.Substring(i, index); i += index; i -= 4096; } textRect.height = labelStyle.CalcHeight(new GUIContent(text), scrollViewRect.width - 20); SetColor(Black); GUI.Label(new Rect(textRect.x + 1, textRect.y + 1, textRect.width, textRect.height), text, labelStyle); SetColor(); GUI.Label(textRect, text, labelStyle); textRect.y += textRect.height; } GUI.EndScrollView(); Move(0, -1); EndUI(); return; } else if (SceneView.lastActiveSceneView.orthographic) { if (Button(wwwTexture)) { SelectedTool = SelectedTool; } Move(1, 0); SetColor(HalfGreen); if (Button("CourseForge has limited functionality in ISO mode, press TAB to switch back", 14)) { SceneView.lastActiveSceneView.orthographic = false; } SetColor(); Move(-1, 0); EndUI(); return; } else if (Tools.current != UnityEditor.Tool.View) { if (Button(wwwTexture)) { SelectedTool = SelectedTool; } Move(1, 0); SetColor(HalfGreen); if (Button("CourseForge has limited functionality in this view mode, press TAB to switch back", 14)) { Tools.current = UnityEditor.Tool.View; } SetColor(); Move(-1, 0); EndUI(); return; } else if (CourseBase.TerrainSelected) { if (Button(wwwTexture)) { SelectedTool = SelectedTool; } Move(1, 0); SetColor(HalfGreen); if (Button("Terrain Mode - Press TAB to exit", 6)) { PlatformBase.Editor.ActiveTransform = null; } SetColor(); Move(-1, 0); EndUI(); return; } else if (selected) { if (ToolButton(Tool.FileTool, wwwTexture)) { OnCleanup(); } Move(1, 0); if (SelectedTool > Tool.FileTool && Button((ToolName.Length > 8 ? ToolName.Substring(0, 8) + "..." : ToolName), 2)) { GameObject toolObject = GameObject.Find(ToolName); if (toolObject != null) { EditorGUIUtility.PingObject(toolObject); Selection.activeGameObject = toolObject; } } Move(-1, 0); } Move(0, 1); #endregion #region Top if (ToolButton(Tool.SplineTool, freehandTexture)) { OnCleanup(); if (CourseBase.TerrainLowered) { CourseBase.RestoreTerrain(); } } Move(0, 1); if (ToolButton(Tool.PlantTool, plantTexture)) { OnCleanup(); if (CourseBase.TerrainLowered) { CourseBase.RestoreTerrain(); } } Move(0, 1); if (Button(terrainTexture)) { SelectedTool = Tool.None; OnCleanup(); if (PlatformBase.IO.IsEditor) { PlatformBase.Editor.ActiveTransform = CourseBase.Terrain.transform; } } Move(0, 1); if (CourseBase.TerrainLowered) { SetColor(Red); } if (Button(terrainLoweredTexture)) { SelectedTool = Tool.None; OnCleanup(); if (!CourseBase.TerrainLowered) { CourseBase.SaveTerrain(); CourseBase.LowerTerrain(); } else { CourseBase.RestoreTerrain(); } } SetColor(); Move(0, 1); if (Button(updateTexture)) { if (CourseBase.TerrainLowered) { CourseBase.RestoreTerrain(); } CourseBase.RefreshCourse(); } Move(0, 1); if (Button(buildSplinesTexture)) { if (CourseBase.TerrainLowered) { CourseBase.RestoreTerrain(); } PopupToolUI.Clear(); CourseBase.BakeSplines(true); } Move(0, 1); #endregion #region Bottom MoveToBottom(); Move(0, -1); if (HideLines) { SetColor(HalfGrey); } if (Button(splineEyeTexture)) { HideLines = !HideLines; } SetColor(); Move(0, -1); if (AutoHide) { SetColor(HalfGrey); } if (Button(autoEyeTexture)) { AutoHide = !AutoHide; } SetColor(); Move(0, -1); if (HideMeshes) { SetColor(HalfGrey); } if (Button(eyeTexture)) { AutoHide = false; HideMeshes = !HideMeshes; List <SplineBase> splines = CourseBase.Splines; for (int i = 0; i < splines.Count; ++i) { splines[i].Renderer.UpdateVisibility(splines[i], !HideMeshes); } } SetColor(); Move(0, -1); if (MainToolUI.NormalMode) { EditorGUI.BeginDisabledGroup(true); LayerPanel = false; } if (LayerPanel) { SetColor(Green); } if (Button(layersTexture)) { LayerPanel = !LayerPanel; } SetColor(); Move(0, -1); if (MainToolUI.NormalMode) { EditorGUI.EndDisabledGroup(); } #endregion EndUI(); }