-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f9d6f9
commit 8d4943b
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
|
||
namespace HmsPlugin | ||
{ | ||
public class HMSModelingKitSettings : HMSEditorSingleton<HMSModelingKitSettings> | ||
{ | ||
private const string SettingsFilename = "HMSModelingKitSettings"; | ||
public const string ModelingKeyAPI = "ModelingKeyAPI"; | ||
|
||
private SettingsScriptableObject loadedSettings; | ||
|
||
private HMSSettings _settings; | ||
public HMSSettings Settings => _settings; | ||
|
||
public HMSModelingKitSettings() | ||
{ | ||
loadedSettings = ScriptableHelper.Load<SettingsScriptableObject>(SettingsFilename, "Assets/Huawei/Settings/Resources"); | ||
|
||
if (loadedSettings == null) | ||
{ | ||
throw new NullReferenceException("Failed to load the " + SettingsFilename + ". Please restart Unity Editor"); | ||
} | ||
_settings = loadedSettings.settings; | ||
|
||
_settings.OnDictionaryChanged += _settings_OnDictionaryChanged; | ||
} | ||
|
||
private void _settings_OnDictionaryChanged() | ||
{ | ||
loadedSettings.Save(); | ||
} | ||
|
||
public void Reset() | ||
{ | ||
_settings.Dispose(); | ||
_instance = null; | ||
} | ||
} | ||
} |