Skip to content

Commit 4d8178a

Browse files
committed
- update readme
1 parent e366f6f commit 4d8178a

File tree

2 files changed

+106
-7
lines changed

2 files changed

+106
-7
lines changed

README.md

+96-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,102 @@
1+
<p align="left">
2+
<a>
3+
<img alt="Made With Unity" src="https://img.shields.io/badge/made%20with-Unity-57b9d3.svg?logo=Unity">
4+
</a>
5+
<a>
6+
<img alt="License" src="https://img.shields.io/github/license/wolf-package/remote-config-manager-unity?logo=github">
7+
</a>
8+
<a>
9+
<img alt="Last Commit" src="https://img.shields.io/github/last-commit/wolf-package/remote-config-manager-unity?logo=Mapbox&color=orange">
10+
</a>
11+
<a>
12+
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/wolf-package/remote-config-manager-unity?logo=VirtualBox">
13+
</a>
14+
<a>
15+
<img alt="Last Release" src="https://img.shields.io/github/v/release/wolf-package/remote-config-manager-unity?include_prereleases&logo=Dropbox&color=yellow">
16+
</a>
17+
</p>
18+
19+
## What
20+
- Tool support use firebase remote config for game unity
121
## How To Install
222

323
### Add the line below to `Packages/manifest.json`
424

