Skip to content

Commit f9c603a

Browse files
committed
- add Properties DependencyStatus
1 parent 27e3640 commit f9c603a

File tree

3 files changed

+23
-35
lines changed

3 files changed

+23
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
### Add the line below to `Packages/manifest.json`
2424

25-
for version `1.0.2`
25+
for version `1.0.3`
2626
```json
27-
"com.wolf-org.remote-config":"https://github.com/unity-package/remote-config-manager-unity.git#1.0.2",
27+
"com.wolf-org.remote-config":"https://github.com/unity-package/remote-config-manager-unity.git#1.0.3",
2828
```
2929
dependency `extensions-unity-1.0.5`
3030
```json

Runtime/FirebaseRemoteConfigManager.cs

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
using Firebase;
1010
using Firebase.Extensions;
1111
#endif
12+
1213
#if VIRTUESKY_FIREBASE_REMOTECONFIG
1314
using 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\tpublic 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\tpublic 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\tpublic 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
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.wolf-org.remote-config",
33
"displayName": "UnityCommon-RemoteConfig",
44
"description": "Tool support use firebase remote config for game unity",
5-
"version": "1.0.2",
5+
"version": "1.0.3",
66
"unity": "2021.3",
77
"category": "virtuesky",
88
"author": {

0 commit comments

Comments
 (0)