Skip to content

Commit 9877358

Browse files
authored
[Reviewed] [Score counter] Handle hot-reload (#1847)
- Don't show in changelog
1 parent 0b8d5b5 commit 9877358

File tree

2 files changed

+447
-448
lines changed

2 files changed

+447
-448
lines changed

extensions/reviewed/RollingCounter.json

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": "RollingCounter",
1010
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/e509cccd7fb426978c4a79b639670f624f773a886848d288a12be5c28dd7d380_sort-numeric-variant.svg",
1111
"shortDescription": "Smoothly change a counter value in a text object.",
12-
"version": "1.1.1",
12+
"version": "1.2.0",
1313
"description": "Smoothly change a counter value in a text object.",
1414
"origin": {
1515
"identifier": "RollingCounter",
@@ -26,7 +26,30 @@
2626
"dependencies": [],
2727
"globalVariables": [],
2828
"sceneVariables": [],
29-
"eventsFunctions": [],
29+
"eventsFunctions": [
30+
{
31+
"description": "Check if the events are running for the editor.",
32+
"fullName": "Editor is running",
33+
"functionType": "Condition",
34+
"name": "IsInGameEdition",
35+
"private": true,
36+
"sentence": "Events are running for the editor",
37+
"events": [
38+
{
39+
"type": "BuiltinCommonInstructions::JsCode",
40+
"inlineCode": [
41+
"const game = runtimeScene.getGame();\r",
42+
"eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();"
43+
],
44+
"parameterObjects": "",
45+
"useStrict": true,
46+
"eventsSheetExpanded": false
47+
}
48+
],
49+
"parameters": [],
50+
"objectGroups": []
51+
}
52+
],
3053
"eventsBasedBehaviors": [
3154
{
3255
"description": "Smoothly changes a counter value in a text object.",
@@ -173,29 +196,46 @@
173196
"value": "SetNumberVariable"
174197
},
175198
"parameters": [
176-
"DisplayedValue",
199+
"CounterValue",
177200
"=",
178-
"CounterValue"
201+
"Value"
179202
]
180203
},
181204
{
182205
"type": {
183206
"value": "SetNumberVariable"
184207
},
185208
"parameters": [
186-
"CounterValue",
209+
"Speed",
187210
"=",
188-
"Value"
211+
"(CounterValue - DisplayedValue) / Duration"
189212
]
190-
},
213+
}
214+
]
215+
},
216+
{
217+
"type": "BuiltinCommonInstructions::Standard",
218+
"conditions": [
191219
{
192220
"type": {
193-
"value": "SetNumberVariable"
221+
"value": "RollingCounter::IsInGameEdition"
194222
},
195223
"parameters": [
196-
"Speed",
224+
"",
225+
""
226+
]
227+
}
228+
],
229+
"actions": [
230+
{
231+
"type": {
232+
"value": "TextContainerCapability::TextContainerBehavior::SetValue"
233+
},
234+
"parameters": [
235+
"Object",
236+
"Text",
197237
"=",
198-
"(CounterValue - DisplayedValue) / Duration"
238+
"Prefix + ToString(Value) + Suffix"
199239
]
200240
}
201241
]
@@ -261,78 +301,56 @@
261301
"value": "",
262302
"type": "Behavior",
263303
"label": "Text capability",
264-
"description": "",
265-
"group": "",
266304
"extraInformation": [
267305
"TextContainerCapability::TextContainerBehavior"
268306
],
307+
"choices": [],
269308
"name": "Text"
270309
},
271310
{
272311
"value": "Score: ",
273312
"type": "String",
274313
"label": "Prefix",
275-
"description": "",
276-
"group": "",
277-
"extraInformation": [],
278314
"name": "Prefix"
279315
},
280316
{
281317
"value": "",
282318
"type": "String",
283319
"label": "Suffix",
284-
"description": "",
285-
"group": "",
286-
"extraInformation": [],
287320
"name": "Suffix"
288321
},
289322
{
290323
"value": "1",
291324
"type": "Number",
292325
"unit": "Second",
293326
"label": "Animation duration",
294-
"description": "",
295-
"group": "",
296-
"extraInformation": [],
297327
"name": "Duration"
298328
},
299329
{
300330
"value": "1",
301331
"type": "Number",
302332
"unit": "Dimensionless",
303333
"label": "Increment",
304-
"description": "",
305-
"group": "",
306-
"extraInformation": [],
307334
"name": "Increment"
308335
},
309336
{
310337
"value": "0",
311338
"type": "Number",
312339
"label": "",
313-
"description": "",
314-
"group": "",
315-
"extraInformation": [],
316340
"hidden": true,
317341
"name": "CounterValue"
318342
},
319343
{
320344
"value": "0",
321345
"type": "Number",
322346
"label": "",
323-
"description": "",
324-
"group": "",
325-
"extraInformation": [],
326347
"hidden": true,
327348
"name": "DisplayedValue"
328349
},
329350
{
330351
"value": "0",
331352
"type": "Number",
332353
"label": "",
333-
"description": "",
334-
"group": "",
335-
"extraInformation": [],
336354
"hidden": true,
337355
"name": "Speed"
338356
}

0 commit comments

Comments
 (0)