File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Assets/Huawei/Scripts/Settings Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace HmsPlugin
4+ {
5+ public class HMSModelingKitSettings : HMSEditorSingleton < HMSModelingKitSettings >
6+ {
7+ private const string SettingsFilename = "HMSModelingKitSettings" ;
8+ public const string ModelingKeyAPI = "ModelingKeyAPI" ;
9+
10+ private SettingsScriptableObject loadedSettings ;
11+
12+ private HMSSettings _settings ;
13+ public HMSSettings Settings => _settings ;
14+
15+ public HMSModelingKitSettings ( )
16+ {
17+ loadedSettings = ScriptableHelper . Load < SettingsScriptableObject > ( SettingsFilename , "Assets/Huawei/Settings/Resources" ) ;
18+
19+ if ( loadedSettings == null )
20+ {
21+ throw new NullReferenceException ( "Failed to load the " + SettingsFilename + ". Please restart Unity Editor" ) ;
22+ }
23+ _settings = loadedSettings . settings ;
24+
25+ _settings . OnDictionaryChanged += _settings_OnDictionaryChanged ;
26+ }
27+
28+ private void _settings_OnDictionaryChanged ( )
29+ {
30+ loadedSettings . Save ( ) ;
31+ }
32+
33+ public void Reset ( )
34+ {
35+ _settings . Dispose ( ) ;
36+ _instance = null ;
37+ }
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments