Example #1
0
 private static PluginSettings InitializeAsset()
 {
     PluginSettings.Data data = PluginSettings.GenerateDefaultData();
     return(PluginSettings.SetRuntimeData(data));
 }
Example #2
0
 /// <summary>Stores the given values to the Runtime asset.</summary>
 public static PluginSettings SetRuntimeData(PluginSettings.Data data)
 {
     return(PluginSettings.SaveToAsset(PluginSettings.FILE_PATH, data));
 }
Example #3
0
 public static PluginSettings SetGlobalValues(PluginSettings.Data data)
 {
     return(PluginSettings.SetRuntimeData(data));
 }
Example #4
0
        // ---------[ FUNCTIONALITY ]---------
        /// <summary>Loads the data from a PluginSettings asset.</summary>
        public static PluginSettings.Data LoadDataFromAsset(string assetPath)
        {
            PluginSettings wrapper = Resources.Load <PluginSettings>(assetPath);

            PluginSettings.Data settings;

            if (wrapper == null)
            {
                settings = new Data();
            }
            else
            {
                settings = wrapper.m_data;

                // - Path variable replacement -
                #if UNITY_STANDALONE
                // cachedir
                if (settings.cacheDirectory != null)
                {
                    settings.cacheDirectory = ReplaceDirectoryVariables(settings.cacheDirectory,
                                                                        settings.gameId);
                }

                // installdir
                if (settings.installationDirectory != null)
                {
                    settings.installationDirectory = ReplaceDirectoryVariables(settings.installationDirectory,
                                                                               settings.gameId);
                }

                // userdir
                if (settings.userDirectory != null)
                {
                    settings.userDirectory = ReplaceDirectoryVariables(settings.userDirectory,
                                                                       settings.gameId);
                }
                #endif // UNITY_STANDALONE

                #if UNITY_EDITOR
                // cachedir
                if (settings.cacheDirectoryEditor != null)
                {
                    settings.cacheDirectoryEditor = ReplaceDirectoryVariables(settings.cacheDirectoryEditor,
                                                                              settings.gameId);
                }

                // installdir
                if (settings.installationDirectoryEditor != null)
                {
                    settings.installationDirectoryEditor = ReplaceDirectoryVariables(settings.installationDirectoryEditor,
                                                                                     settings.gameId);
                }

                // userdir
                if (settings.userDirectoryEditor != null)
                {
                    settings.userDirectoryEditor = ReplaceDirectoryVariables(settings.userDirectoryEditor,
                                                                             settings.gameId);
                }
                #endif // UNITY_EDITOR
            }

            return(settings);
        }