void OnGUI() { using (var sv = new GUILayout.ScrollViewScope(scroll)) { scroll = sv.scrollPosition; using (new HorizontalCenteredScope()) { using (new GUILayout.VerticalScope(GUILayout.Width(390))) { if (BlockoutStaticFunctions.FindHeirachy(ref hierarchy)) { renderingSplash = false; DrawMainWindow(); } else { renderingSplash = true; splashScreen.DrawSection(); } } } } if (sections.Count(x => x.Repaint) > 0) { Repaint(); } }
void Update() { sections.ToList().ForEach(x => x.Update()); if (currentScene != SceneManager.GetActiveScene() && !renderingSplash) { BlockoutEditorSettings.CurrentSceneSetting = null; currentScene = SceneManager.GetActiveScene(); BlockoutStaticFunctions.TryLoadSceneDefinitions(); BlockoutStaticFunctions.FindHeirachy(ref hierarchy); } }
void OnEnable() { hierarchy = new BlockoutHierarchy(); BlockoutStaticFunctions.FindHeirachy(ref hierarchy); EUIResourceManager rm = EUIResourceManager.Instance; splashScreen = new BlockoutEditorSplashSection(); splashScreen.InitSection("Splash Section", hierarchy); assetsSection = new BlockoutEditorAssetsSection(); assetsSection.InitSection("Blockout Assets", hierarchy); scalableObjectsSection = new BlockoutEditorScalableObjectsSection(); scalableObjectsSection.InitSection("Scalable Objects", hierarchy); transformSection = new BlockoutEditorTransformSection(); transformSection.InitSection("Transform Controls", hierarchy); othersSection = new BlockoutEditorOthersSection(); othersSection.InitSection("Others", hierarchy); cameraAnchorSection = new BlockoutEditorCameraAnchorSection(); cameraAnchorSection.InitSection("Camera Anchors", hierarchy); gridSnapping = new BlockoutGridSnapping(); gridSnapping.InitSection("Grid Snapping", hierarchy); hierarchyTools = new BlockoutEditorHierarchyToolsSection(); hierarchyTools.InitSection("Hierarchy Tools", hierarchy); commentsSection = new BlockoutEditorCommentsSection(); commentsSection.InitSection("Comments", hierarchy); suggestedSection = new BlockoutEditorSuggestedSection(); suggestedSection.InitSection("Suggesstions", hierarchy); titleContent = new GUIContent("Blockout", EUIResourceManager.Instance.GetTexture(EditorGUIUtility.isProSkin ? "Blockout_Icon_Light" : "Blockout_Icon_Dark")); sections = new BlockoutEditorSection[] { assetsSection, scalableObjectsSection, transformSection, gridSnapping, hierarchyTools, commentsSection, suggestedSection, cameraAnchorSection, othersSection }; BlockoutEditorSettings.CurrentSceneSetting = Resources.LoadAll <BlockoutSceneSettings>("") .First(x => x.sceneName == SceneManager.GetActiveScene().name); isVisible = true; BlockoutEditorHelper.Awake(this); EditorHotkeysTracker.Init(this); BlockoutStaticFunctions.UpdateAvailable(out newVersion); splashScreen.newVersion = newVersion; }
public override void DrawSection() { repaint = false; using (new HorizontalCenteredScope()) { GUILayout.Box(EUIResourceManager.Instance.GetContent("Blockout Logo"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.Width(BlockoutEditorSettings.OneColumnWidth), GUILayout.Height(120)); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Create Hierarchy"), GUILayout.Height(EditorGUIUtility.singleLineHeight * 6), GUILayout.Width(BlockoutEditorSettings.OneColumnWidth))) { if (!BlockoutStaticFunctions.FindHeirachy(ref blockoutHierarchy)) { if (EditorSceneManager.SaveOpenScenes()) { using (new UndoScope("Create Blockout Hierarchy")) { blockoutHierarchy.root = new GameObject("Blockout").transform; Undo.RegisterCreatedObjectUndo(blockoutHierarchy.root.gameObject, ""); blockoutHierarchy.root.gameObject.AddComponent <BlockoutCommentInGameGUI>(); blockoutHierarchy.root.gameObject.AddComponent <Notepad>(); var section = blockoutHierarchy.root.gameObject.AddComponent <BlockoutSection>(); section.Section = SectionID.Root; BlockoutStaticFunctions.CreateBlockoutSubHeirachyWithRoot(blockoutHierarchy.root); BlockoutStaticFunctions.FindHeirachy(ref blockoutHierarchy); BlockoutStaticFunctions.TryLoadSceneDefinitions(); } } else { EditorUtility.DisplayDialog("Blockout Editor Error", "You need to have a SAVED scene before using the Blockout system", "OK"); } } } GUILayout.Space(5); GUILayout.Label(EUIResourceManager.Instance.GetContent("Intro Label")); GUILayout.Space(5); if (newVersion != BlockoutEditorSettings.VERSION) { GUILayout.Space(5); using (new HorizontalCenteredScope()) { GUILayout.Label("New Version Available (" + newVersion + ")", EditorStyles.boldLabel, GUILayout.Height(EditorGUIUtility.singleLineHeight * 2)); } GUILayout.Space(5); } GUILayout.Label(EUIResourceManager.Instance.GetContent("Example Scenes"), GUILayout.Width(390), GUILayout.Height(EditorGUIUtility.singleLineHeight * 2)); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("All Assets"), GUILayout.Width(390), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { EditorSceneManager.OpenScene("Assets/Blockout/Examples/All Assets.unity"); } using (new HorizontalCenteredScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("FPS Scene"), GUILayout.Width(193), GUILayout.Height(125))) { EditorSceneManager.OpenScene("Assets/Blockout/Examples/FPS.unity"); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Rollerball Scene"), GUILayout.Width(193), GUILayout.Height(125))) { EditorSceneManager.OpenScene("Assets/Blockout/Examples/Rollerball.unity"); } } GUILayout.Space(5); GUILayout.Label("Keyboard Shortcuts"); using (new GUILayout.HorizontalScope()) { if (Application.platform == RuntimePlatform.WindowsEditor) { GUILayout.Label("Ctrl + ALT + B", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Show The Blockout Window"); } else { GUILayout.Label("Cmd + ALT + B", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Show / Hide The Blockout Window"); } } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + S", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Toggle Auto Grid Snapping"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + C", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Toggle Comments"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + Z", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Decrease Grid Snapping Value"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Alt + X", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Increase Grid Snapping Value"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("End", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Snap to ground (-Y)"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("L", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Toggle Locked Assets"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("G", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Jump To Selected Prefab In Project"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("C (Hold)", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("(Hold) Show Scroll Picker"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("(Release) Confirm Swap"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Space", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Scrollpicker: Spawn Selected Asset"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Quickpicker: Show / Select Item"); } using (new GUILayout.HorizontalScope()) { GUILayout.Label("Arrow Keys", EditorStyles.boldLabel, GUILayout.Width(152)); GUILayout.Label("Quickpicker: Change selection"); } GUILayout.Space(5); using (new GUILayout.HorizontalScope()) { if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Open Documentation"), GUILayout.Width(193), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { BlockoutStaticFunctions.OpenDocumentation(); } if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Open Tutorials"), GUILayout.Width(193), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { BlockoutStaticFunctions.OpenTutorials(); } } GUILayout.Space(5); if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Feedback"), GUILayout.Width(390), GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 8))) { BlockoutStaticFunctions.SubmitBugReport(); } GUILayout.Space(10); using (new HorizontalCenteredScope()) { GUILayout.Box(EUIResourceManager.Instance.GetContent("Radical Forge Logo"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.Width(150), GUILayout.Height(45)); } }