99using Firebase ;
1010using Firebase . Extensions ;
1111#endif
12+
1213#if VIRTUESKY_FIREBASE_REMOTECONFIG
1314using Firebase . RemoteConfig ;
1415#endif
1516
16- namespace VirtueSky . RemoteConfigs
17- {
18- public class FirebaseRemoteConfigManager : MonoBehaviour
19- {
17+ namespace VirtueSky . RemoteConfigs {
18+ public class FirebaseRemoteConfigManager : MonoBehaviour {
2019 [ SerializeField ] private bool dontDestroyOnLoad ;
2120 [ Space , SerializeField ] private TypeInitRemoteConfig typeInitRemoteConfig ;
2221#if VIRTUESKY_FIREBASE
@@ -32,42 +31,37 @@ public class FirebaseRemoteConfigManager : MonoBehaviour
3231
3332 public static bool IsFetchRemoteConfigCompleted => _instance . _isFetchRemoteConfigCompleted ;
3433 public static List < FirebaseRemoteConfigData > ListRemoteConfigData => _instance . listRemoteConfigData ;
34+ #if VIRTUESKY_FIREBASE
35+ public static DependencyStatus DependencyStatus => _instance . dependencyStatus ;
36+ #endif
3537
3638 #endregion
3739
38- private void Awake ( )
39- {
40- if ( dontDestroyOnLoad )
41- {
40+ private void Awake ( ) {
41+ if ( dontDestroyOnLoad ) {
4242 DontDestroyOnLoad ( this . gameObject ) ;
4343 }
4444
45- if ( _instance == null )
46- {
45+ if ( _instance == null ) {
4746 _instance = this ;
4847 }
49- else
50- {
48+ else {
5149 Destroy ( gameObject ) ;
5250 }
5351
54- if ( typeInitRemoteConfig == TypeInitRemoteConfig . InitOnAwake )
55- {
52+ if ( typeInitRemoteConfig == TypeInitRemoteConfig . InitOnAwake ) {
5653 Init ( ) ;
5754 }
5855 }
5956
6057
61- private void Start ( )
62- {
63- if ( typeInitRemoteConfig == TypeInitRemoteConfig . InitOnStart )
64- {
58+ private void Start ( ) {
59+ if ( typeInitRemoteConfig == TypeInitRemoteConfig . InitOnStart ) {
6560 Init ( ) ;
6661 }
6762 }
6863
69- private void Init ( )
70- {
64+ private void Init ( ) {
7165#if VIRTUESKY_FIREBASE
7266 _isFetchRemoteConfigCompleted = false ;
7367 if ( isSetupDefaultData )
@@ -149,10 +143,8 @@ private Task FetchDataAsync()
149143#if UNITY_EDITOR
150144 private const string pathDefaultScript = "Assets/_Root/Scripts" ;
151145 [ Button ]
152- private void GenerateRemoteData ( )
153- {
154- if ( ! Directory . Exists ( pathDefaultScript ) )
155- {
146+ private void GenerateRemoteData ( ) {
147+ if ( ! Directory . Exists ( pathDefaultScript ) ) {
156148 Directory . CreateDirectory ( pathDefaultScript ) ;
157149 }
158150
@@ -161,14 +153,12 @@ private void GenerateRemoteData()
161153 str += "\n \t public struct RemoteData\n \t {" ;
162154
163155 var listRmcData = listRemoteConfigData ;
164- for ( int i = 0 ; i < listRmcData . Count ; i ++ )
165- {
156+ for ( int i = 0 ; i < listRmcData . Count ; i ++ ) {
166157 var rmcKey = listRmcData [ i ] . key ;
167158
168159 str += $ "\n \t \t public const string KEY_{ rmcKey . ToUpper ( ) } = \" { rmcKey } \" ;";
169160
170- switch ( listRmcData [ i ] . typeRemoteConfigData )
171- {
161+ switch ( listRmcData [ i ] . typeRemoteConfigData ) {
172162 case TypeRemoteConfigData . StringData :
173163 str +=
174164 $ "\n \t \t public const string DEFAULT_{ rmcKey . ToUpper ( ) } = \" { listRmcData [ i ] . defaultValueString } \" ;";
@@ -213,16 +203,14 @@ private void GenerateRemoteData()
213203 writer . Close ( ) ;
214204 AssetDatabase . ImportAsset ( productImplPath ) ;
215205
216- string GetBool ( bool condition )
217- {
206+ string GetBool ( bool condition ) {
218207 return condition ? "true" : "false" ;
219208 }
220209 }
221210#endif
222211 }
223212
224- enum TypeInitRemoteConfig
225- {
213+ enum TypeInitRemoteConfig {
226214 InitOnAwake ,
227215 InitOnStart
228216 }
0 commit comments