Ejemplo n.º 1
0
 private void TutorialsTab()
 {
     if (GUILayout.Button("Introduction"))
     {
         StartTutorial(Tutorials.INTRO_TUTORIAL);
     }
     if (GUILayout.Button("Painting"))
     {
         StartTutorial(Tutorials.PAINT_TUTORIAL);
     }
     if (GUILayout.Button("Substances"))
     {
         StartTutorial(Tutorials.SUBSTANCE_TUTORIAL);
     }
     if (GUILayout.Button("Objects"))
     {
         StartTutorial(Tutorials.OBJECT_TUTORIAL);
     }
     if (GUILayout.Button("Tips and Shortcuts"))
     {
         LargeMessageGUI.ShowLargeMessageDialog(gameObject, Tutorials.TIPS_AND_SHORTCUTS_TUTORIAL);
         Destroy(this);
     }
     if (GUILayout.Button("Advanced game logic 1"))
     {
         StartTutorial(Tutorials.ADVANCED_GAME_LOGIC_TUTORIAL_1, false);
         OpenDemoWorld("Advanced game logic 1", "Tutorials/advanced_game_logic_1");
     }
     if (GUILayout.Button("Advanced game logic 2"))
     {
         StartTutorial(Tutorials.ADVANCED_GAME_LOGIC_TUTORIAL_2);
     }
 }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
 public override void WindowGUI()
 {
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     if (ActionBarGUI.ActionBarButton(GUIIconSet.instance.overflow))
     {
         var overflow = gameObject.AddComponent <OverflowMenuGUI>();
         overflow.items = new OverflowMenuGUI.MenuItem[]
         {
             new OverflowMenuGUI.MenuItem("Help", GUIIconSet.instance.help, () => {
                 gameObject.AddComponent <HelpGUI>();
             }),
             new OverflowMenuGUI.MenuItem("About", GUIIconSet.instance.about, () =>
             {
                 string text = System.String.Format("Version {0}\nMade with Unity {1}\n\n{2}"
                                                    + "\n\n----------\n\nSystem Info:\nResolution: {3}x{4}\nDPI: {5}"
                                                    + "\nAudio: {6}Hz {7}",
                                                    Application.version, Application.unityVersion, creditsText.text,
                                                    Screen.width, Screen.height, Screen.dpi,
                                                    AudioSettings.outputSampleRate, AudioSettings.speakerMode);
                 LargeMessageGUI.ShowLargeMessageDialog(gameObject, text);
             }),
             new OverflowMenuGUI.MenuItem("Subreddit", GUIIconSet.instance.reddit, () =>
             {
                 Application.OpenURL("https://www.reddit.com/r/nspace/");
             }),
             new OverflowMenuGUI.MenuItem("Videos", GUIIconSet.instance.youTube, () =>
             {
                 Application.OpenURL("https://www.youtube.com/playlist?list=PLMiQPjIk5IrpgNcQY5EUYaGFDuAf7PLY2");
             }),
             new OverflowMenuGUI.MenuItem("GitHub", GUIIconSet.instance.gitHub, () =>
             {
                 Application.OpenURL("https://github.com/vanjac/voxel-editor/");
             })
         };
     }
     GUILayout.EndHorizontal();
 }
Ejemplo n.º 4
0
 public override void WindowGUI()
 {
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     if (ActionBarGUI.ActionBarButton(GUIIconSet.instance.overflow))
     {
         var overflow = gameObject.AddComponent <OverflowMenuGUI>();
         overflow.items = new OverflowMenuGUI.MenuItem[]
         {
             new OverflowMenuGUI.MenuItem("Help", GUIIconSet.instance.help, () => {
                 gameObject.AddComponent <HelpGUI>();
             }),
             new OverflowMenuGUI.MenuItem("About", GUIIconSet.instance.about, () =>
             {
                 string text = "Version " + Application.version
                               + "\nMade with Unity " + Application.unityVersion
                               + "\n\n" + creditsText.text;
                 LargeMessageGUI.ShowLargeMessageDialog(gameObject, text);
             })
         };
     }
     GUILayout.EndHorizontal();
 }
Ejemplo n.º 5
0
    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);
        }
    }