public override void WindowGUI() { GUILayout.BeginHorizontal(); // overflow menu will not be cut off if the buttons can't fit GUILayout.BeginScrollView(Vector2.zero, GUIStyle.none); GUILayout.BeginHorizontal(); if (ActionBarButton(GUIIconSet.instance.close)) { editorFile.Close(); } SelectionGUI(); EditGUI(); GUILayout.FlexibleSpace(); if (ActionBarButton(GUIIconSet.instance.play)) { editorFile.Play(); } GUILayout.EndHorizontal(); GUILayout.EndScrollView(); TutorialGUI.TutorialHighlight("bevel"); if (ActionBarButton(GUIIconSet.instance.overflow)) { BuildOverflowMenu(); } TutorialGUI.ClearHighlight(); GUILayout.EndHorizontal(); }
public override void WindowGUI() { // clear substance highlight while properties panel is disabled EntityReferencePropertyManager.Reset(null); GUILayout.BeginHorizontal(); SelectionGUI(); GUILayout.FlexibleSpace(); Vector3 selectionSize = voxelArray.selectionBounds.size; if (selectionSize == Vector3.zero) { ActionBarLabel("Select edges to bevel..."); } else { ActionBarLabel(SelectionString(selectionSize)); } GUILayout.FlexibleSpace(); TutorialGUI.TutorialHighlight("bevel done"); if (HighlightedActionBarButton(GUIIconSet.instance.done)) { Destroy(this); } TutorialGUI.ClearHighlight(); GUILayout.EndHorizontal(); }
public override void WindowGUI() { string targetButtonText = "Target: Self"; if (targetEntityIsActivator) { targetButtonText = "Target: Activators"; } else if (targetEntity != null) { targetButtonText = "Target: " + targetEntity.ToString(); } TutorialGUI.TutorialHighlight("behavior target"); if (GUIUtils.HighlightedButton(targetButtonText)) { entityPicker = PropertyGUIs.BehaviorTargetPicker(gameObject, voxelArray, self, value => { targetEntity = value.targetEntity.entity; targetEntityIsActivator = value.targetEntityIsActivator; UpdateBehaviorList(); }); } TutorialGUI.ClearHighlight(); if (typePicker != null) { typePicker.scroll = scroll; typePicker.WindowGUI(); scroll = typePicker.scroll; } // prevent panel from closing when entity picker closes holdOpen = entityPicker != null; }
private void StartTutorial(TutorialPageFactory[] tutorial, bool openBlankMap = true) { TutorialGUI.StartTutorial(tutorial, gameObject, voxelArray, touchListener); if (openBlankMap && voxelArray == null) { OpenDemoWorld("Tutorial", "default"); } Destroy(this); }
public GameHUD(PlayerCounter playerCounter,bool useTutorial) { sandboxText=new SimpleTextGUI("Press and hold \"G\" for sandbox options."); normalStyle = MenuTemplate.getLabelStyle (30, TextAnchor.MiddleCenter, Color.white); isFadingToBlack = false; fadeTimeMax = 5; fadeTexture = Resources.Load ("Textures/FadeToBlack") as Texture; tutorialGUI=new TutorialGUI(playerCounter,useTutorial); }
public static void BehaviorCondition(Property property) { var condition = (EntityBehavior.Condition)property.value; GUILayout.Label("When sensor is:"); TutorialGUI.TutorialHighlight("behavior condition"); property.value = (EntityBehavior.Condition)GUILayout.SelectionGrid( (int)condition, new string[] { "On", "Off", "Both" }, 3, GUI.skin.GetStyle("button_tab")); TutorialGUI.ClearHighlight(); }
private void StartTutorial(TutorialPageFactory[] tutorial, string worldName = null) { TutorialGUI.StartTutorial(tutorial, gameObject, voxelArray, touchListener); if (worldName != null && voxelArray == null) { OpenDemoWorld("Tutorial - " + worldName, "default"); } Destroy(this); }
public override void WindowGUI() { if (worldPaths.Count == 0) { GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); // copied from TemplatePickerGUI GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(900), GUILayout.Height(480)); GUILayout.Label("Welcome to N-Space\nFollowing the tutorial is recommended!", GUIUtils.LABEL_HORIZ_CENTERED.Value); int selection = GUILayout.SelectionGrid(-1, startOptions, 2, startButtonStyle.Value, GUILayout.ExpandHeight(true)); if (selection == 0) { TutorialGUI.StartTutorial(Tutorials.INTRO_TUTORIAL, null, null, null); HelpGUI.OpenDemoWorld("Tutorial - Introduction", "Templates/indoor"); } else if (selection == 1) { AskNewWorldTemplate(); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); } else { if (GUIUtils.HighlightedButton("New", GUIStyleSet.instance.buttonLarge)) { AskNewWorldTemplate(); } scroll = GUILayout.BeginScrollView(scroll); for (int i = 0; i < worldPaths.Count; i++) { string path = worldPaths[i]; string name = worldNames[i]; bool selected = worldOverflowMenu != null && path == selectedWorldPath; GUILayout.BeginHorizontal(); if (GUIUtils.HighlightedButton(name, GUIStyleSet.instance.buttonLarge, selected)) { OpenWorld(path, Scenes.EDITOR); } if (GUIUtils.HighlightedButton(GUIIconSet.instance.overflow, GUIStyleSet.instance.buttonLarge, selected, GUILayout.ExpandWidth(false))) { CreateWorldOverflowMenu(path); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } }
private IEnumerator LoadCoroutine() { yield return null; string mapName = SelectedMap.Instance().mapName; Debug.unityLogger.Log("EditorFile", "Loading " + mapName); MapFileReader reader = new MapFileReader(mapName); List<string> warnings; try { warnings = reader.Read(cameraPivot, voxelArray, true); } catch (MapReadException e) { var dialog = loadingGUI.gameObject.AddComponent<DialogGUI>(); dialog.message = e.Message; dialog.yesButtonText = "Close"; dialog.yesButtonHandler = () => { voxelArray.unsavedChanges = false; Close(); }; // fix issue where message dialog doesn't use correct skin: dialog.guiSkin = loadingGUI.guiSkin; Destroy(loadingGUI); Debug.Log(e.InnerException); yield break; } // reading the file creates new voxels which sets the unsavedChanges flag // and clears existing voxels which sets the selectionChanged flag voxelArray.unsavedChanges = false; voxelArray.selectionChanged = false; Destroy(loadingGUI); foreach (MonoBehaviour b in enableOnLoad) b.enabled = true; if (warnings.Count > 0) { string message = "There were some issues with reading the world:\n\n • " + string.Join("\n • ", warnings.ToArray()); LargeMessageGUI.ShowLargeMessageDialog(loadingGUI.gameObject, message); } if (!PlayerPrefs.HasKey("last_editScene_version")) { var dialog = loadingGUI.gameObject.AddComponent<DialogGUI>(); dialog.message = "This is your first time using the app. Would you like a tutorial?"; dialog.yesButtonText = "Yes"; dialog.noButtonText = "No"; dialog.yesButtonHandler = () => { TutorialGUI.StartTutorial(Tutorials.INTRO_TUTORIAL, dialog.gameObject, voxelArray, touchListener); }; } PlayerPrefs.SetString("last_editScene_version", Application.version); }
private void StartTutorial(TutorialPageFactory[] tutorial, string worldName = null, bool forceIndoor = false) { TutorialGUI.StartTutorial(tutorial, gameObject, voxelArray, touchListener); if (worldName != null && (voxelArray == null || (voxelArray.type != VoxelArray.WorldType.INDOOR && forceIndoor))) { OpenDemoWorld("Tutorial - " + worldName, "Templates/indoor"); } Destroy(this); }
public override void WindowGUI() { if (voxelArray.selectionChanged) { voxelArray.selectionChanged = false; voxelEdge = voxelArray.GetSelectedBevel(); } GUILayout.Label("Bevel:", GUIStyleSet.instance.labelTitle); if (!voxelArray.SomethingIsSelected()) { GUILayout.Label("(none selected)"); return; } TutorialGUI.TutorialHighlight("bevel shape"); GUILayout.Label("Shape:"); var newBevelType = (VoxelEdge.BevelType)GUILayout.SelectionGrid((int)voxelEdge.bevelType, new Texture[] { GUIIconSet.instance.no, GUIIconSet.instance.bevelIcons.flat, GUIIconSet.instance.bevelIcons.curve, GUIIconSet.instance.bevelIcons.square, GUIIconSet.instance.bevelIcons.stair2, GUIIconSet.instance.bevelIcons.stair4 }, 3, GUIStyleSet.instance.buttonTab); TutorialGUI.ClearHighlight(); TutorialGUI.TutorialHighlight("bevel size"); GUILayout.Label("Size:"); var newBevelSize = (VoxelEdge.BevelSize)GUILayout.SelectionGrid((int)voxelEdge.bevelSize, new Texture[] { GUIIconSet.instance.bevelIcons.quarter, GUIIconSet.instance.bevelIcons.half, GUIIconSet.instance.bevelIcons.full }, 3, GUIStyleSet.instance.buttonTab); TutorialGUI.ClearHighlight(); if (newBevelType != voxelEdge.bevelType || newBevelSize != voxelEdge.bevelSize) { voxelEdge.bevelType = newBevelType; voxelEdge.bevelSize = newBevelSize; voxelArray.BevelSelectedEdges(voxelEdge); } }
public override void WindowGUI() { TutorialGUI.TutorialHighlight("material type"); if (colorOnly) { tab = 0; } else if (allowNullMaterial) { tab = GUILayout.SelectionGrid(tab, new string[] { "Color", "Texture", "None" }, 3); } else { tab = GUILayout.SelectionGrid(tab, new string[] { "Color", "Texture" }, 2); } TutorialGUI.ClearHighlight(); if (tab == 0) { ColorTab(); } else if (colorPicker != null) { Destroy(colorPicker); } if (tab == 1) { TextureTab(); } else { scroll = Vector2.zero; scrollVelocity = Vector2.zero; if (materialDirectory != rootDirectory) { materialDirectory = rootDirectory; UpdateMaterialDirectory(); } } if (tab == 2) { NoneTab(); } }
private void EntityPropertiesGUI() { Entity singleSelectedEntity = null; if (selectedEntities.Count == 1) { singleSelectedEntity = selectedEntities[0]; } EntityReferencePropertyManager.Reset(singleSelectedEntity); // could be null and that's fine (?) GUILayout.BeginVertical(GUI.skin.box); PropertiesObjectGUI(editEntity); GUILayout.EndVertical(); if (singleSelectedEntity != null && !(singleSelectedEntity is PlayerObject)) { GUILayout.BeginHorizontal(); if (GUIUtils.HighlightedButton("Clone")) { if (singleSelectedEntity is ObjectEntity) { ObjectEntity clone = (ObjectEntity)(singleSelectedEntity.Clone()); var pickerGUI = gameObject.AddComponent <FacePickerGUI>(); pickerGUI.voxelArray = voxelArray; pickerGUI.message = "Tap to place clone"; pickerGUI.pickAction = () => { if (!voxelArray.PlaceObject(clone)) { DialogGUI.ShowMessageDialog(gameObject, ActionBarGUI.OBJECT_NO_ROOM_ERROR); } }; } else if (singleSelectedEntity is Substance) { Substance clone = (Substance)(singleSelectedEntity.Clone()); clone.defaultPaint = voxelArray.GetSelectedPaint(); clone.defaultPaint.addSelected = false; clone.defaultPaint.storedSelected = false; voxelArray.substanceToCreate = clone; var createGUI = gameObject.AddComponent <CreateSubstanceGUI>(); createGUI.voxelArray = voxelArray; } } if (GUIUtils.HighlightedButton("Delete")) { DeleteButton(); } GUILayout.EndHorizontal(); } if (selectedEntities.Count > 1) { if (GUIUtils.HighlightedButton("Delete")) { DeleteButton(); } } TutorialGUI.TutorialHighlight("change sensor"); if (GUILayout.Button("Change Sensor")) { TypePickerGUI sensorMenu = gameObject.AddComponent <TypePickerGUI>(); sensorMenu.title = "Change Sensor"; sensorMenu.categories = new PropertiesObjectType[][] { GameScripts.sensors }; sensorMenu.handler = (PropertiesObjectType type) => { foreach (Entity entity in selectedEntities) { entity.sensor = (Sensor)type.Create(); } voxelArray.unsavedChanges = true; UpdateEditEntity(); }; } TutorialGUI.ClearHighlight(); GUILayout.BeginVertical(GUI.skin.box); PropertiesObjectGUI(editSensor, " Sensor"); GUILayout.EndVertical(); TutorialGUI.TutorialHighlight("add behavior"); if (GUILayout.Button("Add Behavior")) { NewBehaviorGUI behaviorMenu = gameObject.AddComponent <NewBehaviorGUI>(); behaviorMenu.title = "Add Behavior"; behaviorMenu.self = singleSelectedEntity; behaviorMenu.voxelArray = voxelArray; behaviorMenu.handler = (PropertiesObjectType behaviorType) => { foreach (Entity entity in selectedEntities) { EntityBehavior newBehavior = (EntityBehavior)behaviorType.Create(); // with multiple selected entities, NewBehaviorGUI doesn't check if behaviors // are valid for the selected entities if (newBehavior.targetEntity.entity == null && !newBehavior.targetEntityIsActivator && !newBehavior.BehaviorObjectType().rule(entity)) { continue; } entity.behaviors.Add(newBehavior); EntityPreviewManager.BehaviorUpdated(singleSelectedEntity, newBehavior); } voxelArray.unsavedChanges = true; UpdateEditEntity(); scrollVelocity = new Vector2(0, 2000 * editBehaviors.Count); // scroll to bottom }; } TutorialGUI.ClearHighlight(); Color guiBaseColor = GUI.backgroundColor; StoredEntityBehavior behaviorToRemove = null; foreach (StoredEntityBehavior storedBehavior in editBehaviors) { TutorialGUI.TutorialHighlight("behaviors"); Entity behaviorTarget = null; if (storedBehavior.sharedTarget) { behaviorTarget = storedBehavior.allBehaviors[0].targetEntity.entity; } if (behaviorTarget != null) { EntityReferencePropertyManager.Next(behaviorTarget); GUI.backgroundColor = guiBaseColor * EntityReferencePropertyManager.GetColor(); } EntityReferencePropertyManager.SetBehaviorTarget(behaviorTarget); GUILayout.BeginVertical(GUI.skin.box); GUI.backgroundColor = guiBaseColor; PropertiesObjectGUI(storedBehavior, " Behavior", () => EntityPreviewManager.BehaviorUpdated(singleSelectedEntity, storedBehavior.allBehaviors[0])); if (GUILayout.Button("Remove")) { behaviorToRemove = storedBehavior; } GUILayout.EndVertical(); // clear this every time, in case the next target is the same EntityReferencePropertyManager.SetBehaviorTarget(null); } if (behaviorToRemove != null) { foreach (Entity entity in selectedEntities) { foreach (EntityBehavior remove in behaviorToRemove.allBehaviors) { if (entity.behaviors.Remove(remove)) { break; } } } voxelArray.unsavedChanges = true; UpdateEditEntity(); EntityPreviewManager.BehaviorUpdated(singleSelectedEntity, behaviorToRemove.allBehaviors[0]); } if (mismatchedSelectedBehaviorCounts) { GUILayout.BeginVertical(GUI.skin.box); GUILayout.Label("(other behaviors...)", GUIStyleSet.instance.labelTitle); GUILayout.EndVertical(); } }
public override void WindowGUI() { GUILayout.BeginHorizontal(); GUILayout.Box("", GUIStyle.none, GUILayout.Width(PREVIEW_SIZE), GUILayout.Height(PREVIEW_SIZE)); DrawPaint(paint, GUILayoutUtility.GetLastRect()); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); TutorialGUI.TutorialHighlight("paint transform"); if (GUILayout.Button(GUIIconSet.instance.rotateLeft, GUIStyleSet.instance.buttonSmall, GUILayout.ExpandWidth(false))) { Orient(3); } if (GUILayout.Button(GUIIconSet.instance.rotateRight, GUIStyleSet.instance.buttonSmall, GUILayout.ExpandWidth(false))) { Orient(1); } TutorialGUI.ClearHighlight(); GUILayout.FlexibleSpace(); foreach (VoxelFace recentPaint in recentPaints) { GUILayout.Box("", previewBoxStyle.Value, GUILayout.Width(RECENT_PREVIEW_SIZE), GUILayout.Height(RECENT_PREVIEW_SIZE)); Rect buttonRect = GUILayoutUtility.GetLastRect(); Rect paintRect = new Rect( buttonRect.xMin + RECENT_MARGIN, buttonRect.yMin + RECENT_MARGIN, buttonRect.width - RECENT_MARGIN * 2, buttonRect.height - RECENT_MARGIN * 2); if (GUI.Button(buttonRect, "")) { paint = recentPaint; handler(paint); UpdateMaterialSelector(); } DrawPaint(recentPaint, paintRect); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Done")) { Destroy(this); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); TutorialGUI.TutorialHighlight("paint transform"); if (GUILayout.Button(GUIIconSet.instance.flipHorizontal, GUIStyleSet.instance.buttonSmall, GUILayout.ExpandWidth(false))) { Orient(5); } if (GUILayout.Button(GUIIconSet.instance.flipVertical, GUIStyleSet.instance.buttonSmall, GUILayout.ExpandWidth(false))) { Orient(7); } TutorialGUI.ClearHighlight(); int oldSelectedLayer = selectedLayer; TutorialGUI.TutorialHighlight("paint layer"); selectedLayer = GUILayout.SelectionGrid( selectedLayer, new string[] { "Material", "Overlay" }, 2); TutorialGUI.ClearHighlight(); if (oldSelectedLayer != selectedLayer) { UpdateMaterialSelector(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); if (materialSelector != null) { materialSelector.scroll = scroll; materialSelector.WindowGUI(); scroll = materialSelector.scroll; } }
public L_Setup(TutorialGUI host, string id) : base(host, id) { createText(); }
public Lesson(TutorialGUI host, string id) { _gui = host; _ID = id; _dialogEntries = new List <string>(); }
private IEnumerator LoadCoroutine() { yield return(null); var guiGameObject = loadingGUI.gameObject; List <string> warnings; try { warnings = ReadWorldFile.Read(SelectedWorld.GetLoadStream(), cameraPivot, voxelArray, true); } catch (MapReadException e) { var dialog = guiGameObject.AddComponent <DialogGUI>(); dialog.message = e.Message; dialog.yesButtonText = "Close"; dialog.yesButtonHandler = () => { voxelArray.unsavedChanges = false; Close(); }; Destroy(loadingGUI); Debug.LogError(e); yield break; } // reading the file creates new voxels which sets the unsavedChanges flag // and clears existing voxels which sets the selectionChanged flag voxelArray.unsavedChanges = false; voxelArray.selectionChanged = false; Destroy(loadingGUI); foreach (MonoBehaviour b in enableOnLoad) { b.enabled = true; } if (PlayerPrefs.HasKey("last_editScene_version")) { string lastVersion = PlayerPrefs.GetString("last_editScene_version"); if (CompareVersions(lastVersion, "1.2.0") == -1) { var dialog = guiGameObject.AddComponent <DialogGUI>(); dialog.message = "N-Space has been updated with the ability to bevel edges! Would you like a tutorial?"; dialog.yesButtonText = "Yes"; dialog.noButtonText = "No"; dialog.yesButtonHandler = () => { TutorialGUI.StartTutorial(Tutorials.BEVEL_TUTORIAL, guiGameObject, voxelArray, touchListener); }; } else if (CompareVersions(lastVersion, "1.3.0") == -1) { LargeMessageGUI.ShowLargeMessageDialog(guiGameObject, "<b>Version 1.3.0 update</b>\n\n" + "N-Space has been updated with a new behavior for sound effects and music. Try it out!\n\n" + "Also, check the main menu for links to video tutorials and a subreddit."); } } PlayerPrefs.SetString("last_editScene_version", Application.version); if (warnings.Count > 0) { // avoids a bug where two dialogs created on the same frame will put the unfocused one on top // for some reason it's necessary to wait two frames yield return(null); yield return(null); string message = "There were some issues with reading the world:\n\n • " + string.Join("\n • ", warnings.ToArray()); LargeMessageGUI.ShowLargeMessageDialog(guiGameObject, message); } }
protected void EditGUI() { if (!voxelArray.FacesAreSelected()) { return; } TutorialGUI.TutorialHighlight("paint"); if (ActionBarButton(GUIIconSet.instance.paint)) { PaintGUI paintGUI = gameObject.AddComponent <PaintGUI>(); paintGUI.title = "Paint Faces"; paintGUI.handler = (VoxelFace paint) => { voxelArray.PaintSelectedFaces(paint); }; paintGUI.paint = voxelArray.GetSelectedPaint(); } TutorialGUI.ClearHighlight(); TutorialGUI.TutorialHighlight("create object"); if (ActionBarButton(GUIIconSet.instance.create)) { TypePickerGUI picker = gameObject.AddComponent <TypePickerGUI>(); picker.title = "Create"; picker.categories = new PropertiesObjectType[][] { GameScripts.entityTemplates, GameScripts.objectTemplates }; picker.categoryNames = new string[] { "Substance", "Object" }; picker.handler = (PropertiesObjectType type) => { if (typeof(Substance).IsAssignableFrom(type.type)) { Substance substance = (Substance)type.Create(); voxelArray.substanceToCreate = substance; var createGUI = gameObject.AddComponent <CreateSubstanceGUI>(); createGUI.voxelArray = voxelArray; } else if (typeof(ObjectEntity).IsAssignableFrom(type.type)) { ObjectEntity obj = (ObjectEntity)type.Create(); if (!voxelArray.PlaceObject(obj)) { DialogGUI.ShowMessageDialog(gameObject, OBJECT_NO_ROOM_ERROR); } } }; } TutorialGUI.ClearHighlight(); GUILayout.FlexibleSpace(); int moveCount = 0; if (touchListener.currentTouchOperation == TouchListener.TouchOperation.MOVE && touchListener.movingAxis is MoveAxis) { moveCount = Mathf.Abs(((MoveAxis)touchListener.movingAxis).moveCount); } if (moveCount != 0) { ActionBarLabel(moveCount.ToString()); } else { ActionBarLabel(SelectionString(voxelArray.selectionBounds.size)); } }