@quenty/gameconfig 12.24.3 → 12.24.4-canary.559.339cfa7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.json +27 -27
- package/src/Client/Cmdr/GameConfigCommandServiceClient.lua +21 -19
- package/src/Client/Config/Asset/GameConfigAssetClient.lua +20 -19
- package/src/Client/Config/Config/GameConfigClient.lua +4 -4
- package/src/Client/GameConfigBindersClient.lua +2 -2
- package/src/Client/GameConfigServiceClient.lua +7 -8
- package/src/Server/Cmdr/GameConfigCommandService.lua +30 -30
- package/src/Server/Config/Asset/GameConfigAsset.lua +20 -9
- package/src/Server/Config/Config/GameConfig.lua +7 -6
- package/src/Server/GameConfigBindersServer.lua +2 -2
- package/src/Server/GameConfigService.lua +16 -11
- package/src/Server/GameConfigServiceConstants.lua +3 -2
- package/src/Server/Mantle/MantleConfigProvider.lua +6 -7
- package/src/Shared/Cmdr/GameConfigCmdrUtils.lua +1 -1
- package/src/Shared/Config/Asset/GameConfigAssetBase.lua +29 -29
- package/src/Shared/Config/Asset/GameConfigAssetConstants.lua +4 -3
- package/src/Shared/Config/Asset/GameConfigAssetUtils.lua +12 -6
- package/src/Shared/Config/AssetTypes/GameConfigAssetTypeUtils.lua +15 -14
- package/src/Shared/Config/AssetTypes/GameConfigAssetTypes.lua +1 -0
- package/src/Shared/Config/Config/GameConfigBase.lua +13 -13
- package/src/Shared/Config/Config/GameConfigConstants.lua +3 -2
- package/src/Shared/Config/Config/GameConfigUtils.lua +10 -7
- package/src/Shared/Config/Picker/GameConfigPicker.lua +25 -28
- package/src/Shared/GameConfigDataService.lua +18 -7
- package/src/Shared/GameConfigTranslator.lua +7 -6
- package/test/modules/Server/TestMantleConfigProvider/init.lua +1 -1
|
@@ -9,9 +9,9 @@ local GameConfigAssetUtils = require("GameConfigAssetUtils")
|
|
|
9
9
|
local GameConfigBindersServer = require("GameConfigBindersServer")
|
|
10
10
|
local GameConfigService = require("GameConfigService")
|
|
11
11
|
local GameConfigUtils = require("GameConfigUtils")
|
|
12
|
-
local String = require("String")
|
|
13
12
|
local Maid = require("Maid")
|
|
14
|
-
local
|
|
13
|
+
local ServiceBag = require("ServiceBag")
|
|
14
|
+
local String = require("String")
|
|
15
15
|
|
|
16
16
|
local MantleConfigProvider = {}
|
|
17
17
|
MantleConfigProvider.ClassName = "MantleConfigProvider"
|
|
@@ -25,7 +25,7 @@ function MantleConfigProvider.new(container)
|
|
|
25
25
|
return self
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
function MantleConfigProvider:Init(serviceBag:
|
|
28
|
+
function MantleConfigProvider:Init(serviceBag: ServiceBag.ServiceBag)
|
|
29
29
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
30
30
|
self._gameConfigService = self._serviceBag:GetService(GameConfigService)
|
|
31
31
|
self._gameConfigBindersServer = self._serviceBag:GetService(GameConfigBindersServer)
|
|
@@ -52,7 +52,6 @@ function MantleConfigProvider:_loadConfig(item)
|
|
|
52
52
|
assert(coroutine.status(current) == "dead", "Loading the mantle config yielded")
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
|
|
56
55
|
function MantleConfigProvider:_parseDataToConfig(mantleConfigData, name)
|
|
57
56
|
assert(type(mantleConfigData) == "table", "Bad mantleConfigData")
|
|
58
57
|
|
|
@@ -94,7 +93,8 @@ function MantleConfigProvider:_parseDataToConfig(mantleConfigData, name)
|
|
|
94
93
|
return
|
|
95
94
|
end
|
|
96
95
|
|
|
97
|
-
local asset =
|
|
96
|
+
local asset =
|
|
97
|
+
GameConfigAssetUtils.create(self._gameConfigBindersServer.GameConfigAsset, assetType, assetName, assetId)
|
|
98
98
|
asset.Parent = GameConfigUtils.getOrCreateAssetFolder(gameConfig, assetType)
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -117,5 +117,4 @@ function MantleConfigProvider:Destroy()
|
|
|
117
117
|
self._maid:DoCleaning()
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
return MantleConfigProvider
|
|
120
|
+
return MantleConfigProvider
|
|
@@ -7,18 +7,18 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
7
|
|
|
8
8
|
local AttributeValue = require("AttributeValue")
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
|
+
local CancelToken = require("CancelToken")
|
|
10
11
|
local GameConfigAssetConstants = require("GameConfigAssetConstants")
|
|
12
|
+
local GameConfigAssetTypes = require("GameConfigAssetTypes")
|
|
11
13
|
local GameConfigAssetUtils = require("GameConfigAssetUtils")
|
|
12
14
|
local GameConfigTranslator = require("GameConfigTranslator")
|
|
15
|
+
local JSONTranslator = require("JSONTranslator")
|
|
16
|
+
local Observable = require("Observable")
|
|
13
17
|
local Promise = require("Promise")
|
|
14
18
|
local Rx = require("Rx")
|
|
15
19
|
local RxAttributeUtils = require("RxAttributeUtils")
|
|
16
20
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
17
|
-
local
|
|
18
|
-
local _JSONTranslator = require("JSONTranslator")
|
|
19
|
-
local _Observable = require("Observable")
|
|
20
|
-
local _ServiceBag = require("ServiceBag")
|
|
21
|
-
local _GameConfigAssetTypes = require("GameConfigAssetTypes")
|
|
21
|
+
local ServiceBag = require("ServiceBag")
|
|
22
22
|
|
|
23
23
|
local GameConfigAssetBase = setmetatable({}, BaseObject)
|
|
24
24
|
GameConfigAssetBase.ClassName = "GameConfigAssetBase"
|
|
@@ -27,13 +27,13 @@ GameConfigAssetBase.__index = GameConfigAssetBase
|
|
|
27
27
|
export type GameConfigAssetBase = typeof(setmetatable(
|
|
28
28
|
{} :: {
|
|
29
29
|
_obj: Folder,
|
|
30
|
-
_serviceBag:
|
|
30
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
31
31
|
_nameTranslationKey: AttributeValue.AttributeValue<string>,
|
|
32
32
|
_descriptionTranslationKey: AttributeValue.AttributeValue<string>,
|
|
33
|
-
_configTranslator:
|
|
33
|
+
_configTranslator: JSONTranslator.JSONTranslator,
|
|
34
34
|
},
|
|
35
35
|
{} :: typeof({ __index = GameConfigAssetBase })
|
|
36
|
-
))
|
|
36
|
+
)) & BaseObject.BaseObject
|
|
37
37
|
|
|
38
38
|
--[=[
|
|
39
39
|
Constructs a new GameConfigAssetBase. Should be done via binder. This is a base class.
|
|
@@ -41,7 +41,7 @@ export type GameConfigAssetBase = typeof(setmetatable(
|
|
|
41
41
|
@param serviceBag ServiceBag
|
|
42
42
|
@return GameConfigAssetBase
|
|
43
43
|
]=]
|
|
44
|
-
function GameConfigAssetBase.new(obj: Folder, serviceBag:
|
|
44
|
+
function GameConfigAssetBase.new(obj: Folder, serviceBag: ServiceBag.ServiceBag): GameConfigAssetBase
|
|
45
45
|
local self: GameConfigAssetBase = setmetatable(BaseObject.new(obj) :: any, GameConfigAssetBase)
|
|
46
46
|
|
|
47
47
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
@@ -57,7 +57,7 @@ end
|
|
|
57
57
|
Observes the translated name
|
|
58
58
|
@return Observable<string>
|
|
59
59
|
]=]
|
|
60
|
-
function GameConfigAssetBase:ObserveTranslatedName():
|
|
60
|
+
function GameConfigAssetBase:ObserveTranslatedName(): Observable.Observable<string>
|
|
61
61
|
return self:ObserveNameTranslationKey():Pipe({
|
|
62
62
|
Rx.switchMap(function(key)
|
|
63
63
|
return self._configTranslator:ObserveFormatByKey(key)
|
|
@@ -69,7 +69,7 @@ end
|
|
|
69
69
|
Observes the translated description
|
|
70
70
|
@return Observable<string>
|
|
71
71
|
]=]
|
|
72
|
-
function GameConfigAssetBase:ObserveTranslatedDescription():
|
|
72
|
+
function GameConfigAssetBase:ObserveTranslatedDescription(): Observable.Observable<string>
|
|
73
73
|
return self:ObserveDescriptionTranslationKey():Pipe({
|
|
74
74
|
Rx.switchMap(function(key)
|
|
75
75
|
return self._configTranslator:ObserveFormatByKey(key)
|
|
@@ -112,7 +112,7 @@ end
|
|
|
112
112
|
Observes the assetId
|
|
113
113
|
@return Observable<number>
|
|
114
114
|
]=]
|
|
115
|
-
function GameConfigAssetBase:ObserveAssetId():
|
|
115
|
+
function GameConfigAssetBase:ObserveAssetId(): Observable.Observable<number>
|
|
116
116
|
return RxAttributeUtils.observeAttribute(self._obj, GameConfigAssetConstants.ASSET_ID_ATTRIBUTE, nil)
|
|
117
117
|
end
|
|
118
118
|
|
|
@@ -128,7 +128,7 @@ end
|
|
|
128
128
|
Observes the asset type
|
|
129
129
|
@return Observable<string?>
|
|
130
130
|
]=]
|
|
131
|
-
function GameConfigAssetBase:ObserveAssetType():
|
|
131
|
+
function GameConfigAssetBase:ObserveAssetType(): Observable.Observable<string?>
|
|
132
132
|
return RxAttributeUtils.observeAttribute(self._obj, GameConfigAssetConstants.ASSET_TYPE_ATTRIBUTE, nil)
|
|
133
133
|
end
|
|
134
134
|
|
|
@@ -136,7 +136,7 @@ end
|
|
|
136
136
|
Observes the asset key
|
|
137
137
|
@return Observable<string>
|
|
138
138
|
]=]
|
|
139
|
-
function GameConfigAssetBase:ObserveAssetKey():
|
|
139
|
+
function GameConfigAssetBase:ObserveAssetKey(): Observable.Observable<string>
|
|
140
140
|
return RxInstanceUtils.observeProperty(self._obj, "Name")
|
|
141
141
|
end
|
|
142
142
|
|
|
@@ -151,14 +151,14 @@ end
|
|
|
151
151
|
export type GameConfigAssetState = {
|
|
152
152
|
assetId: number,
|
|
153
153
|
assetKey: string,
|
|
154
|
-
assetType:
|
|
154
|
+
assetType: GameConfigAssetTypes.GameConfigAssetType,
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
--[=[
|
|
158
158
|
Observes the asset state
|
|
159
159
|
@return any
|
|
160
160
|
]=]
|
|
161
|
-
function GameConfigAssetBase:ObserveState():
|
|
161
|
+
function GameConfigAssetBase:ObserveState(): Observable.Observable<GameConfigAssetState>
|
|
162
162
|
return Rx.combineLatest({
|
|
163
163
|
assetId = self:ObserveAssetId(),
|
|
164
164
|
assetKey = self:ObserveAssetKey(),
|
|
@@ -171,7 +171,7 @@ end
|
|
|
171
171
|
@param cancelToken CancelToken
|
|
172
172
|
@return Promise<number?>
|
|
173
173
|
]=]
|
|
174
|
-
function GameConfigAssetBase:PromiseCloudPriceInRobux(cancelToken:
|
|
174
|
+
function GameConfigAssetBase:PromiseCloudPriceInRobux(cancelToken: CancelToken.CancelToken): Promise.Promise<number>
|
|
175
175
|
return Rx.toPromise(self:ObserveCloudPriceInRobux(), cancelToken)
|
|
176
176
|
end
|
|
177
177
|
|
|
@@ -180,7 +180,7 @@ end
|
|
|
180
180
|
@param cancelToken CancelToken
|
|
181
181
|
@return Promise<string?>
|
|
182
182
|
]=]
|
|
183
|
-
function GameConfigAssetBase:PromiseCloudName(cancelToken:
|
|
183
|
+
function GameConfigAssetBase:PromiseCloudName(cancelToken: CancelToken.CancelToken): Promise.Promise<string>
|
|
184
184
|
return Rx.toPromise(self:ObserveCloudName(), cancelToken)
|
|
185
185
|
end
|
|
186
186
|
--[=[
|
|
@@ -188,7 +188,7 @@ end
|
|
|
188
188
|
@param _cancelToken CancelToken
|
|
189
189
|
@return Promise<Color3>
|
|
190
190
|
]=]
|
|
191
|
-
function GameConfigAssetBase:PromiseColor(_cancelToken:
|
|
191
|
+
function GameConfigAssetBase:PromiseColor(_cancelToken: CancelToken.CancelToken): Promise.Promise<Color3>
|
|
192
192
|
return Promise.resolved(Color3.fromRGB(66, 158, 166))
|
|
193
193
|
end
|
|
194
194
|
|
|
@@ -197,7 +197,7 @@ end
|
|
|
197
197
|
@param cancelToken CancelToken
|
|
198
198
|
@return Promise<string?>
|
|
199
199
|
]=]
|
|
200
|
-
function GameConfigAssetBase:PromiseNameTranslationKey(cancelToken:
|
|
200
|
+
function GameConfigAssetBase:PromiseNameTranslationKey(cancelToken: CancelToken.CancelToken): Promise.Promise<string>
|
|
201
201
|
return Rx.toPromise(self:ObserveNameTranslationKey(), cancelToken)
|
|
202
202
|
end
|
|
203
203
|
|
|
@@ -205,7 +205,7 @@ end
|
|
|
205
205
|
Observes the name translation key.
|
|
206
206
|
@return Observable<string?>
|
|
207
207
|
]=]
|
|
208
|
-
function GameConfigAssetBase:ObserveNameTranslationKey():
|
|
208
|
+
function GameConfigAssetBase:ObserveNameTranslationKey(): Observable.Observable<string?>
|
|
209
209
|
return self._nameTranslationKey:Observe()
|
|
210
210
|
end
|
|
211
211
|
|
|
@@ -213,7 +213,7 @@ end
|
|
|
213
213
|
Observes the description translation key.
|
|
214
214
|
@return Observable<string?>
|
|
215
215
|
]=]
|
|
216
|
-
function GameConfigAssetBase:ObserveDescriptionTranslationKey():
|
|
216
|
+
function GameConfigAssetBase:ObserveDescriptionTranslationKey(): Observable.Observable<string?>
|
|
217
217
|
return self._descriptionTranslationKey:Observe()
|
|
218
218
|
end
|
|
219
219
|
|
|
@@ -222,7 +222,7 @@ end
|
|
|
222
222
|
translation keys.
|
|
223
223
|
@return Observable<string?>
|
|
224
224
|
]=]
|
|
225
|
-
function GameConfigAssetBase:ObserveCloudName():
|
|
225
|
+
function GameConfigAssetBase:ObserveCloudName(): Observable.Observable<string?>
|
|
226
226
|
return self:_observeCloudProperty({ "Name" }, "string")
|
|
227
227
|
end
|
|
228
228
|
|
|
@@ -231,7 +231,7 @@ end
|
|
|
231
231
|
translation keys.
|
|
232
232
|
@return Observable<string?>
|
|
233
233
|
]=]
|
|
234
|
-
function GameConfigAssetBase:ObserveCloudDescription():
|
|
234
|
+
function GameConfigAssetBase:ObserveCloudDescription(): Observable.Observable<string?>
|
|
235
235
|
return self:_observeCloudProperty({ "Description" }, "string")
|
|
236
236
|
end
|
|
237
237
|
|
|
@@ -239,21 +239,21 @@ end
|
|
|
239
239
|
Observes the cost in Robux.
|
|
240
240
|
@return Observable<number?>
|
|
241
241
|
]=]
|
|
242
|
-
function GameConfigAssetBase:ObserveCloudPriceInRobux():
|
|
242
|
+
function GameConfigAssetBase:ObserveCloudPriceInRobux(): Observable.Observable<number?>
|
|
243
243
|
return self:_observeCloudProperty({ "PriceInRobux" }, "number")
|
|
244
244
|
end
|
|
245
245
|
|
|
246
246
|
--[=[
|
|
247
247
|
@return Observable<number?>
|
|
248
248
|
]=]
|
|
249
|
-
function GameConfigAssetBase:ObserveCloudIconImageAssetId():
|
|
249
|
+
function GameConfigAssetBase:ObserveCloudIconImageAssetId(): Observable.Observable<number?>
|
|
250
250
|
return self:_observeCloudProperty({ "IconImageAssetId", "IconImageId" }, "number")
|
|
251
251
|
end
|
|
252
252
|
|
|
253
253
|
function GameConfigAssetBase:_observeCloudProperty(
|
|
254
254
|
propertyNameList: { string },
|
|
255
255
|
expectedType: string
|
|
256
|
-
):
|
|
256
|
+
): Observable.Observable<any?>
|
|
257
257
|
assert(type(propertyNameList) == "table", "Bad propertyNameList")
|
|
258
258
|
assert(type(expectedType) == "string", "Bad expectedType")
|
|
259
259
|
|
|
@@ -275,7 +275,7 @@ function GameConfigAssetBase:_observeCloudProperty(
|
|
|
275
275
|
})
|
|
276
276
|
end
|
|
277
277
|
|
|
278
|
-
function GameConfigAssetBase:_observeCloudDataFromState():
|
|
278
|
+
function GameConfigAssetBase:_observeCloudDataFromState(): Observable.Observable<any?>
|
|
279
279
|
if self._cloudDataObservable then
|
|
280
280
|
return self._cloudDataObservable
|
|
281
281
|
end
|
|
@@ -303,4 +303,4 @@ function GameConfigAssetBase:_promiseCloudDataForState(state: GameConfigAssetSta
|
|
|
303
303
|
return GameConfigAssetUtils.promiseCloudDataForAssetType(self._serviceBag, state.assetType, state.assetId)
|
|
304
304
|
end
|
|
305
305
|
|
|
306
|
-
return GameConfigAssetBase
|
|
306
|
+
return GameConfigAssetBase
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@class GameConfigAssetConstants
|
|
3
4
|
]=]
|
|
@@ -7,6 +8,6 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
8
|
local Table = require("Table")
|
|
8
9
|
|
|
9
10
|
return Table.readonly({
|
|
10
|
-
ASSET_TYPE_ATTRIBUTE = "AssetType"
|
|
11
|
-
ASSET_ID_ATTRIBUTE = "AssetId"
|
|
12
|
-
})
|
|
11
|
+
ASSET_TYPE_ATTRIBUTE = "AssetType",
|
|
12
|
+
ASSET_ID_ATTRIBUTE = "AssetId",
|
|
13
|
+
})
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
7
|
local AttributeUtils = require("AttributeUtils")
|
|
8
|
-
local GameConfigAssetConstants = require("GameConfigAssetConstants")
|
|
9
8
|
local BadgeUtils = require("BadgeUtils")
|
|
9
|
+
local GameConfigAssetConstants = require("GameConfigAssetConstants")
|
|
10
10
|
local GameConfigAssetTypes = require("GameConfigAssetTypes")
|
|
11
11
|
local MarketplaceServiceCache = require("MarketplaceServiceCache")
|
|
12
12
|
local Promise = require("Promise")
|
|
13
|
-
local
|
|
13
|
+
local ServiceBag = require("ServiceBag")
|
|
14
14
|
|
|
15
15
|
local GameConfigAssetUtils = {}
|
|
16
16
|
|
|
@@ -47,7 +47,11 @@ end
|
|
|
47
47
|
@param assetId number
|
|
48
48
|
@return Promise<any>
|
|
49
49
|
]=]
|
|
50
|
-
function GameConfigAssetUtils.promiseCloudDataForAssetType(
|
|
50
|
+
function GameConfigAssetUtils.promiseCloudDataForAssetType(
|
|
51
|
+
serviceBag: ServiceBag.ServiceBag,
|
|
52
|
+
assetType: GameConfigAssetTypes.GameConfigAssetType,
|
|
53
|
+
assetId: number
|
|
54
|
+
): Promise.Promise<any>
|
|
51
55
|
assert(type(assetType) == "string", "Bad assetType")
|
|
52
56
|
assert(type(assetId) == "number", "Bad assetId")
|
|
53
57
|
|
|
@@ -67,11 +71,13 @@ function GameConfigAssetUtils.promiseCloudDataForAssetType(serviceBag: _ServiceB
|
|
|
67
71
|
elseif assetType == GameConfigAssetTypes.BUNDLE then
|
|
68
72
|
return marketplaceServiceCache:PromiseProductInfo(assetId, Enum.InfoType.Bundle)
|
|
69
73
|
else
|
|
70
|
-
local errorMessage = string.format(
|
|
71
|
-
|
|
74
|
+
local errorMessage = string.format(
|
|
75
|
+
"[GameConfigAssetUtils.promiseCloudDataForAssetType] - Unknown GameConfigAssetType %q. Ignoring asset.",
|
|
76
|
+
tostring(assetType)
|
|
77
|
+
)
|
|
72
78
|
|
|
73
79
|
return Promise.rejected(errorMessage)
|
|
74
80
|
end
|
|
75
81
|
end
|
|
76
82
|
|
|
77
|
-
return GameConfigAssetUtils
|
|
83
|
+
return GameConfigAssetUtils
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@class GameConfigAssetTypeUtils
|
|
3
4
|
]=]
|
|
@@ -8,18 +9,18 @@ local GameConfigAssetTypes = require("GameConfigAssetTypes")
|
|
|
8
9
|
|
|
9
10
|
local GameConfigAssetTypeUtils = {}
|
|
10
11
|
|
|
11
|
-
local pluralMap = {
|
|
12
|
-
[GameConfigAssetTypes.BADGE] = "badges"
|
|
13
|
-
[GameConfigAssetTypes.PRODUCT] = "products"
|
|
14
|
-
[GameConfigAssetTypes.PASS] = "passes"
|
|
15
|
-
[GameConfigAssetTypes.PLACE] = "places"
|
|
16
|
-
[GameConfigAssetTypes.ASSET] = "assets"
|
|
17
|
-
[GameConfigAssetTypes.BUNDLE] = "bundles"
|
|
18
|
-
[GameConfigAssetTypes.SUBSCRIPTION] = "subscriptions"
|
|
19
|
-
[GameConfigAssetTypes.MEMBERSHIP] = "memberships"
|
|
12
|
+
local pluralMap: { [GameConfigAssetTypes.GameConfigAssetType]: string } = {
|
|
13
|
+
[GameConfigAssetTypes.BADGE] = "badges",
|
|
14
|
+
[GameConfigAssetTypes.PRODUCT] = "products",
|
|
15
|
+
[GameConfigAssetTypes.PASS] = "passes",
|
|
16
|
+
[GameConfigAssetTypes.PLACE] = "places",
|
|
17
|
+
[GameConfigAssetTypes.ASSET] = "assets",
|
|
18
|
+
[GameConfigAssetTypes.BUNDLE] = "bundles",
|
|
19
|
+
[GameConfigAssetTypes.SUBSCRIPTION] = "subscriptions",
|
|
20
|
+
[GameConfigAssetTypes.MEMBERSHIP] = "memberships",
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
for _, item in GameConfigAssetTypes do
|
|
23
|
+
for _, item: any in GameConfigAssetTypes do
|
|
23
24
|
assert(pluralMap[item], "Missing plural")
|
|
24
25
|
end
|
|
25
26
|
|
|
@@ -29,8 +30,8 @@ end
|
|
|
29
30
|
@param assetType any
|
|
30
31
|
@return boolean
|
|
31
32
|
]=]
|
|
32
|
-
function GameConfigAssetTypeUtils.isAssetType(assetType)
|
|
33
|
-
return type(assetType) == "string" and pluralMap[assetType] ~= nil
|
|
33
|
+
function GameConfigAssetTypeUtils.isAssetType(assetType: any): boolean
|
|
34
|
+
return type(assetType) == "string" and pluralMap[assetType :: any] ~= nil
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
--[=[
|
|
@@ -39,8 +40,8 @@ end
|
|
|
39
40
|
@param assetType GameConfigAssetType
|
|
40
41
|
@return string
|
|
41
42
|
]=]
|
|
42
|
-
function GameConfigAssetTypeUtils.getPlural(assetType)
|
|
43
|
+
function GameConfigAssetTypeUtils.getPlural(assetType: GameConfigAssetTypes.GameConfigAssetType): string
|
|
43
44
|
return pluralMap[assetType] or error("Bad assetType")
|
|
44
45
|
end
|
|
45
46
|
|
|
46
|
-
return GameConfigAssetTypeUtils
|
|
47
|
+
return GameConfigAssetTypeUtils
|
|
@@ -6,18 +6,18 @@ local require = require(script.Parent.loader).load(script)
|
|
|
6
6
|
|
|
7
7
|
local AttributeValue = require("AttributeValue")
|
|
8
8
|
local BaseObject = require("BaseObject")
|
|
9
|
-
local
|
|
9
|
+
local Brio = require("Brio")
|
|
10
|
+
local GameConfigAssetBase = require("GameConfigAssetBase")
|
|
10
11
|
local GameConfigAssetTypeUtils = require("GameConfigAssetTypeUtils")
|
|
12
|
+
local GameConfigAssetTypes = require("GameConfigAssetTypes")
|
|
11
13
|
local GameConfigConstants = require("GameConfigConstants")
|
|
12
14
|
local GameConfigUtils = require("GameConfigUtils")
|
|
15
|
+
local Observable = require("Observable")
|
|
13
16
|
local ObservableMapSet = require("ObservableMapSet")
|
|
14
17
|
local Rx = require("Rx")
|
|
15
18
|
local RxBinderUtils = require("RxBinderUtils")
|
|
16
19
|
local RxBrioUtils = require("RxBrioUtils")
|
|
17
20
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
18
|
-
local _GameConfigAssetBase = require("GameConfigAssetBase")
|
|
19
|
-
local _Observable = require("Observable")
|
|
20
|
-
local _Brio = require("Brio")
|
|
21
21
|
|
|
22
22
|
local GameConfigBase = setmetatable({}, BaseObject)
|
|
23
23
|
GameConfigBase.ClassName = "GameConfigBase"
|
|
@@ -25,7 +25,7 @@ GameConfigBase.__index = GameConfigBase
|
|
|
25
25
|
|
|
26
26
|
type GameConfigAssetType = GameConfigAssetTypes.GameConfigAssetType
|
|
27
27
|
type ObservableMapSet<K, V> = ObservableMapSet.ObservableMapSet<K, V>
|
|
28
|
-
type GameConfigAssetBase =
|
|
28
|
+
type GameConfigAssetBase = GameConfigAssetBase.GameConfigAssetBase
|
|
29
29
|
|
|
30
30
|
export type GameConfigBase = typeof(setmetatable(
|
|
31
31
|
{} :: {
|
|
@@ -146,7 +146,7 @@ function GameConfigBase.ObserveAssetByTypeAndKeyBrio(
|
|
|
146
146
|
self: GameConfigBase,
|
|
147
147
|
assetType: GameConfigAssetType,
|
|
148
148
|
assetKey: string
|
|
149
|
-
):
|
|
149
|
+
): Observable.Observable<Brio.Brio<GameConfigAssetBase>>
|
|
150
150
|
assert(GameConfigAssetTypeUtils.isAssetType(assetType), "Bad assetType")
|
|
151
151
|
assert(type(assetKey) == "string", "Bad assetKey")
|
|
152
152
|
|
|
@@ -163,7 +163,7 @@ function GameConfigBase.ObserveAssetByTypeAndIdBrio(
|
|
|
163
163
|
self: GameConfigBase,
|
|
164
164
|
assetType: GameConfigAssetType,
|
|
165
165
|
assetId: number
|
|
166
|
-
):
|
|
166
|
+
): Observable.Observable<Brio.Brio<GameConfigAssetBase>>
|
|
167
167
|
assert(GameConfigAssetTypeUtils.isAssetType(assetType), "Bad assetType")
|
|
168
168
|
assert(type(assetId) == "number", "Bad assetId")
|
|
169
169
|
|
|
@@ -178,7 +178,7 @@ end
|
|
|
178
178
|
function GameConfigBase.ObserveAssetByIdBrio(
|
|
179
179
|
self: GameConfigBase,
|
|
180
180
|
assetId: number
|
|
181
|
-
):
|
|
181
|
+
): Observable.Observable<Brio.Brio<GameConfigAssetBase>>
|
|
182
182
|
assert(type(assetId) == "number", "Bad assetId")
|
|
183
183
|
|
|
184
184
|
return self._assetIdToAssetConfig:ObserveItemsForKeyBrio(assetId)
|
|
@@ -192,7 +192,7 @@ end
|
|
|
192
192
|
function GameConfigBase.ObserveAssetByKeyBrio(
|
|
193
193
|
self: GameConfigBase,
|
|
194
194
|
assetKey: string
|
|
195
|
-
):
|
|
195
|
+
): Observable.Observable<Brio.Brio<GameConfigAssetBase>>
|
|
196
196
|
assert(type(assetKey) == "string", "Bad assetKey")
|
|
197
197
|
|
|
198
198
|
return self._assetKeyToAssetConfig:ObserveItemsForKeyBrio(assetKey)
|
|
@@ -206,7 +206,7 @@ end
|
|
|
206
206
|
function GameConfigBase.ObserveAssetByTypeBrio(
|
|
207
207
|
self: GameConfigBase,
|
|
208
208
|
assetType: GameConfigAssetType
|
|
209
|
-
):
|
|
209
|
+
): Observable.Observable<Brio.Brio<GameConfigAssetBase>>
|
|
210
210
|
assert(GameConfigAssetTypeUtils.isAssetType(assetType), "Bad assetType")
|
|
211
211
|
|
|
212
212
|
return self._assetTypeToAssetConfig:ObserveItemsForKeyBrio(assetType)
|
|
@@ -257,7 +257,7 @@ end
|
|
|
257
257
|
Returns the game id for this profile.
|
|
258
258
|
@return Observable<number>
|
|
259
259
|
]=]
|
|
260
|
-
function GameConfigBase.ObserveGameId(self: GameConfigBase):
|
|
260
|
+
function GameConfigBase.ObserveGameId(self: GameConfigBase): Observable.Observable<number>
|
|
261
261
|
return self._gameId:Observe()
|
|
262
262
|
end
|
|
263
263
|
|
|
@@ -281,7 +281,7 @@ end
|
|
|
281
281
|
Observes this configs name
|
|
282
282
|
@return Observable<string>
|
|
283
283
|
]=]
|
|
284
|
-
function GameConfigBase.ObserveConfigName(self: GameConfigBase):
|
|
284
|
+
function GameConfigBase.ObserveConfigName(self: GameConfigBase): Observable.Observable<string>
|
|
285
285
|
return RxInstanceUtils.observeProperty(self._obj, "Name")
|
|
286
286
|
end
|
|
287
287
|
|
|
@@ -289,4 +289,4 @@ function GameConfigBase.GetGameConfigAssetBinder(_self: GameConfigBase)
|
|
|
289
289
|
error("Not implemented")
|
|
290
290
|
end
|
|
291
291
|
|
|
292
|
-
return GameConfigBase
|
|
292
|
+
return GameConfigBase
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
@class GameConfigConstants
|
|
3
4
|
]=]
|
|
@@ -7,5 +8,5 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
8
|
local Table = require("Table")
|
|
8
9
|
|
|
9
10
|
return Table.readonly({
|
|
10
|
-
GAME_ID_ATTRIBUTE = "GameId"
|
|
11
|
-
})
|
|
11
|
+
GAME_ID_ATTRIBUTE = "GameId",
|
|
12
|
+
})
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
7
|
local AttributeUtils = require("AttributeUtils")
|
|
8
|
-
local GameConfigConstants = require("GameConfigConstants")
|
|
9
|
-
local GameConfigAssetTypes = require("GameConfigAssetTypes")
|
|
10
|
-
local GameConfigAssetTypeUtils = require("GameConfigAssetTypeUtils")
|
|
11
8
|
local Binder = require("Binder")
|
|
9
|
+
local Brio = require("Brio")
|
|
10
|
+
local GameConfigAssetTypeUtils = require("GameConfigAssetTypeUtils")
|
|
11
|
+
local GameConfigAssetTypes = require("GameConfigAssetTypes")
|
|
12
|
+
local GameConfigConstants = require("GameConfigConstants")
|
|
13
|
+
local Observable = require("Observable")
|
|
12
14
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
13
|
-
local _Observable = require("Observable")
|
|
14
|
-
local _Brio = require("Brio")
|
|
15
15
|
|
|
16
16
|
local GameConfigUtils = {}
|
|
17
17
|
|
|
@@ -52,7 +52,10 @@ function GameConfigUtils.getOrCreateAssetFolder(
|
|
|
52
52
|
return folder
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
function GameConfigUtils.observeAssetFolderBrio(
|
|
55
|
+
function GameConfigUtils.observeAssetFolderBrio(
|
|
56
|
+
config: Folder,
|
|
57
|
+
assetType: GameConfigAssetTypes.GameConfigAssetType
|
|
58
|
+
): Observable.Observable<Brio.Brio<Folder>>
|
|
56
59
|
assert(typeof(config) == "Instance", "Bad config")
|
|
57
60
|
assert(GameConfigAssetTypeUtils.isAssetType(assetType), "Bad assetType")
|
|
58
61
|
|
|
@@ -61,4 +64,4 @@ function GameConfigUtils.observeAssetFolderBrio(config: Folder, assetType: GameC
|
|
|
61
64
|
return RxInstanceUtils.observeLastNamedChildBrio(config, "Folder", folderName)
|
|
62
65
|
end
|
|
63
66
|
|
|
64
|
-
return GameConfigUtils
|
|
67
|
+
return GameConfigUtils
|