5-
for version `x.x.x`
25+
for version `1.0.0`
26+
```csharp
27+
"com.wolf-package.remote-config":"https://github.com/wolf-package/remote-config-manager-unity.git#1.0.0",
28+
```
29+
dependency `extensions-unity-1.0.1`
30+
```csharp
31+
"com.wolf-package.extensions":"https://github.com/wolf-package/extensions-unity.git#1.0.1",
32+
```
33+
If you use [game-data-unity](https://github.com/wolf-package/game-data-unity), add the library below and define symbol `VIRTUESKY_DATA`
34+
```csharp
35+
"com.wolf-package.game-data":"https://github.com/wolf-package/game-data-unity.git#1.0.0",
36+
```
37+
38+
## Use
39+
40+
- Add `Define symbol` to use remote config (`VIRTUESKY_FIREBASE`, `VIRTUESKY_FIREBASE_REMOTECONFIG`)
41+
42+
- Attach `FirebaseRemoteConfigManager` to scene (don't destroy). Please add a `Remote Config Data` to the list, then enter the key, select the corresponding data type (int, bool, string), enter the default value. Finally, click `Generate Remote Data` when you have finished setup.
43+
44+
![Screenshot 2024-05-17 112334](https://github.com/wolf-package/unity-common/assets/102142404/728f0c8e-f604-4153-acea-63feac00ab52)
45+
46+
- After clicking `Generate Remote Data`, the `RemoteData.cs` script will be automatically generated and formatted as below.
47+
648
```csharp
7-
"com.virtuesky._package_name_":"https://github.com/VirtueSky/_package_name_.git#x.x.x",
49+
50+
namespace VirtueSky.RemoteConfigs
51+
{
52+
public struct RemoteData
53+
{
54+
public const string KEY_RMC_LEVEL_TURN_ON_INTER_ADS = "RMC_LEVEL_TURN_ON_INTER_ADS";
55+
public const int DEFAULT_RMC_LEVEL_TURN_ON_INTER_ADS = 5;
56+
public static int RMC_LEVEL_TURN_ON_INTER_ADS => VirtueSky.DataStorage.GameData.Get(KEY_RMC_LEVEL_TURN_ON_INTER_ADS, DEFAULT_RMC_LEVEL_TURN_ON_INTER_ADS);
57+
public const string KEY_RMC_INTER_CAPPING_LEVEL = "RMC_INTER_CAPPING_LEVEL";
58+
public const int DEFAULT_RMC_INTER_CAPPING_LEVEL = 2;
59+
public static int RMC_INTER_CAPPING_LEVEL => VirtueSky.DataStorage.GameData.Get(KEY_RMC_INTER_CAPPING_LEVEL, DEFAULT_RMC_INTER_CAPPING_LEVEL);
60+
public const string KEY_RMC_INTER_CAPPING_TIME = "RMC_INTER_CAPPING_TIME";
61+
public const int DEFAULT_RMC_INTER_CAPPING_TIME = 8;
62+
public static int RMC_INTER_CAPPING_TIME => VirtueSky.DataStorage.GameData.Get(KEY_RMC_INTER_CAPPING_TIME, DEFAULT_RMC_INTER_CAPPING_TIME);
63+
public const string KEY_RMC_ON_OFF_INTER = "RMC_ON_OFF_INTER";
64+
public const bool DEFAULT_RMC_ON_OFF_INTER = true;
65+
public static bool RMC_ON_OFF_INTER => VirtueSky.DataStorage.GameData.Get(KEY_RMC_ON_OFF_INTER, DEFAULT_RMC_ON_OFF_INTER);
66+
public const string KEY_RMC_ON_OFF_BANNER = "RMC_ON_OFF_BANNER";
67+
public const bool DEFAULT_RMC_ON_OFF_BANNER = true;
68+
public static bool RMC_ON_OFF_BANNER => VirtueSky.DataStorage.GameData.Get(KEY_RMC_ON_OFF_BANNER, DEFAULT_RMC_ON_OFF_BANNER);
69+
public const string KEY_RMC_LEVEL_SHOW_RATE_AND_REVIEW = "RMC_LEVEL_SHOW_RATE_AND_REVIEW";
70+
public const int DEFAULT_RMC_LEVEL_SHOW_RATE_AND_REVIEW = 3;
71+
public static int RMC_LEVEL_SHOW_RATE_AND_REVIEW => VirtueSky.DataStorage.GameData.Get(KEY_RMC_LEVEL_SHOW_RATE_AND_REVIEW, DEFAULT_RMC_LEVEL_SHOW_RATE_AND_REVIEW);
72+
public const string KEY_RMC_ON_OFF_RATE_AND_REVIEW = "RMC_ON_OFF_RATE_AND_REVIEW";
73+
public const bool DEFAULT_RMC_ON_OFF_RATE_AND_REVIEW = true;
74+
public static bool RMC_ON_OFF_RATE_AND_REVIEW => VirtueSky.DataStorage.GameData.Get(KEY_RMC_ON_OFF_RATE_AND_REVIEW, DEFAULT_RMC_ON_OFF_RATE_AND_REVIEW);
75+
public const string KEY_RMC_VERSION_UPDATE = "RMC_VERSION_UPDATE";
76+
public const string DEFAULT_RMC_VERSION_UPDATE = "1.0";
77+
public static string RMC_VERSION_UPDATE => VirtueSky.DataStorage.GameData.Get(KEY_RMC_VERSION_UPDATE, DEFAULT_RMC_VERSION_UPDATE);
78+
public const string KEY_RMC_CONTENT_UPDATE = "RMC_CONTENT_UPDATE";
79+
public const string DEFAULT_RMC_CONTENT_UPDATE = "Update Content";
80+
public static string RMC_CONTENT_UPDATE => VirtueSky.DataStorage.GameData.Get(KEY_RMC_CONTENT_UPDATE, DEFAULT_RMC_CONTENT_UPDATE);
81+
}
82+
}
83+
884
```
85+
86+
- Handle
87+
88+
From the `RemoteData` script, you can retrieve `key data`, `default values`, and `data` fetched from firebase remote configuration.
89+
90+
Example
91+
92+
```csharp
93+
94+
void HandleBannerAds()
95+
{
96+
if (RemoteData.RMC_ON_OFF_BANNER)
97+
{
98+
// show banner ads
99+
}
100+
}
101+
102+
```

package.json

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "com.virtuesky._package_name_",
3-
"displayName": "__Package_Name__",
4-
"description": "__Package_Description__",
5-
"version": "x.x.x",
2+
"name": "com.wolf-package.remote-config",
3+
"displayName": "UnityCommon-RemoteConfig",
4+
"description": "Tool support use firebase remote config for game unity",
5+
"version": "1.0.0",
66
"unity": "2021.3",
77
"category": "virtuesky",
88
"author": {
@@ -11,6 +11,11 @@
1111
"url": "https://github.com/VirtueSky"
1212
},
1313
"keywords": [
14+
"Unity",
15+
"Firebase-RemoteConfig",
16+
"RemoteConfig"
1417
],
15-
"dependencies": {}
18+
"dependencies": {
19+
"com.wolf-package.extensions": "https://github.com/wolf-package/extensions-unity.git#1.0.1"
20+
}
1621
}

0 commit comments

Comments
 (0)