コード例 #1
0
 /// <summary>
 /// Serialize a given list of control schemes.
 /// </summary>
 /// <param name="schemes">The list of control schemes to serialize.</param>
 public static void SerializeControlSchemes(List <ControlScheme> schemes)
 {
     foreach (var scheme in schemes)
     {
         _serializer.Serialize(scheme, IOUtil.PathCombine(PathToControlSchemes, scheme.Name + ".dat"));
     }
 }
コード例 #2
0
        public void SaveSchemes()
        {
            Debug.Log("Serialising control schemes...");

            foreach (var scheme in Schemes)
            {
                _serializer.Serialize(scheme, PathUtil.Combine(_controlSchemesPath, scheme.Name + ".dat"));
            }
        }
コード例 #3
0
        private void exportLevel()
        {
            var path = EditorUtility.SaveFilePanel("Export level", "", ".tmap", "tmap");

            if (!string.IsNullOrEmpty(path))
            {
                Level level = Level.FromScene(_levelObj);
                _serializer.Serialize(level, path);
            }
        }
コード例 #4
0
        public void OnGUI()
        {
            EditorGUILayout.BeginHorizontal();
            _showEntireMenu = EditorGUILayout.Foldout(_showEntireMenu, "LSDR Dream Editor",
                                                      new GUIStyle("foldout")
            {
                fontStyle = FontStyle.Bold
            });
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Import", GUILayout.Width(100)))
            {
                importExistingDream();
            }
            if (GUILayout.Button("Export", GUILayout.Width(100)))
            {
                var path = EditorUtility.SaveFilePanel("Export dream", "", _dream.Name + ".json", "json");

                if (!string.IsNullOrEmpty(path))
                {
                    _serializer.Serialize(_dream, path);
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUI.indentLevel++;

            _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);
            if (_showEntireMenu)
            {
                EditorGUILayout.LabelField("Metadata", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                _dream.Name = EditorGUILayout.TextField(new GUIContent("Name", "The name of this dream"),
                                                        _dream.Name);
                _dream.Author = EditorGUILayout.TextField(new GUIContent("Author", "The author of this dream"),
                                                          _dream.Author);
                _dream.Type = (DreamType)EditorGUILayout.EnumPopup(
                    new GUIContent("Type", "The type of this dream, used to determine how to load the dream"),
                    _dream.Type);
                if (_dream.Type == DreamType.Legacy)
                {
                    _dream.LegacyTileMode = (LegacyTileMode)EditorGUILayout.EnumPopup(
                        new GUIContent("Tile mode", "The tiling mode of this dream"), _dream.LegacyTileMode);
                }

                if (_dream.LegacyTileMode == LegacyTileMode.Horizontal)
                {
                    _dream.TileWidth = EditorGUILayout.IntField(
                        new GUIContent("Tile width", "The width of the tile map"),
                        _dream.TileWidth);
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();

                EditorGUILayout.LabelField("Graph", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                _dream.Upperness = EditorGUILayout.IntSlider(
                    new GUIContent("Upperness",
                                   "What effect this dream has on the 'upper' axis of the graph, when visited"), _dream.Upperness,
                    -9,
                    9);

                _dream.Dynamicness = EditorGUILayout.IntSlider(
                    new GUIContent("Dynamicness",
                                   "What effect this dream has on the 'dynamic' axis of the graph, when visited"),
                    _dream.Dynamicness,
                    -9,
                    9);
                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();

                EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;

                _dream.Level = CommonGUI.BrowseFileField(new GUIContent("Level",
                                                                        "The path to the raw level file within the game's data to load for this dream."), _dream.Level,
                                                         "Choose a level file", new[] { "Torii map files", "tmap" });

                if (_dream.Type == DreamType.Legacy)
                {
                    _dream.LBDFolder = CommonGUI.BrowseFolderField(
                        new GUIContent("LBD folder", "The path to the LBD folder to load for this Dream."),
                        _dream.LBDFolder, "Choose an LBD folder.");
                }

                // only enable the button if the dream level has a value
                using (new EditorGUI.DisabledScope(string.IsNullOrWhiteSpace(_dream.Level)))
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Edit level", GUILayout.Width(200)))
                    {
                        var editor = LevelEditor.Create();
                        editor.EditLevel(_dream.Level);
                        if (_dream.Type == DreamType.Legacy)
                        {
                            editor.LoadLBD(_dream);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();

                EditorGUILayout.LabelField("Gameplay", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                _dream.GreyMan =
                    EditorGUILayout.Toggle(
                        new GUIContent("Grey man", "Whether or not this dream can spawn the grey man"),
                        _dream.GreyMan);
                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Environment", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Add"))
                {
                    addNewDreamEnvironment();
                }

                EditorGUILayout.EndHorizontal();

                EditorGUI.indentLevel++;
                for (int i = 0; i < _dream.Environments.Count; i++)
                {
                    drawDreamEnvironmentGUI(i);
                }

                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndScrollView();

            EditorGUI.indentLevel--;
        }
コード例 #5
0
        public void Save()
        {
            Debug.Log("Saving game settings...");

            _serializer.Serialize(Settings, SettingsPath);
        }
コード例 #6
0
        /// <summary>
        /// Save the given settings to the settings file.
        /// </summary>
        /// <param name="settings">The settings to save.</param>
        public static void SaveSettings(GameSettings settings)
        {
            Debug.Log("Saving game settings...");

            _serializer.Serialize(settings, SettingsPath);
        }
コード例 #7
0
 public void Save()
 {
     _serializer.Serialize(Data, _savedGamePath);
 }
コード例 #8
0
        public void OnGUI()
        {
            EditorGUILayout.BeginHorizontal();
            _showEntireMenu = EditorGUILayout.Foldout(_showEntireMenu, "LSDR Journal Editor",
                                                      new GUIStyle("foldout")
            {
                fontStyle = FontStyle.Bold
            });
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Import", GUILayout.Width(100)))
            {
                importExistingJournal();
            }
            if (GUILayout.Button("Export", GUILayout.Width(100)))
            {
                var path = EditorUtility.SaveFilePanel("Export journal", "", _journal.Name + ".json", "json");
                if (!string.IsNullOrEmpty(path))
                {
                    _serializer.Serialize(_journal, path);
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUI.indentLevel++;

            _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);
            if (_showEntireMenu)
            {
                EditorGUILayout.LabelField("Metadata", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                _journal.Name = EditorGUILayout.TextField(new GUIContent("Name", "The name of this dream journal"),
                                                          _journal.Name);
                _journal.Author = EditorGUILayout.TextField(new GUIContent("Author", "The author of this dream journal"),
                                                            _journal.Author);
                EditorGUILayout.Separator();
                EditorGUI.indentLevel--;

                EditorGUILayout.LabelField("Journal", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;

                Rect graphSpawnMapRect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(true));
                GraphSpawnMapDrawer.OnGUI(graphSpawnMapRect, _journal.GraphSpawnMap,
                                          new GUIContent("Graph spawn map",
                                                         "The mapping of which graph squares spawn the player into what dreams."));

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Linkable dreams",
                                                          "The pool of dreams we can get to when randomly linking"));
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Add"))
                {
                    _journal.LinkableDreams.Add("");
                }
                EditorGUILayout.EndHorizontal();
                EditorGUI.indentLevel++;
                for (int i = 0; i < _journal.LinkableDreams.Count; i++)
                {
                    drawLinkableDream(i);
                }

                EditorGUI.indentLevel--;

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("First dreams",
                                                          "The pool of dreams to start on on the first day of the journal." +
                                                          " If empty, then it'll be a random dream from the linkable dreams. "));
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Add"))
                {
                    _journal.FirstDream.Add("");
                }
                EditorGUILayout.EndHorizontal();
                EditorGUI.indentLevel++;
                for (int i = 0; i < _journal.FirstDream.Count; i++)
                {
                    drawFirstDream(i);
                }
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndScrollView();

            EditorGUI.indentLevel--;
        }