mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
9 Commits
limit-buil
...
rename-obj
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4c5f624b34 | ||
![]() |
0928247ee1 | ||
![]() |
2ae7b1a862 | ||
![]() |
00e664ef52 | ||
![]() |
ed8e272740 | ||
![]() |
84e9373f7e | ||
![]() |
d31e816790 | ||
![]() |
9b26c82597 | ||
![]() |
0054324df8 |
4
.github/workflows/build-storybook.yml
vendored
4
.github/workflows/build-storybook.yml
vendored
@@ -57,8 +57,8 @@ jobs:
|
||||
|
||||
- name: Log urls to the Storybook
|
||||
run: |
|
||||
echo "Find the latest Storybook for this branch on https://gdevelop-storybook.s3.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/latest/index.html"
|
||||
echo "Find the Storybook for this commit on https://gdevelop-storybook.s3.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/index.html"
|
||||
echo "Find the latest Storybook for this branch on http://gdevelop-storybook.s3-website-us-east-1.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/latest/index.html"
|
||||
echo "Find the Storybook for this commit on http://gdevelop-storybook.s3-website-us-east-1.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/index.html"
|
||||
|
||||
# Publish on Chromatic, only when manually launched (too costly to run on every commit).
|
||||
- name: Publish Storybook to Chromatic
|
||||
|
@@ -15,13 +15,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAsyncExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinAsync",
|
||||
_("Asynchronous functions"),
|
||||
_("Async functions"),
|
||||
_("Functions that defer the execution of the events after it."),
|
||||
"Arthur Pacaud (arthuro555)",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("Advanced");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Asynchronous functions"))
|
||||
.SetIcon("res/function32.png");
|
||||
|
||||
extension.AddEvent("Async",
|
||||
_("Async event"),
|
||||
@@ -29,18 +27,6 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAsyncExtension(
|
||||
"",
|
||||
"res/eventaddicon.png",
|
||||
std::make_shared<gd::AsyncEvent>());
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"ResolveAsyncEventsFunction",
|
||||
_("End asynchronous function"),
|
||||
_("Mark an asynchronous function as finished. This will allow the "
|
||||
"actions and subevents following it to be run."),
|
||||
"Mark asynchronous function as ended",
|
||||
"",
|
||||
"res/actions/quit24.png",
|
||||
"res/actions/quit.png")
|
||||
.AddCodeOnlyParameter("eventsFunctionContext", "");
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -406,8 +406,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ModVarObjet",
|
||||
_("Change number variable"),
|
||||
_("Modify the number value of an object variable."),
|
||||
_("Value of an object variable"),
|
||||
_("Change the value of an object variable."),
|
||||
_("the variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -419,8 +419,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ModVarObjetTxt",
|
||||
_("Change text variable"),
|
||||
_("Modify the text of an object variable."),
|
||||
_("Text of an object variable"),
|
||||
_("Change the text of an object variable."),
|
||||
_("the text of variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -432,8 +432,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("SetObjectVariableAsBoolean",
|
||||
_("Change boolean variable"),
|
||||
_("Modify the boolean value of an object variable."),
|
||||
_("Boolean value of an object variable"),
|
||||
_("Change the boolean value of an object variable."),
|
||||
_("Set the boolean value of variable _PARAM1_ of "
|
||||
"_PARAM0_ to _PARAM2_"),
|
||||
_("Variables"),
|
||||
@@ -446,7 +446,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
obj.AddAction(
|
||||
"ToggleObjectVariableAsBoolean",
|
||||
_("Toggle boolean variable"),
|
||||
_("Toggle the boolean value of an object variable"),
|
||||
_("Toggles the boolean value of an object variable.") + "\n" +
|
||||
_("If it was true, it will become false, and if it was false "
|
||||
"it will become true."),
|
||||
@@ -461,39 +461,37 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
obj.AddCondition("ObjectVariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the object "
|
||||
"structure variable exists."),
|
||||
_("Check if the specified child of the variable exists."),
|
||||
_("Child _PARAM2_ of variable _PARAM1_ of _PARAM0_ exists"),
|
||||
_("Variables/Arrays and structures"),
|
||||
_("Variables/Collections/Structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Structure variable"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("string", _("Name of the child"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ObjectVariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from an object structure variable."),
|
||||
_("Remove a child from an object variable."),
|
||||
_("Remove child _PARAM2_ from variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
_("Variables/Collections/Structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Structure variable"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("string", _("Child's name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ObjectVariableClearChildren",
|
||||
_("Clear children"),
|
||||
_("Remove all the children from the object array or structure "
|
||||
"variable."),
|
||||
_("Clear variable"),
|
||||
_("Remove all the children from the object variable."),
|
||||
_("Clear children from variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
_("Variables/Collections"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array or structure variable"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("Cache",
|
||||
@@ -621,8 +619,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("VarObjet",
|
||||
_("Number variable"),
|
||||
_("Compare the number value of an object variable."),
|
||||
_("Value of an object variable"),
|
||||
_("Compare the value of an object variable."),
|
||||
_("the variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -634,7 +632,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("VarObjetTxt",
|
||||
_("Text variable"),
|
||||
_("Text of an object variable"),
|
||||
_("Compare the text of an object variable."),
|
||||
_("the text of variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
@@ -647,7 +645,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"string", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("ObjectVariableAsBoolean",
|
||||
_("Boolean variable"),
|
||||
_("Boolean value of an object variable"),
|
||||
_("Compare the boolean value of an object variable."),
|
||||
_("The boolean value of variable _PARAM1_ of object "
|
||||
"_PARAM0_ is _PARAM2_"),
|
||||
@@ -661,7 +659,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
obj.AddCondition("VarObjetDef",
|
||||
"Variable defined",
|
||||
"Check if the object variable is defined.",
|
||||
"Check if the variable is defined.",
|
||||
"Variable _PARAM1 of _PARAM0_ is defined",
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -669,131 +667,78 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("string", _("Variable"))
|
||||
.SetHidden(); // Deprecated.
|
||||
.SetHidden();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariablePush",
|
||||
_("Add existing variable"),
|
||||
_("Adds an existing variable to the end of an object array variable."),
|
||||
_("Add variable _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
_("Append variable to an object array"),
|
||||
_("Appends a variable to the end of an object array variable."),
|
||||
_("Append variable _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to add"))
|
||||
.SetParameterLongDescription(_("The content of the object variable will "
|
||||
"*be copied* and added at the "
|
||||
"end of the array."))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to append"))
|
||||
.SetParameterLongDescription(
|
||||
_("The content of the variable will *be copied* and appended at the "
|
||||
"end of the array."))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariablePushString",
|
||||
_("Add text variable"),
|
||||
_("Adds a text (string) to the end of an object array variable."),
|
||||
_("Add text _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
_("Append a string to an object array"),
|
||||
_("Appends a string to the end of an object array variable."),
|
||||
_("Append string _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("string", _("Text to add"))
|
||||
.AddParameter("string", _("String to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ObjectVariablePushNumber",
|
||||
_("Add number variable"),
|
||||
_("Adds a number to the end of an object array variable."),
|
||||
_("Add number _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
obj.AddAction(
|
||||
"ObjectVariablePushNumber",
|
||||
_("Append a number to an object array"),
|
||||
_("Appends a number to the end of an object array variable."),
|
||||
_("Append number _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("expression", _("Number to add"))
|
||||
.AddParameter("expression", _("Number to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariablePushBool",
|
||||
_("Add boolean variable"),
|
||||
_("Adds a boolean to the end of an object array variable."),
|
||||
_("Add boolean _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
_("Append a boolean to an object array"),
|
||||
_("Appends a boolean to the end of an object array variable."),
|
||||
_("Append boolean _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("trueorfalse", _("Boolean to add"))
|
||||
.AddParameter("trueorfalse", _("Boolean to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariableRemoveAt",
|
||||
_("Remove variable by index"),
|
||||
_("Remove variable from an object array (by index)"),
|
||||
_("Removes a variable at the specified index of an object array "
|
||||
"variable."),
|
||||
_("Remove variable at index _PARAM2_ from array variable _PARAM1_ of "
|
||||
"_PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition(
|
||||
"ObjectVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Compare the number of children in an object array variable."),
|
||||
_("The number of children in the array variable _PARAM1_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddStrExpression(
|
||||
"ArrayVariableFirstString",
|
||||
_("First text child"),
|
||||
_("Get the value of the first element of an object array variable, if "
|
||||
"it is a text (string) variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddExpression(
|
||||
"ArrayVariableFirstNumber",
|
||||
_("First number child"),
|
||||
_("Get the value of the first element of an object array variable, if "
|
||||
"it is a number variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddStrExpression(
|
||||
"ArrayVariableLastString",
|
||||
_("Last text child"),
|
||||
_("Get the value of the last element of an object array variable, if "
|
||||
"it is a text (string) variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddExpression(
|
||||
"ArrayVariableLastNumber",
|
||||
_("Last number child"),
|
||||
_("Get the value of the last element of an object array variable, if "
|
||||
"it is a number variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddCondition("BehaviorActivated",
|
||||
_("Behavior activated"),
|
||||
_("Check if the behavior is activated for the object."),
|
||||
@@ -1170,24 +1115,23 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("expression", _("Target Y position"));
|
||||
|
||||
obj.AddExpression("Variable",
|
||||
_("Number variable"),
|
||||
_("Number value of an object variable"),
|
||||
_("Value of an object variable"),
|
||||
_("Value of an object variable"),
|
||||
_("Variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"));
|
||||
|
||||
obj.AddExpression(
|
||||
"VariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Number of children in an object array or structure variable"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
obj.AddExpression("VariableChildCount",
|
||||
_("Number of children of an object variable"),
|
||||
_("Number of children of an object variable"),
|
||||
_("Variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array or structure variable"));
|
||||
.AddParameter("objectvar", _("Variable"));
|
||||
|
||||
obj.AddStrExpression("VariableString",
|
||||
_("Text variable"),
|
||||
_("Text of an object variable"),
|
||||
_("Text of an object variable"),
|
||||
_("Variables"),
|
||||
"res/actions/var.png")
|
||||
@@ -1349,8 +1293,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/actions/create24.png",
|
||||
"res/actions/create24.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter("objectListOrEmptyIfJustDeclared",
|
||||
_("Group of potential objects"))
|
||||
.AddParameter("objectListOrEmptyIfJustDeclared", _("Group of potential objects"))
|
||||
.SetParameterLongDescription(
|
||||
_("Group containing objects that can be created by the action."))
|
||||
.AddParameter("string", _("Name of the object to create"))
|
||||
|
@@ -197,13 +197,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
extension.AddDuplicatedExpression("SourisY", "CursorY").SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpressionAndCondition("number",
|
||||
"MouseOnlyCursorX",
|
||||
_("Mouse cursor X position"),
|
||||
_("the X position of the mouse cursor"),
|
||||
_("the mouse cursor X position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"MouseOnlyCursorX",
|
||||
_("Mouse cursor X position"),
|
||||
_("the X position of the mouse cursor"),
|
||||
_("the mouse cursor X position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
@@ -214,13 +215,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpressionAndCondition("number",
|
||||
"MouseOnlyCursorY",
|
||||
_("Mouse cursor Y position"),
|
||||
_("the Y position of the mouse cursor"),
|
||||
_("the mouse cursor Y position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"MouseOnlyCursorY",
|
||||
_("Mouse cursor Y position"),
|
||||
_("the Y position of the mouse cursor"),
|
||||
_("the mouse cursor Y position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
@@ -374,8 +376,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.AddCondition(
|
||||
"HasAnyTouchStarted",
|
||||
_("A new touch has started"),
|
||||
_("Check if a touch has just started on this frame. The touch "
|
||||
"identifiers can be "
|
||||
_("Check if a touch has just started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId() and StartedTouchCount()."),
|
||||
_("A new touch has started"),
|
||||
_("Multitouch"),
|
||||
@@ -385,24 +386,24 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpression("StartedTouchCount",
|
||||
_("Started touch count"),
|
||||
_("The number of touches that have just started on this "
|
||||
"frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddExpression(
|
||||
"StartedTouchCount",
|
||||
_("Started touch count"),
|
||||
_("The number of touches that have just started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpression("StartedTouchId",
|
||||
_("Started touch identifier"),
|
||||
_("The identifier of the touch that has just started on "
|
||||
"this frame. The number of touches can be "
|
||||
"accessed using StartedTouchCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddExpression(
|
||||
"StartedTouchId",
|
||||
_("Started touch identifier"),
|
||||
_("The identifier of the touch that has just started on this frame. The touch number of touches can be "
|
||||
"accessed using StartedTouchCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch index"))
|
||||
.SetHidden();
|
||||
@@ -413,8 +414,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("A new touch has started"),
|
||||
_("Check if a touch has just started or the mouse left button has "
|
||||
"been pressed on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchOrMouseId() and "
|
||||
"StartedTouchOrMouseCount()."),
|
||||
"accessed using StartedTouchOrMouseId() and StartedTouchOrMouseCount()."),
|
||||
_("A new touch has started"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
@@ -427,7 +427,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Started touch count"),
|
||||
_("The number of touches (including the mouse) that have just "
|
||||
"started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchOrMouseId()."),
|
||||
"accessed using StartedTouchOrMouseCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -437,7 +437,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"StartedTouchOrMouseId",
|
||||
_("Started touch identifier"),
|
||||
_("The identifier of the touch or mouse that has just started on "
|
||||
"this frame. The number of touches can be "
|
||||
"this frame. The touch number of touches can be "
|
||||
"accessed using StartedTouchOrMouseCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
@@ -445,14 +445,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.AddParameter("expression", _("Touch index"));
|
||||
|
||||
extension
|
||||
.AddCondition("HasTouchEnded",
|
||||
_("A touch has ended"),
|
||||
_("Check if a touch has ended or a mouse left button has "
|
||||
"been released."),
|
||||
_("The touch with identifier _PARAM1_ has ended"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCondition(
|
||||
"HasTouchEnded",
|
||||
_("A touch has ended"),
|
||||
_("Check if a touch has ended or a mouse left button has been released."),
|
||||
_("The touch with identifier _PARAM1_ has ended"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"));
|
||||
|
||||
|
@@ -27,9 +27,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarScene",
|
||||
_("Number variable"),
|
||||
_("Compare the number value of a scene variable."),
|
||||
_("The number of scene variable _PARAM0_"),
|
||||
_("Value of a scene variable"),
|
||||
_("Compare the value of a scene variable."),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
@@ -39,9 +39,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarSceneTxt",
|
||||
_("Text variable"),
|
||||
_("Compare the text (string) of a scene variable."),
|
||||
_("The text of scene variable _PARAM0_"),
|
||||
_("Text of a scene variable"),
|
||||
_("Compare the text of a scene variable."),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
@@ -52,7 +52,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddCondition(
|
||||
"SceneVariableAsBoolean",
|
||||
_("Boolean variable"),
|
||||
_("Boolean value of a scene variable"),
|
||||
_("Compare the boolean value of a scene variable."),
|
||||
_("The boolean value of scene variable _PARAM0_ is _PARAM1_"),
|
||||
_("Scene variables"),
|
||||
@@ -63,14 +63,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.SetDefaultValue("true");
|
||||
|
||||
extension
|
||||
.AddCondition("VariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the scene structure "
|
||||
"variable exists."),
|
||||
_("Child _PARAM1_ of scene variable _PARAM0_ exists"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddCondition(
|
||||
"VariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the scene variable exists."),
|
||||
_("Child _PARAM1_ of scene variable _PARAM0_ exists"),
|
||||
_("Scene variables/Collections/Structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("string", _("Name of the child"))
|
||||
.MarkAsAdvanced();
|
||||
@@ -78,10 +78,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddCondition("GlobalVariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the global structure "
|
||||
_("Check if the specified child of the global "
|
||||
"variable exists."),
|
||||
_("Child _PARAM1_ of global variable _PARAM0_ exists"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
_("Global variables/Collections/Structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -90,7 +90,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarSceneDef",
|
||||
"Variable defined",
|
||||
"Test if a scene variable is defined",
|
||||
"Test if the scene variable exists.",
|
||||
"Scene variable _PARAM0_ is defined",
|
||||
_("Scene variables"),
|
||||
@@ -98,12 +98,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/conditions/var.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("string", _("Variable"))
|
||||
.SetHidden(); // Deprecated.
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddCondition("VarGlobal",
|
||||
_("Number variable"),
|
||||
_("Compare the number value of a global variable."),
|
||||
_("Value of a global variable"),
|
||||
_("Compare the value of a global variable."),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -115,8 +115,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarGlobalTxt",
|
||||
_("Text variable"),
|
||||
_("Compare the text (string) of a global variable."),
|
||||
_("Text of a global variable"),
|
||||
_("Compare the text of a global variable."),
|
||||
_("the text of the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -129,7 +129,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddCondition(
|
||||
"GlobalVariableAsBoolean",
|
||||
_("Boolean variable"),
|
||||
_("Boolean value of a global variable"),
|
||||
_("Compare the boolean value of a global variable."),
|
||||
_("The boolean value of global variable _PARAM0_ is _PARAM1_"),
|
||||
_("Global variables"),
|
||||
@@ -141,8 +141,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarGlobalDef",
|
||||
"Variable defined",
|
||||
"Test if a global variable exists.",
|
||||
"Test if a global variable is defined",
|
||||
"Test if a global variable exists",
|
||||
"Global variable _PARAM0_ is defined",
|
||||
_("Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -150,12 +150,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("string", _("Variable"))
|
||||
.MarkAsAdvanced()
|
||||
.SetHidden(); // Deprecated.
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddAction("ModVarScene",
|
||||
_("Change number variable"),
|
||||
_("Modify the number value of a scene variable."),
|
||||
_("Value of a scene variable"),
|
||||
_("Change the value of a scene variable."),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -166,8 +166,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ModVarSceneTxt",
|
||||
_("Change text variable"),
|
||||
_("Modify the text (string) of a scene variable."),
|
||||
_("String of a scene variable"),
|
||||
_("Modify the text of a scene variable."),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -179,7 +179,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddAction(
|
||||
"SetSceneVariableAsBoolean",
|
||||
_("Change boolean variable"),
|
||||
_("Boolean value of a scene variable"),
|
||||
_("Modify the boolean value of a scene variable."),
|
||||
_("Set the boolean value of scene variable _PARAM0_ to _PARAM1_"),
|
||||
_("Scene variables"),
|
||||
@@ -190,7 +190,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ToggleSceneVariableAsBoolean",
|
||||
_("Toggle boolean variable"),
|
||||
_("Toggle boolean value of a scene variable"),
|
||||
_("Toggle the boolean value of a scene variable.") + "\n" +
|
||||
_("If it was true, it will become false, and if it was "
|
||||
"false it will become true."),
|
||||
@@ -202,8 +202,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ModVarGlobal",
|
||||
_("Change number variable"),
|
||||
_("Modify the number value of a global variable."),
|
||||
_("Value of a global variable"),
|
||||
_("Change the value of a global variable"),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -215,8 +215,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ModVarGlobalTxt",
|
||||
_("Change text variable"),
|
||||
_("Modify the text (string) of a global variable."),
|
||||
_("String of a global variable"),
|
||||
_("Modify the text of a global variable."),
|
||||
_("the text of global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -229,7 +229,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddAction(
|
||||
"SetGlobalVariableAsBoolean",
|
||||
_("Change boolean variable"),
|
||||
_("Boolean value of a global variable"),
|
||||
_("Modify the boolean value of a global variable."),
|
||||
_("Set the boolean value of global variable _PARAM0_ to _PARAM1_"),
|
||||
_("Global variables"),
|
||||
@@ -240,7 +240,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ToggleGlobalVariableAsBoolean",
|
||||
_("Toggle boolean variable"),
|
||||
_("Toggle boolean value of a global variable"),
|
||||
_("Toggle the boolean value of a global variable.") + "\n" +
|
||||
_("If it was true, it will become false, and if it was "
|
||||
"false it will become true."),
|
||||
@@ -251,324 +251,202 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddParameter("globalvar", _("Variable"));
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"VariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a scene structure variable."),
|
||||
_("Remove child _PARAM1_ from scene structure variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Structure variable"))
|
||||
.AddAction("VariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a scene variable."),
|
||||
_("Remove child _PARAM1_ from scene variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("string", _("Child's name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"GlobalVariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a global structure variable."),
|
||||
_("Remove child _PARAM1_ from global structure variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Structure variable"))
|
||||
.AddAction("GlobalVariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a global variable."),
|
||||
_("Remove child _PARAM1_ from global variable _PARAM0_"),
|
||||
_("Global variables/Collections/Structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("string", _("Child's name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("VariableClearChildren",
|
||||
_("Clear children"),
|
||||
_("Remove all the children from the scene structure or array "
|
||||
"variable."),
|
||||
_("Clear scene variable"),
|
||||
_("Remove all the children from the scene variable."),
|
||||
_("Clear children from scene variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
_("Scene variables/Collections"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Structure or array variable"))
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariableClearChildren",
|
||||
_("Clear children"),
|
||||
_("Remove all the children from the global structure or array "
|
||||
"variable."),
|
||||
_("Clear global variable"),
|
||||
_("Remove all the children from the global variable."),
|
||||
_("Clear children from global variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
_("Global variables/Collections"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Structure or array variable"))
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariablePush",
|
||||
_("Add existing variable"),
|
||||
_("Adds an existing variable at the end of a scene array "
|
||||
"variable."),
|
||||
_("Add variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
_("Append variable to a scene array"),
|
||||
_("Appends a variable at the end of a scene array variable."),
|
||||
_("Append variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to add"))
|
||||
.SetParameterLongDescription(
|
||||
_("The content of the variable will *be copied* and added at the "
|
||||
"end of the array."))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to append"))
|
||||
.SetParameterLongDescription(_("The content of the variable will *be copied* and appended at the end of the array."))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"SceneVariablePushString",
|
||||
_("Add text variable"),
|
||||
_("Adds a text (string) at the end of a scene array variable."),
|
||||
_("Add text _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddAction("SceneVariablePushString",
|
||||
_("Append a string to a scene array"),
|
||||
_("Appends a string at the end of a scene array variable."),
|
||||
_("Append string _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("string", _("Text to add"))
|
||||
.AddParameter("string", _("String to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariablePushNumber",
|
||||
_("Add number variable"),
|
||||
_("Adds a number at the end of a scene array variable."),
|
||||
_("Add number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
_("Append a number to a scene array"),
|
||||
_("Appends a number at the end of a scene array variable."),
|
||||
_("Append number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("expression", _("Number to add"))
|
||||
.AddParameter("expression", _("Number to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariablePushBool",
|
||||
_("Add boolean variable"),
|
||||
_("Adds a boolean at the end of a scene array variable."),
|
||||
_("Add boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
_("Append a boolean to a scene array"),
|
||||
_("Appends a boolean at the end of a scene array variable."),
|
||||
_("Append boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("trueorfalse", _("Boolean to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariableRemoveAt",
|
||||
_("Remove variable by index"),
|
||||
_("Removes a variable at the specified index of a scene array "
|
||||
"variable."),
|
||||
_("Remove variable at index _PARAM1_ from scene array "
|
||||
"variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"SceneVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Compare the number of children in a scene array variable."),
|
||||
_("The number of children in the array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddStrExpression(
|
||||
"SceneVariableFirstString",
|
||||
_("First text child"),
|
||||
_("Get the value of the first element of a scene array variable, if "
|
||||
"it is a text (string)."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"SceneVariableFirstNumber",
|
||||
_("First number child"),
|
||||
_("Get the value of the first element of a scene array variable, if "
|
||||
"it is a number."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression(
|
||||
"SceneVariableLastString",
|
||||
_("Last text child"),
|
||||
_("Get the value of the last element of a scene array variable, if "
|
||||
"it is a text (string)."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"SceneVariableLastNumber",
|
||||
_("Last number child"),
|
||||
_("Get the value of the last element of a scene array variable, if "
|
||||
"it is a number."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"GlobalVariablePush",
|
||||
_("Add existing variable"),
|
||||
_("Adds an existing variable at the end of a global array variable."),
|
||||
_("Add variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to add"))
|
||||
.SetParameterLongDescription(
|
||||
_("The content of the variable will *be copied* and added at the "
|
||||
"end of the array."))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariableRemoveAt",
|
||||
_("Remove variable by index"),
|
||||
_("Removes a variable at the specified index of a global "
|
||||
"array variable."),
|
||||
_("Remove variable at index _PARAM1_ from global array "
|
||||
"variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.AddParameter("trueorfalse", _("Boolean to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"GlobalVariablePushString",
|
||||
_("Add text variable"),
|
||||
_("Adds a text (string) at the end of a global array variable."),
|
||||
_("Add text _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"SceneVariableRemoveAt",
|
||||
_("Remove variable from a scene array (by index)"),
|
||||
_("Removes a variable at the specified index of a scene array variable."),
|
||||
_("Remove variable at index _PARAM1_ from scene array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePush",
|
||||
_("Append variable to a global array"),
|
||||
_("Appends a variable at the end of a global array variable."),
|
||||
_("Append variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("string", _("Text to add"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to append"))
|
||||
.SetParameterLongDescription(_("The content of the variable will *be copied* and appended at the end of the array."))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"GlobalVariableRemoveAt",
|
||||
_("Remove variable from a global array (by index)"),
|
||||
_("Removes a variable at the specified index of a global array variable."),
|
||||
_("Remove variable at index _PARAM1_ from global array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePushString",
|
||||
_("Append a string to a global array"),
|
||||
_("Appends a string at the end of a global array variable."),
|
||||
_("Append string _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("string", _("String to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePushNumber",
|
||||
_("Add number variable"),
|
||||
_("Adds a number at the end of a global array variable."),
|
||||
_("Add number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
_("Append a number to a global array"),
|
||||
_("Appends a number at the end of a global array variable."),
|
||||
_("Append number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("expression", _("Number to add"))
|
||||
.AddParameter("expression", _("Number to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePushBool",
|
||||
_("Add boolean variable"),
|
||||
_("Adds a boolean at the end of a global array variable."),
|
||||
_("Add boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
_("Append a boolean to a global array"),
|
||||
_("Appends a boolean at the end of a global array variable."),
|
||||
_("Append boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("trueorfalse", _("Boolean to add"))
|
||||
.AddParameter("trueorfalse", _("Boolean to append"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"GlobalVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Compare the number of children in a global array variable."),
|
||||
_("The number of children of the array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddStrExpression("GlobalVariableFirstString",
|
||||
_("First text child"),
|
||||
_("Value of the first element of a global array "
|
||||
"variable, if it is a text (string) variable."),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("GlobalVariableFirstNumber",
|
||||
_("First number child"),
|
||||
_("Value of the first element of a global array "
|
||||
"variable, if it is a number variable"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression(
|
||||
"GlobalVariableLastString",
|
||||
_("Last text child"),
|
||||
_("Value of the last element of a global array variable, if "
|
||||
"it is a text (string) variable."),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"GlobalVariableLastNumber",
|
||||
_("Last number child"),
|
||||
_("Value of the last element of a global array variable, if "
|
||||
"it is a number variable"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("GlobalVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Number of children in a global array or "
|
||||
"structure variable"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
_("Number of children of a global variable"),
|
||||
_("Number of children of a global variable"),
|
||||
_("Global variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array or structure variable"));
|
||||
.AddParameter("globalvar", _("Variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("VariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Number of children in a scene array or "
|
||||
"structure variable"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
_("Number of children of a scene variable"),
|
||||
_("Number of children of a scene variable"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array or structure variable"));
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("Variable",
|
||||
_("Number variable"),
|
||||
_("Number value of a scene variable"),
|
||||
_("Value of a scene variable"),
|
||||
_("Value of a scene variable"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("VariableString",
|
||||
_("Text variable"),
|
||||
_("Text of a scene variable"),
|
||||
_("Text of a scene variable"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var.png")
|
||||
@@ -576,15 +454,15 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddExpression("GlobalVariable",
|
||||
_("Number variable"),
|
||||
_("Number value of a global variable"),
|
||||
_("Value of a global variable"),
|
||||
_("Value of a global variable"),
|
||||
_("Global variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Name of the global variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("GlobalVariableString",
|
||||
_("Text variable"),
|
||||
_("Text of a global variable"),
|
||||
_("Text of a global variable"),
|
||||
_("Global variables"),
|
||||
"res/actions/var.png")
|
||||
|
@@ -22,7 +22,7 @@ class EventsList;
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Allow to safely remove a bunch of events.
|
||||
* \brief List the values of the parameters of events and their type.
|
||||
*
|
||||
* \ingroup IDE
|
||||
*/
|
||||
|
@@ -72,9 +72,6 @@ void EventsFunction::SerializeTo(SerializerElement& element) const {
|
||||
if (isPrivate) {
|
||||
element.SetBoolAttribute("private", isPrivate);
|
||||
}
|
||||
if (isAsync) {
|
||||
element.SetBoolAttribute("async", isAsync);
|
||||
}
|
||||
events.SerializeTo(element.AddChild("events"));
|
||||
|
||||
gd::String functionTypeStr = "Action";
|
||||
@@ -118,7 +115,6 @@ void EventsFunction::UnserializeFrom(gd::Project& project,
|
||||
group = element.GetStringAttribute("group");
|
||||
getterName = element.GetStringAttribute("getterName");
|
||||
isPrivate = element.GetBoolAttribute("private");
|
||||
isAsync = element.GetBoolAttribute("async");
|
||||
events.UnserializeFrom(project, element.GetChild("events"));
|
||||
|
||||
gd::String functionTypeStr = element.GetStringAttribute("functionType");
|
||||
|
@@ -211,19 +211,6 @@ class GD_CORE_API EventsFunction {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns true if the function is async.
|
||||
*/
|
||||
bool IsAsync() const { return isAsync; }
|
||||
|
||||
/**
|
||||
* \brief Sets the asycronity of the function.
|
||||
*/
|
||||
EventsFunction& SetAsync(bool _isAsync) {
|
||||
isAsync = _isAsync;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return the events.
|
||||
*/
|
||||
@@ -304,7 +291,6 @@ class GD_CORE_API EventsFunction {
|
||||
mutable std::vector<gd::ParameterMetadata> actionWithOperationParameters;
|
||||
gd::ObjectGroupsContainer objectGroups;
|
||||
bool isPrivate = false;
|
||||
bool isAsync = false;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -11,7 +11,7 @@
|
||||
namespace gd {
|
||||
|
||||
LoadingScreen::LoadingScreen()
|
||||
: showGDevelopLogoDuringLoadingScreen(false),
|
||||
: showGDevelopSplash(true),
|
||||
gdevelopLogoStyle("light"),
|
||||
backgroundImageResourceName(""),
|
||||
backgroundColor(0),
|
||||
@@ -27,7 +27,7 @@ LoadingScreen::LoadingScreen()
|
||||
progressBarColor(0xFFFFFF){};
|
||||
|
||||
void LoadingScreen::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("showGDevelopSplash", showGDevelopLogoDuringLoadingScreen);
|
||||
element.SetAttribute("showGDevelopSplash", showGDevelopSplash);
|
||||
element.SetAttribute("gdevelopLogoStyle",
|
||||
gdevelopLogoStyle);
|
||||
element.SetAttribute("backgroundImageResourceName",
|
||||
@@ -46,7 +46,7 @@ void LoadingScreen::SerializeTo(SerializerElement& element) const {
|
||||
}
|
||||
|
||||
void LoadingScreen::UnserializeFrom(const SerializerElement& element) {
|
||||
showGDevelopLogoDuringLoadingScreen = element.GetBoolAttribute("showGDevelopSplash", true);
|
||||
showGDevelopSplash = element.GetBoolAttribute("showGDevelopSplash", true);
|
||||
gdevelopLogoStyle =
|
||||
element.GetStringAttribute("gdevelopLogoStyle", "light");
|
||||
backgroundImageResourceName =
|
||||
|
@@ -29,13 +29,13 @@ class GD_CORE_API LoadingScreen {
|
||||
* \brief Return true if the GDevelop logo should be shown while loading
|
||||
* assets.
|
||||
*/
|
||||
bool IsGDevelopLogoShownDuringLoadingScreen() const { return showGDevelopLogoDuringLoadingScreen; };
|
||||
bool IsGDevelopSplashShown() const { return showGDevelopSplash; };
|
||||
|
||||
/**
|
||||
* \brief Set if the GDevelop logo should be shown while loading assets.
|
||||
*/
|
||||
LoadingScreen& ShowGDevelopLogoDuringLoadingScreen(bool show) {
|
||||
showGDevelopLogoDuringLoadingScreen = show;
|
||||
LoadingScreen& ShowGDevelopSplash(bool show) {
|
||||
showGDevelopSplash = show;
|
||||
return *this;
|
||||
};
|
||||
|
||||
@@ -157,7 +157,7 @@ class GD_CORE_API LoadingScreen {
|
||||
///@}
|
||||
|
||||
private:
|
||||
bool showGDevelopLogoDuringLoadingScreen;
|
||||
bool showGDevelopSplash;
|
||||
gd::String gdevelopLogoStyle;
|
||||
gd::String backgroundImageResourceName;
|
||||
int backgroundColor;
|
||||
|
@@ -636,7 +636,6 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
platformSpecificAssets.UnserializeFrom(
|
||||
propElement.GetChild("platformSpecificAssets"));
|
||||
loadingScreen.UnserializeFrom(propElement.GetChild("loadingScreen"));
|
||||
watermark.UnserializeFrom(propElement.GetChild("watermark"));
|
||||
|
||||
useExternalSourceFiles =
|
||||
propElement.GetBoolAttribute("useExternalSourceFiles");
|
||||
@@ -647,13 +646,6 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
for (std::size_t i = 0; i < authorIdsElement.GetChildrenCount(); ++i) {
|
||||
authorIds.push_back(authorIdsElement.GetChild(i).GetStringValue());
|
||||
}
|
||||
authorUsernames.clear();
|
||||
auto& authorUsernamesElement = propElement.GetChild("authorUsernames");
|
||||
authorUsernamesElement.ConsiderAsArray();
|
||||
for (std::size_t i = 0; i < authorUsernamesElement.GetChildrenCount(); ++i) {
|
||||
authorUsernames.push_back(
|
||||
authorUsernamesElement.GetChild(i).GetStringValue());
|
||||
}
|
||||
|
||||
categories.clear();
|
||||
auto& categoriesElement = propElement.GetChild("categories");
|
||||
@@ -883,7 +875,6 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
platformSpecificAssets.SerializeTo(
|
||||
propElement.AddChild("platformSpecificAssets"));
|
||||
loadingScreen.SerializeTo(propElement.AddChild("loadingScreen"));
|
||||
watermark.SerializeTo(propElement.AddChild("watermark"));
|
||||
propElement.SetAttribute("useExternalSourceFiles", useExternalSourceFiles);
|
||||
|
||||
auto& authorIdsElement = propElement.AddChild("authorIds");
|
||||
@@ -891,11 +882,6 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
for (const auto& authorId : authorIds) {
|
||||
authorIdsElement.AddChild("").SetStringValue(authorId);
|
||||
}
|
||||
auto& authorUsernamesElement = propElement.AddChild("authorUsernames");
|
||||
authorUsernamesElement.ConsiderAsArray();
|
||||
for (const auto& authorUsername : authorUsernames) {
|
||||
authorUsernamesElement.AddChild("").SetStringValue(authorUsername);
|
||||
}
|
||||
|
||||
auto& categoriesElement = propElement.AddChild("categories");
|
||||
categoriesElement.ConsiderAsArray();
|
||||
@@ -1111,7 +1097,6 @@ void Project::Init(const gd::Project& game) {
|
||||
|
||||
author = game.author;
|
||||
authorIds = game.authorIds;
|
||||
authorUsernames = game.authorUsernames;
|
||||
isPlayableWithKeyboard = game.isPlayableWithKeyboard;
|
||||
isPlayableWithGamepad = game.isPlayableWithGamepad;
|
||||
isPlayableWithMobile = game.isPlayableWithMobile;
|
||||
@@ -1122,7 +1107,6 @@ void Project::Init(const gd::Project& game) {
|
||||
latestCompilationDirectory = game.latestCompilationDirectory;
|
||||
platformSpecificAssets = game.platformSpecificAssets;
|
||||
loadingScreen = game.loadingScreen;
|
||||
watermark = game.watermark;
|
||||
objectGroups = game.objectGroups;
|
||||
|
||||
extensionProperties = game.extensionProperties;
|
||||
|
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "GDCore/Project/ExtensionProperties.h"
|
||||
#include "GDCore/Project/LoadingScreen.h"
|
||||
#include "GDCore/Project/Watermark.h"
|
||||
#include "GDCore/Project/ObjectGroupsContainer.h"
|
||||
#include "GDCore/Project/ObjectsContainer.h"
|
||||
#include "GDCore/Project/PlatformSpecificAssets.h"
|
||||
@@ -121,16 +120,6 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
std::vector<gd::String>& GetAuthorIds() { return authorIds; };
|
||||
|
||||
/**
|
||||
* \brief Get the author usernames of the project.
|
||||
*/
|
||||
const std::vector<gd::String>& GetAuthorUsernames() const { return authorUsernames; };
|
||||
|
||||
/**
|
||||
* \brief Get the author usernames of the project, to modify them (non-const).
|
||||
*/
|
||||
std::vector<gd::String>& GetAuthorUsernames() { return authorUsernames; };
|
||||
|
||||
/**
|
||||
* Define the project as playable with a keyboard.
|
||||
* \param enable True to define the project as playable with a keyboard.
|
||||
@@ -267,16 +256,6 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
const gd::LoadingScreen& GetLoadingScreen() const { return loadingScreen; }
|
||||
|
||||
/**
|
||||
* \brief Return a reference to watermark setup for the project
|
||||
*/
|
||||
gd::Watermark& GetWatermark() { return watermark; }
|
||||
|
||||
/**
|
||||
* \brief Return a reference to watermark setup for the project
|
||||
*/
|
||||
const gd::Watermark& GetWatermark() const { return watermark; }
|
||||
|
||||
/**
|
||||
* Change game's main window default width.
|
||||
*
|
||||
@@ -1064,8 +1043,6 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
gd::String author; ///< Game author name, for publishing purpose.
|
||||
std::vector<gd::String>
|
||||
authorIds; ///< Game author ids, from GDevelop users DB.
|
||||
std::vector<gd::String>
|
||||
authorUsernames; ///< Game author usernames, from GDevelop users DB.
|
||||
std::vector<gd::String>
|
||||
categories; ///< Game categories
|
||||
bool isPlayableWithKeyboard; ///< The project is playable with a keyboard.
|
||||
@@ -1085,7 +1062,6 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
currentPlatform; ///< The platform being used to edit the project.
|
||||
gd::PlatformSpecificAssets platformSpecificAssets;
|
||||
gd::LoadingScreen loadingScreen;
|
||||
gd::Watermark watermark;
|
||||
std::vector<std::unique_ptr<gd::ExternalEvents> >
|
||||
externalEvents; ///< List of all externals events
|
||||
ExtensionProperties
|
||||
|
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2018 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "Watermark.h"
|
||||
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
Watermark::Watermark() : showWatermark(true), placement("bottom-left"){};
|
||||
|
||||
void Watermark::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("showWatermark", showWatermark);
|
||||
element.SetAttribute("placement", placement);
|
||||
}
|
||||
|
||||
void Watermark::UnserializeFrom(const SerializerElement& element) {
|
||||
showWatermark = element.GetBoolAttribute("showWatermark", true);
|
||||
placement = element.GetStringAttribute("placement", "bottom-left");
|
||||
}
|
||||
} // namespace gd
|
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2018 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef GDCORE_WATERMARK_H
|
||||
#define GDCORE_WATERMARK_H
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class SerializerElement;
|
||||
}
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Describe the content and set up of the watermark
|
||||
*
|
||||
* \see gd::Watermark
|
||||
*
|
||||
* \ingroup PlatformDefinition
|
||||
*/
|
||||
class GD_CORE_API Watermark {
|
||||
public:
|
||||
Watermark();
|
||||
virtual ~Watermark(){};
|
||||
|
||||
/**
|
||||
* \brief Return true if the GDevelop watermark should be shown after
|
||||
* the game has loaded its assets.
|
||||
*/
|
||||
bool IsGDevelopWatermarkShown() const { return showWatermark; };
|
||||
|
||||
/**
|
||||
* \brief Set if the GDevelop watermark should be shown after the game
|
||||
* has loaded its assets.
|
||||
*/
|
||||
Watermark& ShowGDevelopWatermark(bool show) {
|
||||
showWatermark = show;
|
||||
return *this;
|
||||
};
|
||||
|
||||
const gd::String& GetPlacement() const { return placement; };
|
||||
|
||||
Watermark& SetPlacement(const gd::String& value) {
|
||||
placement = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** \name Saving and loading
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Serialize the watermark setup.
|
||||
*/
|
||||
void SerializeTo(SerializerElement& element) const;
|
||||
|
||||
/**
|
||||
* \brief Unserialize the watermark setup.
|
||||
*/
|
||||
void UnserializeFrom(const SerializerElement& element);
|
||||
///@}
|
||||
|
||||
private:
|
||||
bool showWatermark;
|
||||
gd::String placement;
|
||||
};
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_WATERMARK_H
|
@@ -30,7 +30,7 @@ module.exports = {
|
||||
'AdMob',
|
||||
_('AdMob'),
|
||||
_(
|
||||
'Allow to display AdMob banners, app open, interstitials, rewarded interstitials and rewarded video ads.'
|
||||
'Allow to display AdMob banners, interstitials and reward video ads.'
|
||||
),
|
||||
'Florian Rival',
|
||||
'MIT'
|
||||
@@ -57,8 +57,8 @@ module.exports = {
|
||||
.addDependency()
|
||||
.setName('AdMob Cordova plugin')
|
||||
.setDependencyType('cordova')
|
||||
.setExportName('admob-plus-cordova')
|
||||
.setVersion('1.28.0')
|
||||
.setExportName('gdevelop-cordova-admob-plus')
|
||||
.setVersion('0.45.0')
|
||||
.setExtraSetting(
|
||||
'APP_ID_ANDROID',
|
||||
new gd.PropertyDescriptor('AdMobAppIdAndroid').setType(
|
||||
@@ -100,120 +100,23 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.setTestMode');
|
||||
|
||||
// App Open
|
||||
extension
|
||||
.addCondition(
|
||||
'AppOpenLoading',
|
||||
_('App open loading'),
|
||||
_('Check if an app open is currently loading.'),
|
||||
_('App open is loading'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isAppOpenLoading');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'AppOpenReady',
|
||||
_('App open ready'),
|
||||
_('Check if an app open is ready to be displayed.'),
|
||||
_('App open is ready'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isAppOpenReady');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'AppOpenShowing',
|
||||
_('App open showing'),
|
||||
_('Check if there is an app open being displayed.'),
|
||||
_('App open is showing'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isAppOpenShowing');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'AppOpenErrored',
|
||||
_('App open errored'),
|
||||
_('Check if there was a error while loading the app open.'),
|
||||
_('App open had an error'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isAppOpenErrored');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'LoadAppOpen',
|
||||
_('Load app open'),
|
||||
_(
|
||||
'Start loading an app open (that can be displayed automatically when the loading is finished).\nIf test mode is set, a test app open will be displayed.'
|
||||
),
|
||||
_(
|
||||
'Load app open with Android ad unit ID: _PARAM0_, iOS ad unit ID: _PARAM1_ (landscape: _PARAM2_, display automatically when loaded: _PARAM3_)'
|
||||
),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter('string', _('Android app open ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/3419835294"` for loading a test app open.'
|
||||
)
|
||||
.addParameter('string', _('iOS app open ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/5662855259"` for loading a test app open.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Display in landscape? (portait otherwise)'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('false')
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Displayed automatically when loading is finished?'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.loadAppOpen');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ShowAppOpen',
|
||||
_('Show app open'),
|
||||
_(
|
||||
'Show the app open that was loaded. Will work only when the app open is fully loaded.'
|
||||
),
|
||||
_('Show the loaded app open'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showAppOpen');
|
||||
|
||||
// Banner
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerLoading',
|
||||
_('Banner loading'),
|
||||
_(
|
||||
'Check if a banner is currently loading. It will be shown automatically when loaded.'
|
||||
),
|
||||
_('Banner is loading'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerLoading');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerShowing',
|
||||
@@ -228,34 +131,6 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerShowing');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerConfigured',
|
||||
_('Banner configured'),
|
||||
_('Check if there is a banner correctly configured ready to be shown.'),
|
||||
_('Banner is configured'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerConfigured');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerLoaded',
|
||||
_('Banner loaded'),
|
||||
_('Check if there is a banner correctly loaded ready to be shown.'),
|
||||
_('Banner is loaded'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerLoaded');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerErrored',
|
||||
@@ -274,9 +149,6 @@ module.exports = {
|
||||
extension
|
||||
.addDuplicatedCondition('BannerReady', 'BannerShowing')
|
||||
.setHidden();
|
||||
extension
|
||||
.addDuplicatedCondition('Bannerloading', 'BannerShowing')
|
||||
.setHidden();
|
||||
extension
|
||||
.addDuplicatedCondition('BannerExists', 'BannerShowing')
|
||||
.setHidden();
|
||||
@@ -286,7 +158,7 @@ module.exports = {
|
||||
'SetupBanner',
|
||||
_('Configure the banner'),
|
||||
_(
|
||||
"Configure a banner, which can then be displayed.\nIf a banner is already displayed, it will be removed\nIf test mode is set, a test banner will be displayed.\n\nOnce a banner is positioned (at the top or bottom of the game), it can't be moved anymore."
|
||||
"Configure a banner, which can then be displayed.\nIf test mode is set, a test banner will be displayed.\n\nOnce a banner is positioned (at the top or bottom of the game), it can't be moved anymore."
|
||||
),
|
||||
_(
|
||||
'Configure the banner with Android ad unit ID: _PARAM0_, iOS ad unit ID: _PARAM1_, display at top: _PARAM2_'
|
||||
@@ -301,7 +173,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('string', _('iOS banner ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/2934735716"` for showing a test banner.'
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/6300978111"` for showing a test banner.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
@@ -426,7 +298,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('string', _('iOS interstitial ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/4411468910"` for loading a test interstitial.'
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/1033173712"` for loading a test interstitial.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
@@ -455,266 +327,90 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showInterstitial');
|
||||
|
||||
// Rewarded Interstitial
|
||||
// Reward video
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedInterstitialLoading',
|
||||
_('Rewarded interstitial loading'),
|
||||
_('Check if a rewarded interstitial is currently loading.'),
|
||||
_('Rewarded interstitial is loading'),
|
||||
'VideoLoading',
|
||||
_('Video loading'),
|
||||
_('Check if a reward video is currently loading.'),
|
||||
_('Reward video is loading'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialLoading');
|
||||
.setFunctionName('gdjs.adMob.isVideoLoading');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedInterstitialReady',
|
||||
_('Rewarded interstitial ready'),
|
||||
_('Check if a rewarded interstitial is ready to be displayed.'),
|
||||
_('Rewarded interstitial is ready'),
|
||||
'VideoReady',
|
||||
_('Video ready'),
|
||||
_('Check if a reward video is ready to be displayed.'),
|
||||
_('Reward video is ready'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialReady');
|
||||
.setFunctionName('gdjs.adMob.isVideoReady');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedInterstitialShowing',
|
||||
_('Rewarded interstitial showing'),
|
||||
_('Check if there is a rewarded interstitial being displayed.'),
|
||||
_('Rewarded interstitial is showing'),
|
||||
'VideoShowing',
|
||||
_('Video showing'),
|
||||
_('Check if there is a reward video being displayed.'),
|
||||
_('Reward video is showing'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialShowing');
|
||||
.setFunctionName('gdjs.adMob.isVideoShowing');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedInterstitialErrored',
|
||||
_('Rewarded interstitial had an error'),
|
||||
_(
|
||||
'Check if there was a error while loading the rewarded interstitial.'
|
||||
),
|
||||
_('Rewarded Interstitial had an error'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialErrored');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedInterstitialRewardReceived',
|
||||
_('Rewarded Interstitial reward received'),
|
||||
_(
|
||||
'Check if the reward of the rewarded interstitial was given to the user.\nYou can mark this reward as cleared, so that the condition will be false and you can show later another rewarded interstitial.'
|
||||
),
|
||||
_(
|
||||
'User got the reward of the rewarded interstitial (and clear this reward: _PARAM0_)'
|
||||
),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Clear the reward (needed to show another rewarded interstitial)'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.wasRewardedInterstitialRewardReceived');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'LoadRewardedInterstitial',
|
||||
_('Load rewarded interstitial'),
|
||||
_(
|
||||
'Start loading a rewarded interstitial (that can be displayed automatically when the loading is finished).\nIf test mode is set, a test rewarded interstitial will be displayed.\nThis is similar to a rewarded video, but can be displayed at any time, and the user can close it.'
|
||||
),
|
||||
_(
|
||||
'Load rewarded interstitial with Android ad unit ID: _PARAM0_, iOS ad unit ID: _PARAM1_ (display automatically when loaded: _PARAM2_)'
|
||||
),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter('string', _('Android rewarded interstitial ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/5354046379"` for loading a test rewarded interstitial.'
|
||||
)
|
||||
.addParameter('string', _('iOS interstitial ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/6978759866"` for loading a test rewarded interstitial.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Displayed automatically when loading is finished?'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.loadRewardedInterstitial');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ShowRewardedInterstitial',
|
||||
_('Show rewarded interstitial'),
|
||||
_(
|
||||
'Show the rewarded interstitial that was loaded. Will work only when the rewarded interstitial is fully loaded.'
|
||||
),
|
||||
_('Show the loaded rewarded interstitial'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showRewardedInterstitial');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ClaimRewardedInterstitialReward',
|
||||
_('Mark the reward of the rewarded interstitial as claimed'),
|
||||
_(
|
||||
'Mark the rewarded interstitial reward as claimed. Useful if you used the condition to check if the reward was given to the user without clearing the reward.'
|
||||
),
|
||||
_('Mark the reward of the rewarded interstitial as claimed'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.markRewardedInterstitialRewardAsClaimed');
|
||||
|
||||
// Rewarded video
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoLoading',
|
||||
_('Rewarded video loading'),
|
||||
_('Check if a rewarded video is currently loading.'),
|
||||
_('Rewarded video is loading'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoLoading');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoLoading', 'RewardedVideoLoading')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoReady',
|
||||
_('Rewarded video ready'),
|
||||
_('Check if a rewarded video is ready to be displayed.'),
|
||||
_('Rewarded video is ready'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoReady');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoReady', 'RewardedVideoReady')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoShowing',
|
||||
_('Rewarded video showing'),
|
||||
_('Check if there is a rewarded video being displayed.'),
|
||||
_('Rewarded video is showing'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoShowing');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoShowing', 'RewardedVideoShowing')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoErrored',
|
||||
_('Rewarded video had an error'),
|
||||
'VideoErrored',
|
||||
_('Video had an error'),
|
||||
_('Check if there was a error while loading the rewarded video.'),
|
||||
_('Rewarded video ad had an error'),
|
||||
_('Video ad had an error'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoErrored');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoErrored', 'RewardedVideoErrored')
|
||||
.setHidden();
|
||||
.setFunctionName('gdjs.adMob.isVideoErrored');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoRewardReceived',
|
||||
_('Rewarded Video reward received'),
|
||||
'VideoReward',
|
||||
_('Video reward received'),
|
||||
_(
|
||||
'Check if the reward of the rewarded video was given to the user.\nYou can mark this reward as cleared, so that the condition will be false and you can show later another rewarded video.'
|
||||
),
|
||||
_(
|
||||
'User got the reward of the rewarded video (and clear this reward: _PARAM0_)'
|
||||
'Check if the reward of the video was given to the user.\nYou can mark this reward as cleared, so that the condition will be false and you can show later another reward video.'
|
||||
),
|
||||
_('User got the reward of the video (and clear this reward: _PARAM0_)'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Clear the reward (needed to show another rewarded video)'),
|
||||
_('Clear the reward (needed to show another video)'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.wasRewardedVideoRewardReceived');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoReward', 'RewardedVideoRewardReceived')
|
||||
.setHidden();
|
||||
.setFunctionName('gdjs.adMob.wasVideoRewardReceived');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'LoadRewardedVideo',
|
||||
_('Load rewarded video'),
|
||||
'LoadVideo',
|
||||
_('Load video'),
|
||||
_(
|
||||
'Start loading a reward video (that can be displayed automatically when the loading is finished).\nIf test mode is set, a test video will be displayed.'
|
||||
),
|
||||
@@ -731,7 +427,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('string', _('iOS reward video ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/1712485313"` for loading a test rewarded video.'
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/5224354917"` for loading a test rewarded video.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
@@ -742,15 +438,12 @@ module.exports = {
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.loadRewardedVideo');
|
||||
|
||||
// Deprecated action (was renamed):
|
||||
extension.addDuplicatedAction('LoadVideo', 'LoadRewardedVideo').setHidden();
|
||||
.setFunctionName('gdjs.adMob.loadVideo');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ShowRewardedVideo',
|
||||
_('Show rewarded video'),
|
||||
'ShowVideo',
|
||||
_('Show video'),
|
||||
_(
|
||||
'Show the reward video that was loaded. Will work only when the video is fully loaded.'
|
||||
),
|
||||
@@ -761,31 +454,23 @@ module.exports = {
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showRewardedVideo');
|
||||
|
||||
// Deprecated action (was renamed):
|
||||
extension.addDuplicatedAction('ShowVideo', 'ShowRewardedVideo').setHidden();
|
||||
.setFunctionName('gdjs.adMob.showVideo');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ClaimRewardedVideoReward',
|
||||
_('Mark the reward of the rewarded video as claimed'),
|
||||
'ClaimReward',
|
||||
_('Mark the reward of the video as claimed'),
|
||||
_(
|
||||
'Mark the rewarded video reward as claimed. Useful if you used the condition to check if the reward was given to the user without clearing the reward.'
|
||||
'Mark the video reward as claimed. Useful if you used the condition to check if the reward was given to the user without clearing the reward.'
|
||||
),
|
||||
_('Mark the reward of the rewarded video as claimed'),
|
||||
_('Mark the reward of the video as claimed'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.markRewardedVideoRewardAsClaimed');
|
||||
|
||||
// Deprecated action (was renamed):
|
||||
extension
|
||||
.addDuplicatedAction('ClaimReward', 'ClaimRewardedVideoReward')
|
||||
.setHidden();
|
||||
.setFunctionName('gdjs.adMob.markVideoRewardAsClaimed');
|
||||
|
||||
return extension;
|
||||
},
|
||||
|
@@ -1,46 +1,10 @@
|
||||
namespace gdjs {
|
||||
declare var admob: any;
|
||||
declare var cordova: any;
|
||||
|
||||
export namespace adMob {
|
||||
const logger = new gdjs.Logger('AdMob');
|
||||
|
||||
const testAdIds = {
|
||||
appOpen: {
|
||||
android: 'ca-app-pub-3940256099942544/3419835294',
|
||||
ios: 'ca-app-pub-3940256099942544/5662855259',
|
||||
},
|
||||
banner: {
|
||||
android: 'ca-app-pub-3940256099942544/6300978111',
|
||||
ios: 'ca-app-pub-3940256099942544/2934735716',
|
||||
},
|
||||
interstitial: {
|
||||
android: 'ca-app-pub-3940256099942544/1033173712',
|
||||
ios: 'ca-app-pub-3940256099942544/4411468910',
|
||||
},
|
||||
interstitialVideo: {
|
||||
android: 'ca-app-pub-3940256099942544/8691691433',
|
||||
ios: 'ca-app-pub-3940256099942544/5135589807',
|
||||
},
|
||||
rewarded: {
|
||||
android: 'ca-app-pub-3940256099942544/5224354917',
|
||||
ios: 'ca-app-pub-3940256099942544/1712485313',
|
||||
},
|
||||
rewardedInterstitial: {
|
||||
android: 'ca-app-pub-3940256099942544/5354046379',
|
||||
ios: 'ca-app-pub-3940256099942544/6978759866',
|
||||
},
|
||||
native: {
|
||||
android: 'ca-app-pub-3940256099942544/2247696110',
|
||||
ios: 'ca-app-pub-3940256099942544/3986624511',
|
||||
},
|
||||
nativeVideo: {
|
||||
android: 'ca-app-pub-3940256099942544/1044960115',
|
||||
ios: 'ca-app-pub-3940256099942544/2521693316',
|
||||
},
|
||||
};
|
||||
|
||||
enum AdSizeType {
|
||||
export enum AdSizeType {
|
||||
BANNER,
|
||||
LARGE_BANNER,
|
||||
MEDIUM_RECTANGLE,
|
||||
@@ -49,113 +13,31 @@ namespace gdjs {
|
||||
SMART_BANNER,
|
||||
}
|
||||
|
||||
const adSizeTypes = {
|
||||
BANNER: AdSizeType.BANNER,
|
||||
LARGE_BANNER: AdSizeType.LARGE_BANNER,
|
||||
MEDIUM_RECTANGLE: AdSizeType.MEDIUM_RECTANGLE,
|
||||
FULL_BANNER: AdSizeType.FULL_BANNER,
|
||||
LEADERBOARD: AdSizeType.LEADERBOARD,
|
||||
SMART_BANNER: AdSizeType.SMART_BANNER,
|
||||
};
|
||||
|
||||
enum AppOpenAdOrientation {
|
||||
Portrait = 1,
|
||||
PortraitUpsideDown = 2,
|
||||
LandscapeRight = 3,
|
||||
LandscapeLeft = 4,
|
||||
}
|
||||
|
||||
// Admob does not initialize automatically, so we store a flag to know if it's initialized.
|
||||
let admobStarted = false;
|
||||
let isUsingTestAds = false;
|
||||
|
||||
// Banner
|
||||
let banner;
|
||||
let bannerAndroidId = '';
|
||||
let bannerIosId = '';
|
||||
let bannerPosition: 'top' | 'bottom' = 'top';
|
||||
let bannerRequestedAdSizeType: AdSizeType = AdSizeType.SMART_BANNER;
|
||||
let bannerConfigured = false; // Becomes true when the user configures the ad id and the position of the banner.
|
||||
let bannerLoaded = false; // Becomes true when the banner is loaded by loaded.
|
||||
let bannerShowing = false; // Becomes true when loaded or when the user shows/hides the banner.
|
||||
let bannerErrored = false; // Becomes true when the banner fails to load.
|
||||
|
||||
let bannerLoading = false;
|
||||
let bannerErrored = false;
|
||||
let bannerShowing = false;
|
||||
|
||||
// Interstitial
|
||||
let interstitial;
|
||||
let interstitialLoading = false; // Becomes true when the interstitial is loading.
|
||||
let interstitialReady = false; // Becomes true when the interstitial is loaded and ready to be shown.
|
||||
let interstitialShowing = false; // Becomes true when the interstitial is showing.
|
||||
let interstitialErrored = false; // Becomes true when the interstitial fails to load.
|
||||
let interstitialLoading = false;
|
||||
let interstitialReady = false;
|
||||
let interstitialErrored = false;
|
||||
let interstitialShowing = false;
|
||||
|
||||
// App Open
|
||||
let appOpen;
|
||||
let appOpenLoading = false; // Becomes true when the appOpen is loading.
|
||||
let appOpenReady = false; // Becomes true when the appOpen is loaded and ready to be shown.
|
||||
let appOpenShowing = false; // Becomes true when the appOpen is showing.
|
||||
let appOpenErrored = false; // Becomes true when the appOpen fails to load.
|
||||
|
||||
// Rewarded interstitial
|
||||
let rewardedInterstitial;
|
||||
let rewardedInterstitialLoading = false; // Becomes true when the interstitial is loading.
|
||||
let rewardedInterstitialReady = false; // Becomes true when the interstitial is loaded and ready to be shown.
|
||||
let rewardedInterstitialShowing = false; // Becomes true when the interstitial is showing.
|
||||
let rewardedInterstitialRewardReceived = false; // Becomes true when the interstitial is closed and the reward is received.
|
||||
let rewardedInterstitialErrored = false; // Becomes true when the interstitial fails to load.
|
||||
|
||||
// Rewarded video
|
||||
let rewardedVideo;
|
||||
let rewardedVideoLoading = false; // Becomes true when the video is loading.
|
||||
let rewardedVideoReady = false; // Becomes true when the video is loaded and ready to be shown.
|
||||
let rewardedVideoShowing = false; // Becomes true when the video is showing.
|
||||
let rewardedVideoRewardReceived = false; // Becomes true when the video is closed and the reward is received.
|
||||
let rewardedVideoErrored = false; // Becomes true when the video fails to load.
|
||||
// Reward video
|
||||
let videoLoading = false;
|
||||
let videoReady = false;
|
||||
let videoErrored = false;
|
||||
let videoShowing = false;
|
||||
let videoRewardReceived = false;
|
||||
|
||||
let npaValue = '0'; // TODO: expose an API to change this and also an automatic way using the consent SDK.
|
||||
|
||||
// Admob initialization listener
|
||||
document.addEventListener(
|
||||
'deviceready',
|
||||
async () => {
|
||||
// Obtain user consent ?
|
||||
|
||||
await admob.start();
|
||||
|
||||
logger.info('AdMob succesfully started.');
|
||||
admobStarted = true;
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
/**
|
||||
* Helper to know if we are on mobile and admob is correctly initialized.
|
||||
*/
|
||||
const checkIfAdMobIsAvailable = () => {
|
||||
if (typeof cordova === 'undefined') {
|
||||
logger.warn('We are not on mobile, AdMob will not be available.');
|
||||
return false;
|
||||
}
|
||||
if (typeof admob === 'undefined' || !admobStarted) {
|
||||
logger.warn('AdMob has not been configured or started properly.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to get the correct ad id depending on the platform. Android and iOS use different ids.
|
||||
*/
|
||||
const getAdUnitId = (androidAdUnitId, iosAdUnitId, type) => {
|
||||
if (typeof cordova === 'undefined') {
|
||||
logger.warn('Cordova is not available.');
|
||||
return;
|
||||
}
|
||||
if (cordova.platformId === 'android') {
|
||||
return isUsingTestAds ? testAdIds[type].android : androidAdUnitId;
|
||||
} else if (cordova.platformId === 'ios') {
|
||||
return isUsingTestAds ? testAdIds[type].ios : iosAdUnitId;
|
||||
}
|
||||
|
||||
logger.error('Unsupported platform: ', cordova.platformId);
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Activate or deactivate the test mode ("development" mode).
|
||||
* When activated, tests ads will be served instead of real ones.
|
||||
@@ -165,116 +47,43 @@ namespace gdjs {
|
||||
* account being flagged for invalid activity.
|
||||
*/
|
||||
export const setTestMode = (enable: boolean) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
isUsingTestAds = enable;
|
||||
};
|
||||
|
||||
// -------------------
|
||||
// ---- App Open -----
|
||||
// -------------------
|
||||
export const isAppOpenLoading = () => appOpenLoading;
|
||||
export const isAppOpenReady = () => appOpenReady;
|
||||
export const isAppOpenShowing = () => appOpenShowing;
|
||||
export const isAppOpenErrored = () => appOpenErrored;
|
||||
|
||||
/** Load an AppOpen. */
|
||||
export const loadAppOpen = async (
|
||||
androidAdUnitId,
|
||||
iosAdUnitId,
|
||||
displayLandscape,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
// If an appOpen is already loading or showing, we don't stop it.
|
||||
if (appOpenLoading || appOpenShowing) {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
const adUnitId = getAdUnitId(androidAdUnitId, iosAdUnitId, 'appOpen');
|
||||
if (!adUnitId) return;
|
||||
|
||||
appOpenLoading = true;
|
||||
appOpenReady = false;
|
||||
appOpenErrored = false;
|
||||
|
||||
appOpen = new admob.AppOpenAd({
|
||||
adUnitId,
|
||||
orientation: displayLandscape
|
||||
? AppOpenAdOrientation.LandscapeLeft
|
||||
: AppOpenAdOrientation.Portrait,
|
||||
});
|
||||
|
||||
appOpen.on('load', () => {
|
||||
appOpenReady = true;
|
||||
appOpenLoading = false;
|
||||
});
|
||||
appOpen.on('loadfail', () => {
|
||||
appOpenLoading = false;
|
||||
appOpenErrored = true;
|
||||
});
|
||||
appOpen.on('show', () => {
|
||||
appOpenShowing = true;
|
||||
appOpenReady = false;
|
||||
});
|
||||
appOpen.on('showfail', () => {
|
||||
appOpenShowing = false;
|
||||
appOpenErrored = true;
|
||||
});
|
||||
appOpen.on('dismiss', () => {
|
||||
appOpenShowing = false;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading Admob App Open.');
|
||||
await appOpen.load();
|
||||
logger.info('AdMob App Open successfully loaded.');
|
||||
appOpenLoading = false;
|
||||
appOpenReady = true;
|
||||
if (displayWhenLoaded) showAppOpen();
|
||||
} catch (error) {
|
||||
logger.error('Error while loading an App Open:', error);
|
||||
appOpenLoading = false;
|
||||
appOpenReady = false;
|
||||
appOpenErrored = true;
|
||||
}
|
||||
admob.setDevMode(enable);
|
||||
};
|
||||
|
||||
/** Show the loaded appOpen. */
|
||||
export const showAppOpen = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!appOpen) {
|
||||
logger.warn('App Open has not been set up, call loadAppOpen first.');
|
||||
return;
|
||||
}
|
||||
if (!appOpenReady) {
|
||||
logger.info('App Open not loaded yet, cannot display it.');
|
||||
return;
|
||||
}
|
||||
appOpenErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob App Open.');
|
||||
await appOpen.show();
|
||||
// AppOpen will be shown and
|
||||
// `appOpenShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error('Error while showing an AdMob App Open:', error);
|
||||
appOpenShowing = false;
|
||||
appOpenErrored = true;
|
||||
}
|
||||
// Banner
|
||||
/** Check if a banner is loading. */
|
||||
export const isBannerLoading = () => {
|
||||
return bannerLoading;
|
||||
};
|
||||
/** Check if a banner is being shown on screen. */
|
||||
export const isBannerShowing = () => {
|
||||
return bannerShowing;
|
||||
};
|
||||
/** Check if the banner had an error while loading it. */
|
||||
export const isBannerErrored = () => {
|
||||
return bannerErrored;
|
||||
};
|
||||
|
||||
// -----------------
|
||||
// ---- Banner -----
|
||||
// -----------------
|
||||
export const isBannerConfigured = () => bannerConfigured;
|
||||
export const isBannerLoaded = () => bannerLoaded;
|
||||
export const isBannerShowing = () => bannerShowing;
|
||||
export const isBannerErrored = () => bannerErrored;
|
||||
/**
|
||||
* Set up a banner that can then be displayed by calling `showBanner`.
|
||||
*/
|
||||
export const setupBanner = function (androidID, iosID, atTop) {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
bannerAndroidId = androidID;
|
||||
bannerIosId = iosID;
|
||||
bannerPosition = atTop ? 'top' : 'bottom';
|
||||
};
|
||||
/**
|
||||
* Set the size of the banner to be shown when `showBanner` is called.
|
||||
* @param bannerAdSizeType The type of the banner to displayed
|
||||
*/
|
||||
export const setBannerAdSizeType = (
|
||||
bannerAdSizeType:
|
||||
| 'BANNER'
|
||||
@@ -284,421 +93,288 @@ namespace gdjs {
|
||||
| 'LEADERBOARD'
|
||||
| 'SMART_BANNER'
|
||||
) => {
|
||||
const adSizeTypes = {
|
||||
BANNER: AdSizeType.BANNER,
|
||||
LARGE_BANNER: AdSizeType.LARGE_BANNER,
|
||||
MEDIUM_RECTANGLE: AdSizeType.MEDIUM_RECTANGLE,
|
||||
FULL_BANNER: AdSizeType.FULL_BANNER,
|
||||
LEADERBOARD: AdSizeType.LEADERBOARD,
|
||||
SMART_BANNER: AdSizeType.SMART_BANNER,
|
||||
};
|
||||
|
||||
bannerRequestedAdSizeType =
|
||||
adSizeTypes[bannerAdSizeType] || AdSizeType.SMART_BANNER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set up a banner that can then be displayed by calling `showBanner`.
|
||||
* If a banner is already set up, it will be hidden and replaced by the new one.
|
||||
* Display the banner that was set up with `loadBanner` (and `setBannerAdSizeType`).
|
||||
*/
|
||||
export const setupBanner = async (androidAdUnitId, iosAdUnitId, atTop) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
const adUnitId = getAdUnitId(androidAdUnitId, iosAdUnitId, 'banner');
|
||||
if (!adUnitId) return;
|
||||
|
||||
if (banner && bannerShowing) {
|
||||
logger.info('Banner already visible, hiding it to display new one.');
|
||||
await hideBanner();
|
||||
}
|
||||
|
||||
bannerConfigured = false;
|
||||
bannerLoaded = false;
|
||||
|
||||
banner = new admob.BannerAd({
|
||||
adUnitId,
|
||||
position: atTop ? 'top' : 'bottom',
|
||||
size: bannerRequestedAdSizeType,
|
||||
});
|
||||
|
||||
banner.on('load', () => {
|
||||
bannerShowing = true;
|
||||
bannerLoaded = true;
|
||||
});
|
||||
banner.on('loadfail', () => {
|
||||
bannerShowing = false;
|
||||
bannerLoaded = false;
|
||||
bannerErrored = true;
|
||||
});
|
||||
|
||||
bannerConfigured = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a banner that was set up with `setupBanner` (and `setBannerAdSizeType`).
|
||||
*/
|
||||
export const showBanner = async () => {
|
||||
if (!banner) {
|
||||
logger.info('Banner not configured, use setupBanner first.');
|
||||
return;
|
||||
}
|
||||
if (bannerShowing) {
|
||||
logger.info('Banner already visible. Ignoring.');
|
||||
return;
|
||||
}
|
||||
bannerErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob banner.');
|
||||
await banner.show();
|
||||
if (bannerLoaded) {
|
||||
// Banner is already loaded, so it will be shown immediately.
|
||||
bannerShowing = true;
|
||||
}
|
||||
} catch (error) {
|
||||
bannerShowing = false;
|
||||
bannerErrored = true;
|
||||
logger.error('Error while showing an AdMob banner:', error);
|
||||
}
|
||||
};
|
||||
|
||||
/** Hide the banner shown on screen. */
|
||||
export const hideBanner = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!banner || !bannerShowing) {
|
||||
logger.warn('No banner is being shown.');
|
||||
export const showBanner = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
await banner.hide();
|
||||
bannerLoading = true;
|
||||
bannerShowing = false;
|
||||
// Note that the banner is still loaded, which is why bannerLoaded is not set to false.
|
||||
// We hide the banner, but keep it configured to display it again if needed.
|
||||
bannerErrored = false;
|
||||
admob.banner
|
||||
.show({
|
||||
id: {
|
||||
android: bannerAndroidId,
|
||||
ios: bannerIosId,
|
||||
},
|
||||
position: bannerPosition,
|
||||
size: bannerRequestedAdSizeType,
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
bannerShowing = true;
|
||||
bannerLoading = false;
|
||||
logger.info('AdMob banner successfully shown.');
|
||||
},
|
||||
(error) => {
|
||||
bannerShowing = false;
|
||||
bannerLoading = false;
|
||||
bannerErrored = true;
|
||||
logger.error('Error while showing an AdMob banner:', error);
|
||||
}
|
||||
);
|
||||
};
|
||||
/** Hide the banner shown on screen. */
|
||||
export const hideBanner = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
bannerShowing = false;
|
||||
admob.banner.hide({
|
||||
android: bannerAndroidId,
|
||||
ios: bannerIosId,
|
||||
});
|
||||
};
|
||||
|
||||
// -----------------------
|
||||
// ---- Interstitial -----
|
||||
// -----------------------
|
||||
export const isInterstitialLoading = () => interstitialLoading;
|
||||
export const isInterstitialReady = () => interstitialReady;
|
||||
export const isInterstitialShowing = () => interstitialShowing;
|
||||
export const isInterstitialErrored = () => interstitialErrored;
|
||||
// Interstitial
|
||||
/** Check if the interstitial is loading. */
|
||||
export const isInterstitialLoading = () => {
|
||||
return interstitialLoading;
|
||||
};
|
||||
/** Check if the interstitial is ready to display. */
|
||||
export const isInterstitialReady = () => {
|
||||
return interstitialReady;
|
||||
};
|
||||
/** Check if the interstitial is shown on screen. */
|
||||
export const isInterstitialShowing = () => {
|
||||
return interstitialShowing;
|
||||
};
|
||||
/** Check if the interstitial had an error while loading it. */
|
||||
export const isInterstitialErrored = () => {
|
||||
return interstitialErrored;
|
||||
};
|
||||
|
||||
/** Load an interstitial. */
|
||||
export const loadInterstitial = async (
|
||||
androidAdUnitId,
|
||||
iosAdUnitId,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
// If an interstitial is already loading or showing, we don't stop it.
|
||||
if (interstitialLoading || interstitialShowing) {
|
||||
export const loadInterstitial = (androidID, iosID, displayWhenLoaded) => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (interstitialLoading || interstitialReady || interstitialShowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
const adUnitId = getAdUnitId(
|
||||
androidAdUnitId,
|
||||
iosAdUnitId,
|
||||
'interstitial'
|
||||
);
|
||||
if (!adUnitId) return;
|
||||
|
||||
interstitialLoading = true;
|
||||
interstitialReady = false;
|
||||
interstitialErrored = false;
|
||||
|
||||
interstitial = new admob.InterstitialAd({
|
||||
adUnitId,
|
||||
npa: npaValue,
|
||||
});
|
||||
|
||||
interstitial.on('load', () => {
|
||||
interstitialReady = true;
|
||||
interstitialLoading = false;
|
||||
});
|
||||
interstitial.on('loadfail', () => {
|
||||
interstitialLoading = false;
|
||||
interstitialErrored = true;
|
||||
});
|
||||
interstitial.on('show', () => {
|
||||
interstitialShowing = true;
|
||||
interstitialReady = false;
|
||||
});
|
||||
interstitial.on('showfail', () => {
|
||||
interstitialShowing = false;
|
||||
interstitialErrored = true;
|
||||
});
|
||||
interstitial.on('dismiss', () => {
|
||||
interstitialShowing = false;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading Admob interstitial.');
|
||||
await interstitial.load();
|
||||
logger.info('AdMob interstitial successfully loaded.');
|
||||
interstitialLoading = false;
|
||||
interstitialReady = true;
|
||||
if (displayWhenLoaded) showInterstitial();
|
||||
} catch (error) {
|
||||
logger.error('Error while loading a interstitial:', error);
|
||||
interstitialLoading = false;
|
||||
interstitialReady = false;
|
||||
interstitialErrored = true;
|
||||
}
|
||||
admob.interstitial
|
||||
.load({
|
||||
id: {
|
||||
android: androidID,
|
||||
ios: iosID,
|
||||
},
|
||||
npa: npaValue,
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
logger.info('AdMob interstitial successfully loaded.');
|
||||
if (displayWhenLoaded) showInterstitial();
|
||||
},
|
||||
(error) => {
|
||||
interstitialLoading = false;
|
||||
interstitialReady = false;
|
||||
interstitialErrored = true;
|
||||
logger.error('Error while loading a interstitial:', error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** Show the loaded interstitial. */
|
||||
export const showInterstitial = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!interstitial) {
|
||||
logger.warn(
|
||||
'Interstitial has not been set up, call loadInterstitial first.'
|
||||
);
|
||||
export const showInterstitial = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (!interstitialReady) {
|
||||
logger.info('Interstitial not loaded yet, cannot display it.');
|
||||
return;
|
||||
}
|
||||
interstitialErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob interstitial.');
|
||||
await interstitial.show();
|
||||
// Interstitial will be shown and
|
||||
// `interstitialShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error('Error while showing an AdMob interstitial:', error);
|
||||
interstitialShowing = false;
|
||||
interstitialErrored = true;
|
||||
}
|
||||
};
|
||||
|
||||
// --------------------------------
|
||||
// ---- Rewarded Interstitial -----
|
||||
// --------------------------------
|
||||
export const isRewardedInterstitialLoading = () =>
|
||||
rewardedInterstitialLoading;
|
||||
export const isRewardedInterstitialReady = () => rewardedInterstitialReady;
|
||||
export const isRewardedInterstitialShowing = () =>
|
||||
rewardedInterstitialShowing;
|
||||
export const isRewardedInterstitialErrored = () =>
|
||||
rewardedInterstitialErrored;
|
||||
|
||||
/** Check if the reward of the rewarded interstitial was received. */
|
||||
export const wasRewardedInterstitialRewardReceived = function (
|
||||
markAsClaimed
|
||||
) {
|
||||
const reward = rewardedInterstitialRewardReceived;
|
||||
if (markAsClaimed) {
|
||||
rewardedInterstitialRewardReceived = false;
|
||||
}
|
||||
return reward;
|
||||
};
|
||||
|
||||
/** Load a rewarded interstitial. */
|
||||
export const loadRewardedInterstitial = async (
|
||||
androidAdUnitID,
|
||||
iosAdUnitID,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
if (rewardedInterstitialLoading || rewardedInterstitialShowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
const adUnitId = getAdUnitId(
|
||||
androidAdUnitID,
|
||||
iosAdUnitID,
|
||||
'rewardedInterstitial'
|
||||
admob.interstitial.show().then(
|
||||
() => {
|
||||
// Interstitial will be shown and
|
||||
// `interstitialShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
},
|
||||
(error) => {
|
||||
interstitialShowing = false;
|
||||
interstitialErrored = true;
|
||||
logger.error('Error while trying to show an interstitial:', error);
|
||||
}
|
||||
);
|
||||
if (!adUnitId) return;
|
||||
|
||||
rewardedInterstitialLoading = true;
|
||||
rewardedInterstitialReady = false;
|
||||
rewardedInterstitialErrored = false;
|
||||
|
||||
rewardedInterstitial = new admob.RewardedInterstitialAd({
|
||||
adUnitId,
|
||||
npa: npaValue,
|
||||
});
|
||||
|
||||
// Rewarded video event listeners
|
||||
rewardedInterstitial.on('load', () => {
|
||||
rewardedInterstitialReady = true;
|
||||
rewardedInterstitialLoading = false;
|
||||
});
|
||||
rewardedInterstitial.on('loadfail', () => {
|
||||
rewardedInterstitialLoading = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
});
|
||||
rewardedInterstitial.on('show', () => {
|
||||
rewardedInterstitialShowing = true;
|
||||
rewardedInterstitialReady = false;
|
||||
});
|
||||
rewardedInterstitial.on('showfail', () => {
|
||||
rewardedInterstitialShowing = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
});
|
||||
rewardedInterstitial.on('dismiss', () => {
|
||||
rewardedInterstitialShowing = false;
|
||||
});
|
||||
rewardedInterstitial.on('reward', () => {
|
||||
rewardedInterstitialRewardReceived = true;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading AdMob rewarded interstitial.');
|
||||
await rewardedInterstitial.load();
|
||||
logger.info('AdMob rewarded interstitial successfully loaded.');
|
||||
rewardedInterstitialLoading = false;
|
||||
rewardedInterstitialReady = true;
|
||||
if (displayWhenLoaded) showRewardedInterstitial();
|
||||
} catch (error) {
|
||||
rewardedInterstitialLoading = false;
|
||||
rewardedInterstitialReady = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
logger.error('Error while loading a rewarded interstitial:', error);
|
||||
}
|
||||
};
|
||||
|
||||
/** Show the loaded reward interstitial. */
|
||||
export const showRewardedInterstitial = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!rewardedInterstitial) {
|
||||
logger.warn(
|
||||
'interstitial has not been set up, call loadRewardedInterstitial first.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!rewardedInterstitialReady) {
|
||||
logger.info('Rewarded interstitial not loaded yet, cannot display it.');
|
||||
}
|
||||
rewardedInterstitialErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob rewarded interstitial.');
|
||||
await rewardedInterstitial.show();
|
||||
// Rewarded interstitial will be shown and
|
||||
// `rewardedInterstitialShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
'Error while showing an AdMob rewarded interstitial:',
|
||||
error
|
||||
);
|
||||
rewardedInterstitialShowing = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
}
|
||||
// Reward video
|
||||
/** Check if the video is loading. */
|
||||
export const isVideoLoading = () => {
|
||||
return videoLoading;
|
||||
};
|
||||
/** Check if the video is ready to display. */
|
||||
export const isVideoReady = () => {
|
||||
return videoReady;
|
||||
};
|
||||
/** Check if the video is shown on screen. */
|
||||
export const isVideoShowing = () => {
|
||||
return videoShowing;
|
||||
};
|
||||
/** Check if the video had an error while loading it. */
|
||||
export const isVideoErrored = () => {
|
||||
return videoErrored;
|
||||
};
|
||||
|
||||
/** Mark the reward of the interstitial as claimed. */
|
||||
export const markRewardedInterstitialRewardAsClaimed = () => {
|
||||
rewardedInterstitialRewardReceived = false;
|
||||
};
|
||||
|
||||
// -------------------------
|
||||
// ---- Rewarded Video -----
|
||||
// -------------------------
|
||||
export const isRewardedVideoLoading = () => rewardedVideoLoading;
|
||||
export const isRewardedVideoReady = () => rewardedVideoReady;
|
||||
export const isRewardedVideoShowing = () => rewardedVideoShowing;
|
||||
export const isRewardedVideoErrored = () => rewardedVideoErrored;
|
||||
|
||||
/** Check if the reward of the rewarded video was received. */
|
||||
export const wasRewardedVideoRewardReceived = function (markAsClaimed) {
|
||||
const reward = rewardedVideoRewardReceived;
|
||||
/** Check if the reward of the video was received. */
|
||||
export const wasVideoRewardReceived = function (markAsClaimed) {
|
||||
const reward = videoRewardReceived;
|
||||
if (markAsClaimed) {
|
||||
rewardedVideoRewardReceived = false;
|
||||
videoRewardReceived = false;
|
||||
}
|
||||
return reward;
|
||||
};
|
||||
|
||||
/** Load a rewarded video. */
|
||||
export const loadRewardedVideo = async (
|
||||
androidAdUnitID,
|
||||
iosAdUnitID,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
if (rewardedVideoLoading || rewardedVideoShowing) {
|
||||
/** Load a reward video. */
|
||||
export const loadVideo = function (androidID, iosID, displayWhenLoaded) {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (videoLoading || videoReady || videoShowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
const adUnitId = getAdUnitId(androidAdUnitID, iosAdUnitID, 'rewarded');
|
||||
if (!adUnitId) return;
|
||||
videoLoading = true;
|
||||
videoReady = false;
|
||||
videoErrored = false;
|
||||
admob.rewardVideo
|
||||
.load({
|
||||
id: {
|
||||
android: androidID,
|
||||
ios: iosID,
|
||||
},
|
||||
npa: npaValue,
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
logger.info('AdMob reward video successfully loaded.');
|
||||
|
||||
rewardedVideoLoading = true;
|
||||
rewardedVideoReady = false;
|
||||
rewardedVideoErrored = false;
|
||||
|
||||
rewardedVideo = new admob.RewardedAd({
|
||||
adUnitId,
|
||||
npa: npaValue,
|
||||
});
|
||||
|
||||
// Rewarded video event listeners
|
||||
rewardedVideo.on('load', () => {
|
||||
rewardedVideoReady = true;
|
||||
rewardedVideoLoading = false;
|
||||
});
|
||||
rewardedVideo.on('loadfail', () => {
|
||||
rewardedVideoLoading = false;
|
||||
rewardedVideoErrored = true;
|
||||
});
|
||||
rewardedVideo.on('show', () => {
|
||||
rewardedVideoShowing = true;
|
||||
rewardedVideoReady = false;
|
||||
});
|
||||
rewardedVideo.on('showfail', () => {
|
||||
rewardedVideoShowing = false;
|
||||
rewardedVideoErrored = true;
|
||||
});
|
||||
rewardedVideo.on('dismiss', () => {
|
||||
rewardedVideoShowing = false;
|
||||
});
|
||||
rewardedVideo.on('reward', () => {
|
||||
rewardedVideoRewardReceived = true;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading AdMob rewarded video.');
|
||||
await rewardedVideo.load();
|
||||
logger.info('AdMob rewarded video successfully loaded.');
|
||||
rewardedVideoLoading = false;
|
||||
rewardedVideoReady = true;
|
||||
if (displayWhenLoaded) showRewardedVideo();
|
||||
} catch (error) {
|
||||
rewardedVideoLoading = false;
|
||||
rewardedVideoReady = false;
|
||||
rewardedVideoErrored = true;
|
||||
logger.error('Error while loading a rewarded video:', error);
|
||||
}
|
||||
if (displayWhenLoaded) showVideo();
|
||||
},
|
||||
(error) => {
|
||||
videoLoading = false;
|
||||
videoReady = false;
|
||||
videoErrored = true;
|
||||
logger.error('Error while loading a reward video:', error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** Show the loaded reward video. */
|
||||
export const showRewardedVideo = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!rewardedVideo) {
|
||||
logger.warn('Video has not been set up, call loadRewardedVideo first.');
|
||||
export const showVideo = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (!rewardedVideoReady) {
|
||||
logger.info('Rewarded video not loaded yet, cannot display it.');
|
||||
}
|
||||
rewardedVideoErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob rewarded video.');
|
||||
await rewardedVideo.show();
|
||||
// Rewarded video will be shown and
|
||||
// `rewardedVideoShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error('Error while showing an AdMob rewarded video:', error);
|
||||
rewardedVideoShowing = false;
|
||||
rewardedVideoErrored = true;
|
||||
}
|
||||
admob.rewardVideo.show().then(
|
||||
() => {
|
||||
// Video will be shown and
|
||||
// `videoShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
},
|
||||
(error) => {
|
||||
videoShowing = false;
|
||||
videoErrored = true;
|
||||
logger.error('Error while trying to show a reward video:', error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/** Mark the reward of the video as claimed. */
|
||||
export const markRewardedVideoRewardAsClaimed = () => {
|
||||
rewardedVideoRewardReceived = false;
|
||||
export const markVideoRewardAsClaimed = () => {
|
||||
videoRewardReceived = false;
|
||||
};
|
||||
|
||||
// Banner event listeners:
|
||||
document.addEventListener('admob.banner.load', () => {
|
||||
bannerShowing = true;
|
||||
bannerLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.banner.load_fail', () => {
|
||||
bannerLoading = false;
|
||||
});
|
||||
|
||||
document.addEventListener('admob.banner.open', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
|
||||
document.addEventListener('admob.banner.exit_app', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
document.addEventListener('admob.banner.close', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
|
||||
// Interstitial event listeners
|
||||
document.addEventListener('admob.interstitial.load', () => {
|
||||
interstitialReady = true;
|
||||
interstitialLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.load_fail', () => {
|
||||
interstitialLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.open', () => {
|
||||
interstitialShowing = true;
|
||||
interstitialReady = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.close', () => {
|
||||
interstitialShowing = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.exit_app', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
|
||||
// Reward video event listeners
|
||||
document.addEventListener('admob.reward_video.load', () => {
|
||||
videoReady = true;
|
||||
videoLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.load_fail', () => {
|
||||
videoLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.open', () => {
|
||||
videoShowing = true;
|
||||
videoReady = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.close', () => {
|
||||
videoShowing = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.start', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
document.addEventListener('admob.reward_video.complete', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
document.addEventListener('admob.reward_video.reward', () => {
|
||||
videoRewardReceived = true;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.exit_app', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,10 @@
|
||||
// @ts-check
|
||||
describe('gdjs.AnchorRuntimeBehavior', function () {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame({
|
||||
propertiesOverrides: { windowHeight: 1000, windowWidth: 1000 },
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: { resources: [] },
|
||||
// @ts-ignore
|
||||
properties: { windowWidth: 1000, windowHeight: 1000 },
|
||||
});
|
||||
const anchorBehaviorName = 'Anchor';
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
|
@@ -36,7 +36,7 @@ module.exports = {
|
||||
'Open source (MIT License)'
|
||||
)
|
||||
.setExtensionHelpPath('/objects/bbtext')
|
||||
.setCategory('Text');
|
||||
.setCategory('User interface');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(_('BBCode Text Object'))
|
||||
.setIcon('JsPlatform/Extensions/bbcode32.png');
|
||||
@@ -174,7 +174,7 @@ module.exports = {
|
||||
.addIncludeFile(
|
||||
'Extensions/BBText/pixi-multistyle-text/dist/pixi-multistyle-text.umd.js'
|
||||
)
|
||||
.setCategoryFullName(_('Text'));
|
||||
.setCategoryFullName(_('User interface'));
|
||||
|
||||
/**
|
||||
* Utility function to add both a setter and a getter to a property from a list.
|
||||
|
@@ -36,10 +36,9 @@ module.exports = {
|
||||
'Open source (MIT License)'
|
||||
)
|
||||
.setExtensionHelpPath('/objects/bitmap_text')
|
||||
.setCategory('Text');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(_('Bitmap Text'))
|
||||
.setIcon('JsPlatform/Extensions/bitmapfont32.png');
|
||||
.setCategory('User interface');
|
||||
extension.addInstructionOrExpressionGroupMetadata(_("Bitmap Text"))
|
||||
.setIcon("JsPlatform/Extensions/bitmapfont32.png");
|
||||
|
||||
const bitmapTextObject = new gd.ObjectJsImplementation();
|
||||
// $FlowExpectedError
|
||||
@@ -92,7 +91,7 @@ module.exports = {
|
||||
.setType('resource')
|
||||
.addExtraInfo('bitmapFont') //fnt or xml files
|
||||
.setLabel(_('Bitmap Font'))
|
||||
.setGroup(_('Font'));
|
||||
.setGroup(_("Font"));
|
||||
|
||||
objectProperties
|
||||
.getOrCreate('textureAtlasResourceName')
|
||||
@@ -100,7 +99,7 @@ module.exports = {
|
||||
.setType('resource')
|
||||
.addExtraInfo('image')
|
||||
.setLabel(_('Bitmap atlas image'))
|
||||
.setGroup(_('Font'));
|
||||
.setGroup(_("Font"));
|
||||
|
||||
objectProperties
|
||||
.getOrCreate('scale')
|
||||
@@ -114,7 +113,7 @@ module.exports = {
|
||||
.setValue(objectContent.tint)
|
||||
.setType('color')
|
||||
.setLabel(_('Font tint'))
|
||||
.setGroup(_('Font'));
|
||||
.setGroup(_("Font"));
|
||||
|
||||
objectProperties
|
||||
.getOrCreate('wordWrap')
|
||||
@@ -175,7 +174,7 @@ module.exports = {
|
||||
.addIncludeFile(
|
||||
'Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js'
|
||||
)
|
||||
.setCategoryFullName(_('Text'));
|
||||
.setCategoryFullName(_('User interface'));
|
||||
|
||||
object
|
||||
.addExpressionAndConditionAndAction(
|
||||
@@ -653,7 +652,8 @@ module.exports = {
|
||||
|
||||
// This is called to update the PIXI object on the scene editor
|
||||
RenderedBitmapTextInstance.prototype.update = function () {
|
||||
const properties = this._associatedObjectConfiguration.getProperties();
|
||||
const properties = this._associatedObjectConfiguration
|
||||
.getProperties();
|
||||
|
||||
// Update the rendered text properties (note: Pixi is only
|
||||
// applying changes if there were changed).
|
||||
|
@@ -1,6 +1,11 @@
|
||||
// @ts-check
|
||||
describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
var runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: { resources: [] },
|
||||
// @ts-ignore
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -176,12 +176,12 @@ module.exports = {
|
||||
.setType('number');
|
||||
bevelProperties
|
||||
.getOrCreate('lightColor')
|
||||
.setValue('255;255;255')
|
||||
.setValue('#ffffff')
|
||||
.setLabel(_('Light color (color of the outline)'))
|
||||
.setType('color');
|
||||
bevelProperties
|
||||
.getOrCreate('shadowColor')
|
||||
.setValue('0;0;0')
|
||||
.setValue('#000000')
|
||||
.setLabel(_('Shadow color (color of the outline)'))
|
||||
.setType('color');
|
||||
bevelProperties
|
||||
@@ -333,13 +333,13 @@ module.exports = {
|
||||
const colorReplaceProperties = colorReplaceEffect.getProperties();
|
||||
colorReplaceProperties
|
||||
.getOrCreate('originalColor')
|
||||
.setValue('252;3;65')
|
||||
.setValue('#ff0000')
|
||||
.setLabel(_('Original Color'))
|
||||
.setType('color')
|
||||
.setDescription('The color that will be changed');
|
||||
colorReplaceProperties
|
||||
.getOrCreate('newColor')
|
||||
.setValue('255;255;255')
|
||||
.setValue('#000000')
|
||||
.setLabel(_('New Color'))
|
||||
.setType('color')
|
||||
.setDescription('The new color');
|
||||
@@ -517,7 +517,7 @@ module.exports = {
|
||||
.setType('number');
|
||||
dropShadowProperties
|
||||
.getOrCreate('color')
|
||||
.setValue('255;255;255')
|
||||
.setValue('#000000')
|
||||
.setLabel(_('Color of the shadow'))
|
||||
.setType('color');
|
||||
dropShadowProperties
|
||||
@@ -646,7 +646,7 @@ module.exports = {
|
||||
.setType('number');
|
||||
glowProperties
|
||||
.getOrCreate('color')
|
||||
.setValue('255;255;255')
|
||||
.setValue('#ffffff')
|
||||
.setLabel(_('Color (color of the outline)'))
|
||||
.setType('color');
|
||||
|
||||
@@ -868,7 +868,7 @@ module.exports = {
|
||||
.setType('number');
|
||||
outlineProperties
|
||||
.getOrCreate('color')
|
||||
.setValue('255;255;255')
|
||||
.setValue('1')
|
||||
.setLabel(_('Color of the outline'))
|
||||
.setType('color');
|
||||
outlineProperties
|
||||
|
@@ -89,7 +89,7 @@ module.exports = {
|
||||
.addExtraInfo('image');
|
||||
dummyEffectProperties
|
||||
.getOrCreate('someColor')
|
||||
.setValue('255;3;62')
|
||||
.setValue('#0022FF')
|
||||
.setLabel(_("Color (won't be used, just for demonstration purpose)"))
|
||||
.setType('color')
|
||||
.setDescription(_('Another optional description.'));
|
||||
|
@@ -1,3 +1,17 @@
|
||||
/**
|
||||
* A firebase configuaration of a project made only for those tests.
|
||||
*/
|
||||
const firebaseConfig = {
|
||||
apiKey: 'AIzaSyBwPnGpfEBXDjwQrWfU0wqgp4m9qEt7YM8',
|
||||
authDomain: 'gdtest-e11a5.firebaseapp.com',
|
||||
databaseURL: 'https://gdtest-e11a5.firebaseio.com',
|
||||
projectId: 'gdtest-e11a5',
|
||||
storageBucket: 'gdtest-e11a5.appspot.com',
|
||||
messagingSenderId: '254035412678',
|
||||
appId: '1:254035412678:web:2ddd6b83019b7f259b79c7',
|
||||
measurementId: 'G-4REML26L59',
|
||||
};
|
||||
|
||||
/**
|
||||
* Turns a callback variable into a promise.
|
||||
* @param {(callbackVariable: {setString: (result: "ok" | string) => void}, result: gdjs.Variable) => any} executor
|
||||
@@ -24,20 +38,6 @@ const variable = new gdjs.Variable().fromJSObject({
|
||||
it: ['is', true],
|
||||
});
|
||||
|
||||
/**
|
||||
* A firebase configuration of a project made only for those tests.
|
||||
*/
|
||||
const firebaseConfig = {
|
||||
apiKey: 'AIzaSyBwPnGpfEBXDjwQrWfU0wqgp4m9qEt7YM8',
|
||||
authDomain: 'gdtest-e11a5.firebaseapp.com',
|
||||
databaseURL: 'https://gdtest-e11a5.firebaseio.com',
|
||||
projectId: 'gdtest-e11a5',
|
||||
storageBucket: 'gdtest-e11a5.appspot.com',
|
||||
messagingSenderId: '254035412678',
|
||||
appId: '1:254035412678:web:2ddd6b83019b7f259b79c7',
|
||||
measurementId: 'G-4REML26L59',
|
||||
};
|
||||
|
||||
// The tests require an internet connection, as a real Firebase instance is used.
|
||||
const describeIfOnline = navigator.onLine ? describe : describe.skip;
|
||||
describeIfOnline('Firebase extension end-to-end tests', function () {
|
||||
@@ -48,8 +48,8 @@ describeIfOnline('Firebase extension end-to-end tests', function () {
|
||||
.toString()
|
||||
.replace('.', '-')}-${Date.now()}`;
|
||||
|
||||
before(async function setupFirebase() {
|
||||
await gdjs.evtTools.firebaseTools._setupFirebase({
|
||||
before(function setupFirebase() {
|
||||
gdjs.evtTools.firebaseTools._setupFirebase({
|
||||
getGame: () => ({
|
||||
getExtensionProperty: () => JSON.stringify(firebaseConfig),
|
||||
}),
|
||||
|
@@ -1,6 +1,10 @@
|
||||
describe('Inventory', function () {
|
||||
it('Inventories can be serialized then unserialized with no data loss', () => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
var runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
|
||||
gdjs.evtTools.inventory.add(runtimeScene, 'MyInventory', 'sword');
|
||||
|
@@ -154,21 +154,6 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/Leaderboards/leaderboardstools.js')
|
||||
.setFunctionName('gdjs.evtTools.leaderboards.isSaving');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'HasPlayerJustClosedLeaderboardView',
|
||||
_('Closed by player'),
|
||||
_('Check if the player has just closed the leaderboard view.'),
|
||||
_('Player has just closed the leaderboard view'),
|
||||
_('Display leaderboard'),
|
||||
'JsPlatform/Extensions/leaderboard.svg',
|
||||
'JsPlatform/Extensions/leaderboard.svg'
|
||||
)
|
||||
.setHelpPath('/all-features/leaderboards')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/Leaderboards/leaderboardstools.js')
|
||||
.setFunctionName('gdjs.evtTools.leaderboards.hasPlayerJustClosedLeaderboardView');
|
||||
|
||||
extension
|
||||
.addStrExpression(
|
||||
'LastSaveError',
|
||||
|
@@ -5,19 +5,6 @@ namespace gdjs {
|
||||
const logger = new gdjs.Logger('Leaderboards');
|
||||
export namespace evtTools {
|
||||
export namespace leaderboards {
|
||||
let _hasPlayerJustClosedLeaderboardView = false;
|
||||
|
||||
gdjs.registerRuntimeScenePostEventsCallback(() => {
|
||||
// Set it back to false for the next frame.
|
||||
_hasPlayerJustClosedLeaderboardView = false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns true if the player has just closed the leaderboard view.
|
||||
*/
|
||||
export const hasPlayerJustClosedLeaderboardView = () =>
|
||||
_hasPlayerJustClosedLeaderboardView;
|
||||
|
||||
const computeDigest = (payload: string): string => {
|
||||
const shaObj = new jsSHA('SHA-256', 'TEXT', { encoding: 'UTF8' });
|
||||
shaObj.update(payload);
|
||||
@@ -534,7 +521,6 @@ namespace gdjs {
|
||||
) {
|
||||
switch (event.data) {
|
||||
case 'closeLeaderboardView':
|
||||
_hasPlayerJustClosedLeaderboardView = true;
|
||||
closeLeaderboardView(runtimeScene);
|
||||
break;
|
||||
case 'leaderboardViewLoaded':
|
||||
|
@@ -56,7 +56,13 @@ const addLightObstacle = (runtimeScene, width, height) => {
|
||||
|
||||
describe('gdjs.LightRuntimeObject', function () {
|
||||
PIXI.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
@@ -90,7 +96,13 @@ describe('gdjs.LightRuntimeObject', function () {
|
||||
|
||||
describe('Light with obstacles around it', function () {
|
||||
PIXI.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
|
@@ -6,7 +6,12 @@ describe('gdjs.LinksManager', function () {
|
||||
object3Names,
|
||||
eventsFunctionContext
|
||||
) => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -6,7 +6,12 @@ describe('gdjs.PathfindingRuntimeBehavior', function () {
|
||||
const pathFindingName = 'auto1';
|
||||
|
||||
const createScene = (framePerSecond = 60) => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -9,7 +9,12 @@ describe('gdjs.PathfindingRuntimeBehavior', function () {
|
||||
const pathFindingName = 'auto1';
|
||||
|
||||
const createScene = (framePerSecond = 60) => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -11,7 +11,12 @@ describe('gdjs.PathfindingRuntimeBehavior', function () {
|
||||
const pathFindingName = 'auto1';
|
||||
|
||||
let createScene = () => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -59,7 +59,11 @@ describe('Physics2RuntimeBehavior', () => {
|
||||
}
|
||||
|
||||
function createGameWithSceneWithPhysics2SharedData() {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: { resources: [] },
|
||||
properties: { windowWidth: 1000, windowHeight: 1000 },
|
||||
});
|
||||
const runtimeScene = new gdjs.TestRuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -1,6 +1,12 @@
|
||||
|
||||
const makePlatformerTestRuntimeScene = (timeDelta = 1000 / 60) => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeScene = new gdjs.TestRuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
|
@@ -1,6 +1,12 @@
|
||||
describe(`gdjs.PlatformerObjectRuntimeBehavior.findHighestFloorAndMoveOnTop`, function () {
|
||||
const makeTestRuntimeScene = () => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
|
@@ -68,29 +68,6 @@ module.exports = {
|
||||
)
|
||||
.setFunctionName('gdjs.playerAuthentication.displayAuthenticationBanner');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'HideAuthenticationBanner',
|
||||
_('Hide authentication banner'),
|
||||
_(
|
||||
'Hide the authentication banner from the top of the game screen.'
|
||||
),
|
||||
_('Hide the authentication banner'),
|
||||
'',
|
||||
'JsPlatform/Extensions/authentication.svg',
|
||||
'JsPlatform/Extensions/authentication.svg'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
.setHelpPath('/all-features/player-authentication')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile(
|
||||
'Extensions/PlayerAuthentication/playerauthenticationcomponents.js'
|
||||
)
|
||||
.addIncludeFile(
|
||||
'Extensions/PlayerAuthentication/playerauthenticationtools.js'
|
||||
)
|
||||
.setFunctionName('gdjs.playerAuthentication.removeAuthenticationBanner');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'OpenAuthenticationWindow',
|
||||
|
@@ -445,7 +445,7 @@ namespace gdjs {
|
||||
* Helper to add event listeners on a pressable/clickable element
|
||||
* to work on both desktop and mobile.
|
||||
*/
|
||||
const addTouchAndClickEventListeners = function (
|
||||
export const addTouchAndClickEventListeners = function (
|
||||
element: HTMLElement,
|
||||
action: () => void
|
||||
) {
|
||||
|
@@ -838,7 +838,7 @@ namespace gdjs {
|
||||
/**
|
||||
* Remove the banner displaying the authentication status.
|
||||
*/
|
||||
export const removeAuthenticationBanner = function (
|
||||
const removeAuthenticationBanner = function (
|
||||
runtimeScene: gdjs.RuntimeScene
|
||||
) {
|
||||
if (!_authenticationBanner) {
|
||||
|
@@ -23,7 +23,7 @@ void DeclareTextObjectExtension(gd::PlatformExtension& extension) {
|
||||
"some indicators, menu buttons, dialogues..."),
|
||||
"Florian Rival and Victor Levasseur",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("Text")
|
||||
.SetCategory("User interface")
|
||||
.SetExtensionHelpPath("/objects/text");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Text object"))
|
||||
.SetIcon("CppPlatform/Extensions/texticon.png");
|
||||
@@ -34,7 +34,7 @@ void DeclareTextObjectExtension(gd::PlatformExtension& extension) {
|
||||
_("Text"),
|
||||
_("Displays a text on the screen."),
|
||||
"CppPlatform/Extensions/texticon.png")
|
||||
.SetCategoryFullName(_("Text"));
|
||||
.SetCategoryFullName(_("User interface"));
|
||||
|
||||
obj.AddAction("String",
|
||||
_("Modify the text"),
|
||||
|
@@ -1294,8 +1294,9 @@ module.exports = {
|
||||
tilemapJsonFile,
|
||||
tilesetJsonFile
|
||||
) {
|
||||
let tileMapJsonData = null;
|
||||
try {
|
||||
const tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilemapJsonFile
|
||||
);
|
||||
@@ -1319,7 +1320,6 @@ module.exports = {
|
||||
} catch (err) {
|
||||
console.error('Unable to load a Tilemap JSON data: ', err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1540,38 +1540,34 @@ module.exports = {
|
||||
// GDJS doesn't use Promise to avoid allocation.
|
||||
RenderedCollisionMaskInstance.prototype._loadTiledMapWithCallback =
|
||||
function (tilemapJsonFile, tilesetJsonFile, callback) {
|
||||
this._loadTileMap(tilemapJsonFile, tilesetJsonFile).then(callback);
|
||||
this._loadTiledMap(tilemapJsonFile, tilesetJsonFile).then(callback);
|
||||
};
|
||||
|
||||
RenderedCollisionMaskInstance.prototype._loadTileMap = async function (
|
||||
RenderedCollisionMaskInstance.prototype._loadTiledMap = async function (
|
||||
tilemapJsonFile,
|
||||
tilesetJsonFile
|
||||
) {
|
||||
let tileMapJsonData = null;
|
||||
try {
|
||||
const tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilemapJsonFile
|
||||
);
|
||||
|
||||
const tileMap = TilemapHelper.TileMapManager.identify(tileMapJsonData);
|
||||
const tilesetJsonData = tilesetJsonFile
|
||||
? await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilesetJsonFile
|
||||
)
|
||||
: null;
|
||||
|
||||
if (tileMap.kind === 'tiled') {
|
||||
const tilesetJsonData = tilesetJsonFile
|
||||
? await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilesetJsonFile
|
||||
)
|
||||
: null;
|
||||
|
||||
if (tilesetJsonData) {
|
||||
tileMapJsonData.tilesets = [tilesetJsonData];
|
||||
}
|
||||
if (tilesetJsonData) {
|
||||
tileMapJsonData.tilesets = [tilesetJsonData];
|
||||
}
|
||||
return tileMap;
|
||||
} catch (err) {
|
||||
console.error('Unable to load a Tilemap JSON data: ', err);
|
||||
}
|
||||
return null;
|
||||
return tileMapJsonData;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -67,9 +67,7 @@ namespace gdjs {
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
levelIndex: number,
|
||||
callback: (
|
||||
tileMapFileContent: TileMapHelper.EditableTileMap | null
|
||||
) => void
|
||||
callback: (tileMap: TileMapHelper.EditableTileMap | null) => void
|
||||
): void {
|
||||
this._manager.getOrLoadTileMap(
|
||||
this._loadTileMap.bind(this),
|
||||
@@ -115,9 +113,7 @@ namespace gdjs {
|
||||
private _loadTileMap(
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
callback: (
|
||||
tileMapFileContent: TileMapHelper.TileMapFileContent | null
|
||||
) => void
|
||||
callback: (tileMap: TileMapHelper.TileMap | null) => void
|
||||
): void {
|
||||
this._instanceContainer
|
||||
.getGame()
|
||||
@@ -131,17 +127,14 @@ namespace gdjs {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
const tileMapFileContent = TileMapHelper.TileMapManager.identify(
|
||||
const tileMap = TileMapHelper.TileMapManager.identify(
|
||||
tileMapJsonData
|
||||
);
|
||||
if (!tileMapFileContent) {
|
||||
if (!tileMap) {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
tileMapFileContent.kind === 'tiled' &&
|
||||
tileSetJsonResourceName
|
||||
) {
|
||||
if (tileMap.kind === 'tiled' && tileSetJsonResourceName) {
|
||||
this._instanceContainer
|
||||
.getGame()
|
||||
.getJsonManager()
|
||||
@@ -154,14 +147,14 @@ namespace gdjs {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
const tiledMap = tileMapFileContent.data;
|
||||
const tiledMap = tileMap.data;
|
||||
const tileSet = tileSetJsonData as TileMapHelper.TiledTileset;
|
||||
tileSet.firstgid = tiledMap.tilesets[0].firstgid;
|
||||
tiledMap.tilesets = [tileSet];
|
||||
callback(tileMapFileContent);
|
||||
callback(tileMap);
|
||||
});
|
||||
} else {
|
||||
callback(tileMapFileContent);
|
||||
callback(tileMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
4
Extensions/TileMap/helper/TileMapHelper.d.ts
vendored
4
Extensions/TileMap/helper/TileMapHelper.d.ts
vendored
@@ -3,7 +3,7 @@ import {
|
||||
EditableTileMapLayer,
|
||||
PixiTileMapHelper,
|
||||
TileDefinition,
|
||||
TileMapFileContent,
|
||||
TileMap,
|
||||
TileMapManager,
|
||||
TileTextureCache,
|
||||
TiledTileset,
|
||||
@@ -16,7 +16,7 @@ declare global {
|
||||
EditableTileMapLayer,
|
||||
PixiTileMapHelper,
|
||||
TileDefinition,
|
||||
TileMapFileContent,
|
||||
TileMap,
|
||||
TileMapManager,
|
||||
TileTextureCache,
|
||||
TiledTileset,
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
Extensions/TileMap/helper/dts/index.d.ts
vendored
2
Extensions/TileMap/helper/dts/index.d.ts
vendored
@@ -10,7 +10,7 @@ export {
|
||||
export { TileMapManager } from './render/TileMapManager';
|
||||
export { TileTextureCache } from './render/TileTextureCache';
|
||||
export { PixiTileMapHelper } from './render/TileMapPixiHelper';
|
||||
export * from './load/TileMapFileContent';
|
||||
export * from './types/index';
|
||||
export * from './model/CommonTypes';
|
||||
export { TiledTileset } from './load/tiled/TiledFormat';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
@@ -1,12 +0,0 @@
|
||||
import { LDtkTileMap } from '../load/ldtk/LDtkFormat';
|
||||
import { TiledTileMap } from '../load/tiled/TiledFormat';
|
||||
export declare type TileMapFileContent =
|
||||
| {
|
||||
kind: 'tiled';
|
||||
data: TiledTileMap;
|
||||
}
|
||||
| {
|
||||
kind: 'ldtk';
|
||||
data: LDtkTileMap;
|
||||
};
|
||||
//# sourceMappingURL=TileMapFileContent.d.ts.map
|
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"TileMapFileContent.d.ts","sourceRoot":"","sources":["../../src/load/TileMapFileContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,oBAAY,kBAAkB,GAC1B;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
@@ -1,16 +1,16 @@
|
||||
import type { EditableTileMap } from '../model/TileMapModel';
|
||||
import { TileMapFileContent } from './TileMapFileContent';
|
||||
import { TileMap } from '../types';
|
||||
export declare namespace TileMapLoader {
|
||||
/**
|
||||
* Create a {@link EditableTileMap} from the raw data.
|
||||
*
|
||||
* @param tileMapFileContent The data exported from Tiled/LDtk.
|
||||
* @param tiledMap The data exported from Tiled/LDtk.
|
||||
* @param levelIndex The level of the tile map to load from.
|
||||
* @param pako The zlib library.
|
||||
* @returns A {@link EditableTileMap}
|
||||
*/
|
||||
function load(
|
||||
tileMapFileContent: TileMapFileContent,
|
||||
tileMap: TileMap,
|
||||
levelIndex: number,
|
||||
pako: any
|
||||
): EditableTileMap | null;
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TileMapLoader.d.ts","sourceRoot":"","sources":["../../src/load/TileMapLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,yBAAiB,aAAa,CAAC;IAC7B;;;;;;;OAOG;IACH,SAAgB,IAAI,CAClB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,GACR,eAAe,GAAG,IAAI,CAaxB;CACF"}
|
||||
{"version":3,"file":"TileMapLoader.d.ts","sourceRoot":"","sources":["../../src/load/TileMapLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,yBAAiB,aAAa,CAAC;IAC7B;;;;;;;OAOG;IACH,SAAgB,IAAI,CAClB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,GACR,eAAe,GAAG,IAAI,CAaxB;CACF"}
|
@@ -2,7 +2,7 @@ import { integer } from '../../model/CommonTypes';
|
||||
/**
|
||||
* version 1.1.3 - https://github.com/deepnight/ldtk/blob/66fff7199932357f3ab9b044c2fc2a856f527831/docs/JSON_SCHEMA.json
|
||||
*/
|
||||
export declare type LDtkTileMap = {
|
||||
export type LDtkTileMap = {
|
||||
/** LDtk application build identifier.<br/> This is only used to identify the LDtk version that generated this particular project file, which can be useful for specific bug fixing. Note that the build identifier is just the date of the release, so it's not unique to each user (one single global ID per LDtk public release), and as a result, completely anonymous. */
|
||||
appBuildId: number;
|
||||
/** Number of backup files to keep, if the `backupOnSave` is TRUE */
|
||||
@@ -72,7 +72,7 @@ export declare type LDtkTileMap = {
|
||||
| null;
|
||||
};
|
||||
/** Auto-layer rule group */
|
||||
declare type LDtkAutoLayerRuleGroup = {
|
||||
type LDtkAutoLayerRuleGroup = {
|
||||
/** */
|
||||
active: boolean;
|
||||
/** *This field was removed in 1.0.0 and should no longer be used.* */
|
||||
@@ -87,9 +87,9 @@ declare type LDtkAutoLayerRuleGroup = {
|
||||
uid: integer;
|
||||
};
|
||||
/** This complex section isn't meant to be used by game devs at all, as these rules are completely resolved internally by the editor before any saving. You should just ignore this part. */
|
||||
declare type LDtkAutoRuleDef = {};
|
||||
type LDtkAutoRuleDef = {};
|
||||
/** If you're writing your own LDtk importer, you should probably just ignore *most* stuff in the `defs` section, as it contains data that are mostly important to the editor. To keep you away from the `defs` section and avoid some unnecessary JSON parsing, important data from definitions is often duplicated in fields prefixed with a double underscore (eg. `__identifier` or `__type`). The 2 only definition types you might need here are **Tilesets** and **Enums**. */
|
||||
declare type LDtkDefinition = {
|
||||
type LDtkDefinition = {
|
||||
/** All entities definitions, including their custom fields */
|
||||
entities: LDtkEntityDef[];
|
||||
/** All internal enums */
|
||||
@@ -104,7 +104,7 @@ declare type LDtkDefinition = {
|
||||
tilesets: LDtkTilesetDef[];
|
||||
};
|
||||
/** Entity definition */
|
||||
declare type LDtkEntityDef = {
|
||||
type LDtkEntityDef = {
|
||||
/** Base entity color */
|
||||
color: string;
|
||||
/** Array of field definitions */
|
||||
@@ -166,7 +166,7 @@ declare type LDtkEntityDef = {
|
||||
width: integer;
|
||||
};
|
||||
/** Entity instance */
|
||||
declare type LDtkEntityInstance = {
|
||||
type LDtkEntityInstance = {
|
||||
/** Grid-based coordinates (`[x,y]` format) */
|
||||
__grid: integer[];
|
||||
/** Entity definition identifier */
|
||||
@@ -193,7 +193,7 @@ declare type LDtkEntityInstance = {
|
||||
width: integer;
|
||||
};
|
||||
/** Enum definition */
|
||||
declare type LDtkEnumDef = {
|
||||
type LDtkEnumDef = {
|
||||
/** */
|
||||
externalFileChecksum: string | null;
|
||||
/** Relative path to the external file providing this Enum */
|
||||
@@ -210,7 +210,7 @@ declare type LDtkEnumDef = {
|
||||
values: LDtkEnumDefValues[];
|
||||
};
|
||||
/** Enum value definition */
|
||||
declare type LDtkEnumDefValues = {
|
||||
type LDtkEnumDefValues = {
|
||||
/** An array of 4 Int values that refers to the tile in the tileset image: `[ x, y, width, height ]` */
|
||||
__tileSrcRect: integer[] | null;
|
||||
/** Optional color */
|
||||
@@ -221,14 +221,14 @@ declare type LDtkEnumDefValues = {
|
||||
tileId: integer | null;
|
||||
};
|
||||
/** In a tileset definition, enum based tag infos */
|
||||
declare type LDtkEnumTagValue = {
|
||||
type LDtkEnumTagValue = {
|
||||
/** */
|
||||
enumValueId: string;
|
||||
/** */
|
||||
tileIds: integer[];
|
||||
};
|
||||
/** This section is mostly only intended for the LDtk editor app itself. You can safely ignore it. */
|
||||
declare type LDtkFieldDef = {
|
||||
type LDtkFieldDef = {
|
||||
/** Human readable value type. Possible values: `Int, Float, String, Bool, Color, ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.<br/> If the field is an array, this field will look like `Array<...>` (eg. `Array<Int>`, `Array<Point>` etc.)<br/> NOTE: if you enable the advanced option **Use Multilines type**, you will have \"*Multilines*\" instead of \"*String*\" when relevant. */
|
||||
__type: string;
|
||||
/** Optional list of accepted file extensions for FilePath value type. Includes the dot: `.ext` */
|
||||
@@ -310,7 +310,7 @@ declare type LDtkFieldDef = {
|
||||
useForSmartColor: boolean;
|
||||
};
|
||||
/** Field instance */
|
||||
declare type LDtkFieldInstance = {
|
||||
type LDtkFieldInstance = {
|
||||
/** Field definition identifier */
|
||||
__identifier: string;
|
||||
/** Optional TilesetRect used to display this field (this can be the field own Tile, or some other Tile guessed from the value, like an Enum). */
|
||||
@@ -324,7 +324,7 @@ declare type LDtkFieldInstance = {
|
||||
/** Editor internal raw values */
|
||||
realEditorValues: any[];
|
||||
};
|
||||
declare type LDtkFlag =
|
||||
type LDtkFlag =
|
||||
| 'DiscardPreCsvIntGrid'
|
||||
| 'ExportPreCsvIntGridFormat'
|
||||
| 'IgnoreBackupSuggest'
|
||||
@@ -332,7 +332,7 @@ declare type LDtkFlag =
|
||||
| 'MultiWorlds'
|
||||
| 'UseMultilinesType';
|
||||
/** IntGrid value definition */
|
||||
declare type LDtkIntGridValueDef = {
|
||||
type LDtkIntGridValueDef = {
|
||||
/** */
|
||||
color: string;
|
||||
/** User defined unique identifier */
|
||||
@@ -341,14 +341,14 @@ declare type LDtkIntGridValueDef = {
|
||||
value: integer;
|
||||
};
|
||||
/** IntGrid value instance */
|
||||
declare type LDtkIntGridValueInstance = {
|
||||
type LDtkIntGridValueInstance = {
|
||||
/** Coordinate ID in the layer grid */
|
||||
coordId: integer;
|
||||
/** IntGrid value */
|
||||
v: integer;
|
||||
};
|
||||
/** Layer definition */
|
||||
declare type LDtkLayerDef = {
|
||||
type LDtkLayerDef = {
|
||||
/** Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*) */
|
||||
__type: string;
|
||||
/** Contains all the auto-layer rule definitions. */
|
||||
@@ -401,7 +401,7 @@ declare type LDtkLayerDef = {
|
||||
uid: integer;
|
||||
};
|
||||
/** Layer instance */
|
||||
declare type LDtkLayerInstance = {
|
||||
type LDtkLayerInstance = {
|
||||
/** Grid-based height */
|
||||
__cHei: integer;
|
||||
/** Grid-based width */
|
||||
@@ -452,7 +452,7 @@ declare type LDtkLayerInstance = {
|
||||
visible: boolean;
|
||||
};
|
||||
/** This section contains all the level data. It can be found in 2 distinct forms, depending on Project current settings: - If \"*Separate level files*\" is **disabled** (default): full level data is *embedded* inside the main Project JSON file, - If \"*Separate level files*\" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one per level). In this case, the main Project JSON file will still contain most level data, except heavy sections, like the `layerInstances` array (which will be null). The `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file containing exactly what is described below. */
|
||||
declare type LDtkLevel = {
|
||||
type LDtkLevel = {
|
||||
/** Background color of the level (same as `bgColor`, except the default value is automatically used here if its value is `null`) */
|
||||
__bgColor: string;
|
||||
/** Position informations of the background image, if there is one. */
|
||||
@@ -497,7 +497,7 @@ declare type LDtkLevel = {
|
||||
worldY: integer;
|
||||
};
|
||||
/** Level background image position info */
|
||||
declare type LDtkLevelBgPosInfos = {
|
||||
type LDtkLevelBgPosInfos = {
|
||||
/** An array of 4 float values describing the cropped sub-rectangle of the displayed background image. This cropping happens when original is larger than the level bounds. Array format: `[ cropX, cropY, cropWidth, cropHeight ]` */
|
||||
cropRect: number[];
|
||||
/** An array containing the `[scaleX,scaleY]` values of the **cropped** background image, depending on `bgPos` option. */
|
||||
@@ -506,7 +506,7 @@ declare type LDtkLevelBgPosInfos = {
|
||||
topLeftPx: integer[];
|
||||
};
|
||||
/** Nearby level info */
|
||||
declare type LDtkNeighbourLevel = {
|
||||
type LDtkNeighbourLevel = {
|
||||
/** A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, `e`ast). */
|
||||
dir: string;
|
||||
/** Neighbour Instance Identifier */
|
||||
@@ -515,7 +515,7 @@ declare type LDtkNeighbourLevel = {
|
||||
levelUid: integer;
|
||||
};
|
||||
/** This structure represents a single tile from a given Tileset. */
|
||||
declare type LDtkTile = {
|
||||
type LDtkTile = {
|
||||
/** Internal data used by the editor.<br/> For auto-layer tiles: `[ruleId, coordId]`.<br/> For tile-layer tiles: `[coordId]`. */
|
||||
d: integer[];
|
||||
/** \"Flip bits\", a 2-bits integer to represent the mirror transformations of the tile.<br/> - Bit 0 = X flip<br/> - Bit 1 = Y flip<br/> Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips) */
|
||||
@@ -528,7 +528,7 @@ declare type LDtkTile = {
|
||||
t: integer;
|
||||
};
|
||||
/** The `Tileset` definition is the most important part among project definitions. It contains some extra informations about each integrated tileset. If you only had to parse one definition section, that would be the one. */
|
||||
export declare type LDtkTilesetDef = {
|
||||
export type LDtkTilesetDef = {
|
||||
/** Grid-based height */
|
||||
__cHei: integer;
|
||||
/** Grid-based width */
|
||||
@@ -565,14 +565,14 @@ export declare type LDtkTilesetDef = {
|
||||
uid: integer;
|
||||
};
|
||||
/** In a tileset definition, user defined meta-data of a tile. */
|
||||
declare type LDtkTileCustomMetadata = {
|
||||
type LDtkTileCustomMetadata = {
|
||||
/** */
|
||||
data: string;
|
||||
/** */
|
||||
tileId: integer;
|
||||
};
|
||||
/** This object represents a custom sub rectangle in a Tileset image. */
|
||||
declare type LDtkTilesetRect = {
|
||||
type LDtkTilesetRect = {
|
||||
/** Height in pixels */
|
||||
h: integer;
|
||||
/** UID of the tileset */
|
||||
@@ -584,6 +584,6 @@ declare type LDtkTilesetRect = {
|
||||
/** Y pixels coordinate of the top-left corner in the Tileset image */
|
||||
y: integer;
|
||||
};
|
||||
declare type LDtkWorld = {};
|
||||
type LDtkWorld = {};
|
||||
export {};
|
||||
//# sourceMappingURL=LDtkFormat.d.ts.map
|
||||
|
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@ import { float, integer } from '../../model/CommonTypes';
|
||||
/**
|
||||
* Tiled JSON format (https://github.com/mapeditor/tiled/blob/master/docs/reference/json-map-format.rst).
|
||||
*/
|
||||
export declare type TiledTileMap = {
|
||||
export type TiledTileMap = {
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) (optional) */
|
||||
backgroundcolor?: string;
|
||||
/** The compression level to use for tile layer data (defaults to -1, which means to use the algorithm default) */
|
||||
@@ -44,7 +44,7 @@ export declare type TiledTileMap = {
|
||||
/** Number of tile columns */
|
||||
width: integer;
|
||||
};
|
||||
export declare type TiledLayer = {
|
||||
export type TiledLayer = {
|
||||
/** Array of {@link TiledChunk} (optional). `tilelayer` only. */
|
||||
chunks?: Array<TiledChunk>;
|
||||
/** `zlib`, `gzip`, `zstd` (since Tiled 1.3) or empty (default). `tilelayer` only. */
|
||||
@@ -98,7 +98,7 @@ export declare type TiledLayer = {
|
||||
/** Vertical layer offset in tiles. Always 0. */
|
||||
y: integer;
|
||||
};
|
||||
export declare type TiledChunk = {
|
||||
export type TiledChunk = {
|
||||
/** Array of `unsigned` `integer` (GIDs) or base64-encoded data */
|
||||
data: Array<integer> | string;
|
||||
/** Height in tiles */
|
||||
@@ -110,7 +110,7 @@ export declare type TiledChunk = {
|
||||
/** Y coordinate in tiles */
|
||||
y: integer;
|
||||
};
|
||||
export declare type TiledObject = {
|
||||
export type TiledObject = {
|
||||
/** The class of the object (renamed from type since 1.9, optional) */
|
||||
class?: string;
|
||||
/** Used to mark an object as an ellipse */
|
||||
@@ -146,7 +146,7 @@ export declare type TiledObject = {
|
||||
/** Y coordinate in pixels */
|
||||
y: float;
|
||||
};
|
||||
export declare type TiledText = {
|
||||
export type TiledText = {
|
||||
/** Whether to use a bold font (default: `false`) */
|
||||
bold: boolean;
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) (default: `#000000`) */
|
||||
@@ -172,7 +172,7 @@ export declare type TiledText = {
|
||||
/** Whether the text is wrapped within the object bounds (default: `false`) */
|
||||
wrap: boolean;
|
||||
};
|
||||
export declare type TiledTileset = {
|
||||
export type TiledTileset = {
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) (optional) */
|
||||
backgroundcolor?: string;
|
||||
/** The number of tile columns in the tileset */
|
||||
@@ -224,7 +224,7 @@ export declare type TiledTileset = {
|
||||
/** Array of {@link TiledWangSet} (since 1.1.5) */
|
||||
wangsets?: Array<TiledWangSet>;
|
||||
};
|
||||
export declare type TiledGrid = {
|
||||
export type TiledGrid = {
|
||||
/** Cell height of tile grid */
|
||||
height: integer;
|
||||
/** `orthogonal` (default) or `isometric` */
|
||||
@@ -232,13 +232,13 @@ export declare type TiledGrid = {
|
||||
/** Cell width of tile grid */
|
||||
width: integer;
|
||||
};
|
||||
export declare type TileOffset = {
|
||||
export type TileOffset = {
|
||||
/** Horizontal offset in pixels */
|
||||
x: integer;
|
||||
/** Vertical offset in pixels (positive is down) */
|
||||
y: integer;
|
||||
};
|
||||
export declare type TiledTransformations = {
|
||||
export type TiledTransformations = {
|
||||
/** Tiles can be flipped horizontally */
|
||||
hflip: boolean;
|
||||
/** Tiles can be flipped vertically */
|
||||
@@ -248,7 +248,7 @@ export declare type TiledTransformations = {
|
||||
/** Whether untransformed tiles remain preferred, otherwise transformed tiles are used to produce more variations */
|
||||
preferuntransformed: boolean;
|
||||
};
|
||||
export declare type TiledTileDefinition = {
|
||||
export type TiledTileDefinition = {
|
||||
/** Array of {@link TiledTiles} */
|
||||
animation?: Array<TiledTileDefinition>;
|
||||
/** The class of the tile (renamed from type since 1.9, optional) */
|
||||
@@ -270,13 +270,13 @@ export declare type TiledTileDefinition = {
|
||||
/** Index of terrain for each corner of tile (optional) */
|
||||
terrain?: Array<integer>;
|
||||
};
|
||||
export declare type TiledFrame = {
|
||||
export type TiledFrame = {
|
||||
/** Frame duration in milliseconds */
|
||||
duration: integer;
|
||||
/** Local tile ID representing this frame */
|
||||
tileid: integer;
|
||||
};
|
||||
export declare type TiledTerrain = {
|
||||
export type TiledTerrain = {
|
||||
/** Name of terrain */
|
||||
name: string;
|
||||
/** Array of {@link TiledProperty} */
|
||||
@@ -284,7 +284,7 @@ export declare type TiledTerrain = {
|
||||
/** Local ID of tile representing terrain */
|
||||
tile: integer;
|
||||
};
|
||||
export declare type TiledWangSet = {
|
||||
export type TiledWangSet = {
|
||||
/** Array of {@link TiledWangColor} */
|
||||
colors: Array<TiledWangColor>;
|
||||
/** Name of the Wang set */
|
||||
@@ -296,7 +296,7 @@ export declare type TiledWangSet = {
|
||||
/** Array of {@link TiledWangTile} */
|
||||
wangtiles: Array<TiledWangTile>;
|
||||
};
|
||||
export declare type TiledWangColor = {
|
||||
export type TiledWangColor = {
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) */
|
||||
color: string;
|
||||
/** Name of the Wang color */
|
||||
@@ -308,13 +308,13 @@ export declare type TiledWangColor = {
|
||||
/** Local ID of tile representing the Wang color */
|
||||
tile: integer;
|
||||
};
|
||||
export declare type TiledWangTile = {
|
||||
export type TiledWangTile = {
|
||||
/** Local ID of tile */
|
||||
tileid: integer;
|
||||
/** Array of Wang color indexes (`uchar[8]`) */
|
||||
wangid: Array<integer>;
|
||||
};
|
||||
export declare type TiledObjectTemplate = {
|
||||
export type TiledObjectTemplate = {
|
||||
/** `template` */
|
||||
type: string;
|
||||
/** External tileset used by the template (optional) */
|
||||
@@ -322,7 +322,7 @@ export declare type TiledObjectTemplate = {
|
||||
/** The object instantiated by this template */
|
||||
object: Object;
|
||||
};
|
||||
export declare type TiledProperty = {
|
||||
export type TiledProperty = {
|
||||
/** Name of the property */
|
||||
name: string;
|
||||
/** type of the property (`string` (default), `integer`, `float`, `boolean`, `color` or `file` (since 0.16, with `color` and `file` added in 0.17)) */
|
||||
@@ -330,7 +330,7 @@ export declare type TiledProperty = {
|
||||
/** Value of the property */
|
||||
value: string | number;
|
||||
};
|
||||
export declare type TiledPoint = {
|
||||
export type TiledPoint = {
|
||||
/** X coordinate in pixels */
|
||||
x: float;
|
||||
/** Y coordinate in pixels */
|
||||
|
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@ export declare const decodeBase64LayerData: (
|
||||
pako: any,
|
||||
tiledLayer: TiledLayer
|
||||
) => number[];
|
||||
export declare type TiledGID = {
|
||||
export type TiledGID = {
|
||||
id: integer;
|
||||
flippedHorizontally: boolean;
|
||||
flippedVertically: boolean;
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TiledTileMapLoaderHelper.d.ts","sourceRoot":"","sources":["../../../src/load/tiled/TiledTileMapLoaderHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,SAAU,GAAG,cAAc,UAAU,aAgDtE,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,kBACvB,OAAO,KACrB,QAmBF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
|
||||
{"version":3,"file":"TiledTileMapLoaderHelper.d.ts","sourceRoot":"","sources":["../../../src/load/tiled/TiledTileMapLoaderHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,SAAU,GAAG,cAAc,UAAU,aAgDtE,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,kBACvB,OAAO,KACrB,QAmBF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
|
@@ -1,5 +1,5 @@
|
||||
export declare type integer = number;
|
||||
export declare type float = number;
|
||||
export declare type FloatPoint = [float, float];
|
||||
export declare type PolygonVertices = FloatPoint[];
|
||||
export type FloatPoint = [float, float];
|
||||
export type PolygonVertices = FloatPoint[];
|
||||
//# sourceMappingURL=CommonTypes.d.ts.map
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"CommonTypes.d.ts","sourceRoot":"","sources":["../../src/model/CommonTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,MAAM,OAAO,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,OAAO,MAAM,KAAK,GAAG,MAAM,CAAC;AACnC,oBAAY,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAExC,oBAAY,eAAe,GAAG,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"CommonTypes.d.ts","sourceRoot":"","sources":["../../src/model/CommonTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,MAAM,OAAO,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,OAAO,MAAM,KAAK,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG,UAAU,EAAE,CAAC"}
|
@@ -1,7 +1,7 @@
|
||||
import { EditableTileMap } from '../model/TileMapModel';
|
||||
import { TileTextureCache } from './TileTextureCache';
|
||||
import PIXI = GlobalPIXIModule.PIXI;
|
||||
import { TileMapFileContent } from '../load/TileMapFileContent';
|
||||
import { TileMap } from '../types';
|
||||
/**
|
||||
* A holder to share tile maps across the 2 extension objects.
|
||||
*
|
||||
@@ -23,7 +23,7 @@ export declare class TileMapManager {
|
||||
* @param data JSON data.
|
||||
* @returns The data enclosed with its detected kind.
|
||||
*/
|
||||
static identify(data: any): TileMapFileContent | null;
|
||||
static identify(data: any): TileMap | null;
|
||||
/**
|
||||
* @param loadTileMap The method that loads the Tiled JSON file in memory.
|
||||
* @param tileMapJsonResourceName The resource name of the tile map.
|
||||
@@ -36,7 +36,7 @@ export declare class TileMapManager {
|
||||
loadTileMap: (
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
||||
callback: (tileMap: TileMap | null) => void
|
||||
) => void,
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
@@ -57,7 +57,7 @@ export declare class TileMapManager {
|
||||
loadTileMap: (
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
||||
callback: (tileMap: TileMap | null) => void
|
||||
) => void,
|
||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>,
|
||||
atlasImageResourceName: string,
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TileMapManager.d.ts","sourceRoot":"","sources":["../../src/render/TileMapManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,mBAAmB,CAAkC;;IAO7D;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;IAWzD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,kBAAkB,GAAG,IAAI;IAwBrD;;;;;;;OAOG;IACH,gBAAgB,CACd,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,GAClD,IAAI;IAiCP;;;;;;;;OAQG;IACH,qBAAqB,CACnB,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpE,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,GACxD,IAAI;CAuCR"}
|
||||
{"version":3,"file":"TileMapManager.d.ts","sourceRoot":"","sources":["../../src/render/TileMapManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,mBAAmB,CAAkC;;IAO7D;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;IAWzD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,GAAG,IAAI;IAyB1C;;;;;;;OAOG;IACH,gBAAgB,CACd,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,KACxC,IAAI,EACT,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,GAClD,IAAI;IAiCP;;;;;;;;OAQG;IACH,qBAAqB,CACnB,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,KACxC,IAAI,EACT,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpE,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,GACxD,IAAI;CAuCR"}
|
@@ -1,6 +1,6 @@
|
||||
import { integer, float } from '../model/CommonTypes';
|
||||
import { EditableTileMap } from '../model/TileMapModel';
|
||||
import { TileMapFileContent } from '../load/TileMapFileContent';
|
||||
import { TileMap } from '../types';
|
||||
import { TileTextureCache } from './TileTextureCache';
|
||||
import PIXI = GlobalPIXIModule.PIXI;
|
||||
export declare namespace PixiTileMapHelper {
|
||||
@@ -14,7 +14,7 @@ export declare namespace PixiTileMapHelper {
|
||||
* @returns A textures cache.
|
||||
*/
|
||||
function parseAtlas(
|
||||
tileMap: TileMapFileContent,
|
||||
tileMap: TileMap,
|
||||
levelIndex: number,
|
||||
atlasTexture: PIXI.BaseTexture<PIXI.Resource> | null,
|
||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TileMapPixiHelper.d.ts","sourceRoot":"","sources":["../../src/render/TileMapPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,EACpD,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,iBAAiB,CAC/B,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,EACxC,UAAU,EAAE,MAAM,GACjB,IAAI,CA0GN;IAED;;OAEG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAC3B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,KAAK,EACrB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,KAAK,GACjB,IAAI,CAgEN;CACF"}
|
||||
{"version":3,"file":"TileMapPixiHelper.d.ts","sourceRoot":"","sources":["../../src/render/TileMapPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,EACpD,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,iBAAiB,CAC/B,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,EACxC,UAAU,EAAE,MAAM,GACjB,IAAI,CA0GN;IAED;;OAEG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAC3B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,KAAK,EACrB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,KAAK,GACjB,IAAI,CAgEN;CACF"}
|
@@ -1,10 +1,8 @@
|
||||
import { TileTextureCache } from '../TileTextureCache';
|
||||
import { LDtkTileMap } from '../../load/ldtk/LDtkFormat';
|
||||
import PIXI = GlobalPIXIModule.PIXI;
|
||||
declare type Texture = PIXI.BaseTexture<PIXI.Resource>;
|
||||
declare type TextureLoader = (
|
||||
textureName: string
|
||||
) => PIXI.BaseTexture<PIXI.Resource>;
|
||||
type Texture = PIXI.BaseTexture<PIXI.Resource>;
|
||||
type TextureLoader = (textureName: string) => PIXI.BaseTexture<PIXI.Resource>;
|
||||
export declare namespace LDtkPixiHelper {
|
||||
/**
|
||||
* Split an atlas image into Pixi textures.
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"LDtkPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/ldtk/LDtkPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAkB,MAAM,4BAA4B,CAAC;AAEzE,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,aAAK,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,aAAK,aAAa,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAmC9E,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,GAAG,IAAI,EAC5B,UAAU,EAAE,aAAa,GACxB,gBAAgB,GAAG,IAAI,CAoFzB;CACF"}
|
||||
{"version":3,"file":"LDtkPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/ldtk/LDtkPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAkB,MAAM,4BAA4B,CAAC;AAEzE,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,KAAK,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,KAAK,aAAa,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAmC9E,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,GAAG,IAAI,EAC5B,UAAU,EAAE,aAAa,GACxB,gBAAgB,GAAG,IAAI,CAoFzB;CACF"}
|
@@ -1,6 +1,6 @@
|
||||
import { LDtkTileMap } from '../load/ldtk/LDtkFormat';
|
||||
import { TiledTileMap } from '../load/tiled/TiledFormat';
|
||||
export declare type TileMap =
|
||||
export type TileMap =
|
||||
| {
|
||||
kind: 'tiled';
|
||||
data: TiledTileMap;
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,oBAAY,OAAO,GACf;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,MAAM,OAAO,GACf;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
@@ -1,7 +1,10 @@
|
||||
// @ts-check
|
||||
describe('gdjs.TileMapCollisionMaskRuntimeObject', function () {
|
||||
const createScene = (framePerSecond = 60) => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame({
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: {
|
||||
resources: [
|
||||
{
|
||||
|
@@ -4,7 +4,12 @@ describe('gdjs.TopDownMovementRuntimeBehavior', function () {
|
||||
const topDownName = 'auto1';
|
||||
|
||||
const createScene = (timeDelta = 1000 / 60) => {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -124,11 +124,7 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionCode(
|
||||
gd::ObjectsContainer globalObjectsAndGroups;
|
||||
gd::ObjectsContainer objectsAndGroups;
|
||||
gd::EventsFunctionTools::FreeEventsFunctionToObjectsContainer(
|
||||
project,
|
||||
functionsContainer,
|
||||
eventsFunction,
|
||||
globalObjectsAndGroups,
|
||||
objectsAndGroups);
|
||||
project, functionsContainer, eventsFunction, globalObjectsAndGroups, objectsAndGroups);
|
||||
|
||||
EventsCodeGenerator codeGenerator(globalObjectsAndGroups, objectsAndGroups);
|
||||
codeGenerator.SetCodeNamespace(codeNamespace);
|
||||
@@ -140,9 +136,7 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionCode(
|
||||
codeGenerator.GenerateEventsFunctionParameterDeclarationsList(
|
||||
eventsFunction.GetParametersForEvents(functionsContainer), 0, true),
|
||||
codeGenerator.GenerateFreeEventsFunctionContext(
|
||||
eventsFunction.GetParametersForEvents(functionsContainer),
|
||||
"runtimeScene.getOnceTriggers()",
|
||||
eventsFunction.IsAsync()),
|
||||
eventsFunction.GetParametersForEvents(functionsContainer), "runtimeScene.getOnceTriggers()"),
|
||||
eventsFunction.GetEvents(),
|
||||
"",
|
||||
codeGenerator.GenerateEventsFunctionReturn(eventsFunction));
|
||||
@@ -195,7 +189,6 @@ gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionCode(
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedBehavior.GetEventsFunctions()),
|
||||
onceTriggersVariable,
|
||||
eventsFunction.IsAsync(),
|
||||
// Pass the names of the parameters considered as the current
|
||||
// object and behavior parameters:
|
||||
"Object",
|
||||
@@ -206,9 +199,7 @@ gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionCode(
|
||||
fullyQualifiedFunctionName,
|
||||
codeGenerator.GenerateEventsFunctionParameterDeclarationsList(
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedBehavior.GetEventsFunctions()),
|
||||
2,
|
||||
false),
|
||||
eventsBasedBehavior.GetEventsFunctions()), 2, false),
|
||||
fullPreludeCode,
|
||||
eventsFunction.GetEvents(),
|
||||
"",
|
||||
@@ -255,38 +246,35 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionCode(
|
||||
// hashmap).
|
||||
"var thisObjectList = [this];\n" +
|
||||
"var Object = Hashtable.newFrom({Object: thisObjectList});\n";
|
||||
|
||||
// Add child-objects
|
||||
for (auto &childObject : eventsBasedObject.GetObjects()) {
|
||||
// child-object are never picked because they are not parameters.
|
||||
const auto &childName = ManObjListName(childObject->GetName());
|
||||
fullPreludeCode +=
|
||||
"var this" + childName + "List = [...runtimeScene.getObjects(" +
|
||||
ConvertToStringExplicit(childObject->GetName()) + ")];\n" +
|
||||
"var " + childName + " = Hashtable.newFrom({" +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": this" + childName + "List});\n";
|
||||
}
|
||||
|
||||
// Add child-objects
|
||||
for (auto& childObject : eventsBasedObject.GetObjects()) {
|
||||
// child-object are never picked because they are not parameters.
|
||||
const auto& childName = ManObjListName(childObject->GetName());
|
||||
fullPreludeCode += "var this" + childName +
|
||||
"List = [...runtimeScene.getObjects(" +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
")];\n" + "var " + childName + " = Hashtable.newFrom({" +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": this" + childName + "List});\n";
|
||||
}
|
||||
|
||||
fullPreludeCode += codeGenerator.GenerateObjectEventsFunctionContext(
|
||||
eventsBasedObject,
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedObject.GetEventsFunctions()),
|
||||
onceTriggersVariable,
|
||||
eventsFunction.IsAsync(),
|
||||
// Pass the names of the parameters considered as the current
|
||||
// object and behavior parameters:
|
||||
"Object");
|
||||
fullPreludeCode += codeGenerator.GenerateObjectEventsFunctionContext(
|
||||
eventsBasedObject,
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedObject.GetEventsFunctions()),
|
||||
onceTriggersVariable,
|
||||
// Pass the names of the parameters considered as the current
|
||||
// object and behavior parameters:
|
||||
"Object");
|
||||
|
||||
gd::String output = GenerateEventsListCompleteFunctionCode(
|
||||
codeGenerator,
|
||||
fullyQualifiedFunctionName,
|
||||
codeGenerator.GenerateEventsFunctionParameterDeclarationsList(
|
||||
// TODO EBO use constants for firstParameterIndex
|
||||
// TODO EBO use constants for firstParameterIndex
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedObject.GetEventsFunctions()),
|
||||
1,
|
||||
false),
|
||||
eventsBasedObject.GetEventsFunctions()), 1, false),
|
||||
fullPreludeCode,
|
||||
eventsFunction.GetEvents(),
|
||||
endingCode,
|
||||
@@ -322,8 +310,7 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionParameterDeclarationsList(
|
||||
|
||||
gd::String EventsCodeGenerator::GenerateFreeEventsFunctionContext(
|
||||
const vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync) {
|
||||
const gd::String& onceTriggersVariable) {
|
||||
gd::String objectsGettersMap;
|
||||
gd::String objectArraysMap;
|
||||
gd::String behaviorNamesMap;
|
||||
@@ -331,15 +318,13 @@ gd::String EventsCodeGenerator::GenerateFreeEventsFunctionContext(
|
||||
onceTriggersVariable,
|
||||
objectsGettersMap,
|
||||
objectArraysMap,
|
||||
behaviorNamesMap,
|
||||
isAsync);
|
||||
behaviorNamesMap);
|
||||
}
|
||||
|
||||
gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionContext(
|
||||
const gd::EventsBasedBehavior& eventsBasedBehavior,
|
||||
const vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName,
|
||||
const gd::String& thisBehaviorName) {
|
||||
// See the comment at the start of the GenerateEventsFunctionContext function
|
||||
@@ -390,7 +375,6 @@ gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionContext(
|
||||
objectsGettersMap,
|
||||
objectArraysMap,
|
||||
behaviorNamesMap,
|
||||
isAsync,
|
||||
thisObjectName,
|
||||
thisBehaviorName);
|
||||
}
|
||||
@@ -399,7 +383,6 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionContext(
|
||||
const gd::EventsBasedObject& eventsBasedObject,
|
||||
const vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName) {
|
||||
// See the comment at the start of the GenerateEventsFunctionContext function
|
||||
|
||||
@@ -416,17 +399,13 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionContext(
|
||||
ConvertToStringExplicit(thisObjectName) + ": " + thisObjectName + "\n";
|
||||
objectArraysMap +=
|
||||
ConvertToStringExplicit(thisObjectName) + ": thisObjectList\n";
|
||||
|
||||
|
||||
// Add child-objects
|
||||
for (auto& childObject : eventsBasedObject.GetObjects()) {
|
||||
const auto& childName = ManObjListName(childObject->GetName());
|
||||
for (auto &childObject : eventsBasedObject.GetObjects()) {
|
||||
const auto &childName = ManObjListName(childObject->GetName());
|
||||
// child-object are never picked because they are not parameters.
|
||||
objectsGettersMap += ", " +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": " + childName + "\n";
|
||||
objectArraysMap += ", " +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": this" + childName + "List\n";
|
||||
objectsGettersMap += ", " + ConvertToStringExplicit(childObject->GetName()) + ": " + childName + "\n";
|
||||
objectArraysMap += ", " + ConvertToStringExplicit(childObject->GetName()) + ": this" + childName + "List\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,7 +414,6 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionContext(
|
||||
objectsGettersMap,
|
||||
objectArraysMap,
|
||||
behaviorNamesMap,
|
||||
isAsync,
|
||||
thisObjectName);
|
||||
}
|
||||
|
||||
@@ -445,7 +423,6 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
gd::String& objectsGettersMap,
|
||||
gd::String& objectArraysMap,
|
||||
gd::String& behaviorNamesMap,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName,
|
||||
const gd::String& thisBehaviorName) {
|
||||
// When running in the context of a function generated from events, we
|
||||
@@ -497,12 +474,7 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
}
|
||||
}
|
||||
|
||||
const gd::String async =
|
||||
isAsync ? " task: new gdjs.ManuallyResolvableTask(),\n" : "";
|
||||
|
||||
return gd::String("var eventsFunctionContext = {\n") +
|
||||
// The async task, if there is one
|
||||
async +
|
||||
// The object name to parameter map:
|
||||
" _objectsMap: {\n" + objectsGettersMap +
|
||||
"},\n"
|
||||
@@ -530,10 +502,8 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
// can be different between the parameter name vs the actual behavior
|
||||
// name passed as argument).
|
||||
" getBehaviorName: function(behaviorName) {\n" +
|
||||
// TODO EBO Handle behavior name collision between parameters and
|
||||
// children
|
||||
" return eventsFunctionContext._behaviorNamesMap[behaviorName] || "
|
||||
"behaviorName;\n"
|
||||
// TODO EBO Handle behavior name collision between parameters and children
|
||||
" return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName;\n"
|
||||
" },\n" +
|
||||
// Creator function that will be used to create new objects. We
|
||||
// need to check if the function was given the context of the calling
|
||||
@@ -567,13 +537,15 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
" getInstancesCountOnScene: function(objectName) {\n"
|
||||
" const objectsList = "
|
||||
"eventsFunctionContext._objectsMap[objectName];\n" +
|
||||
" let count = 0;\n" + " if (objectsList) {\n" +
|
||||
" let count = 0;\n" +
|
||||
" if (objectsList) {\n" +
|
||||
" for(const objectName in objectsList.items)\n" +
|
||||
" count += parentEventsFunctionContext ?\n" +
|
||||
"parentEventsFunctionContext.getInstancesCountOnScene(objectName) "
|
||||
":\n" +
|
||||
" runtimeScene.getInstancesCountOnScene(objectName);\n" +
|
||||
" }\n" + " return count;\n" +
|
||||
" }\n" +
|
||||
" return count;\n" +
|
||||
" },\n"
|
||||
// Allow to get a layer directly from the context for convenience:
|
||||
" getLayer: function(layerName) {\n"
|
||||
@@ -590,7 +562,6 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
|
||||
gd::String EventsCodeGenerator::GenerateEventsFunctionReturn(
|
||||
const gd::EventsFunction& eventsFunction) {
|
||||
if (eventsFunction.IsAsync()) return "return eventsFunctionContext.task";
|
||||
// We don't use IsCondition because ExpressionAndCondition event functions
|
||||
// don't need a boolean function. They use the expression function with a
|
||||
// relational operator.
|
||||
|
@@ -375,8 +375,7 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
*/
|
||||
gd::String GenerateFreeEventsFunctionContext(
|
||||
const std::vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync);
|
||||
const gd::String& onceTriggersVariable);
|
||||
|
||||
/**
|
||||
* \brief Generate the "eventsFunctionContext" object that allow a behavior
|
||||
@@ -387,7 +386,6 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
const gd::EventsBasedBehavior& eventsBasedBehavior,
|
||||
const std::vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName,
|
||||
const gd::String& thisBehaviorName);
|
||||
|
||||
@@ -400,7 +398,6 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
const gd::EventsBasedObject& eventsBasedObject,
|
||||
const std::vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName);
|
||||
|
||||
gd::String GenerateEventsFunctionReturn(
|
||||
@@ -432,7 +429,6 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
gd::String& objectsGettersMap,
|
||||
gd::String& objectArraysMap,
|
||||
gd::String& behaviorNamesMap,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName = "",
|
||||
const gd::String& thisBehaviorName = "");
|
||||
};
|
||||
|
@@ -68,9 +68,6 @@ AsyncExtension::AsyncExtension() {
|
||||
return "{\n" + parentAsyncObjectsListGetter + "{\n" +
|
||||
asyncObjectsListBuilder + asyncActionCode + "}\n" + "}\n";
|
||||
});
|
||||
|
||||
GetAllActions()["BuiltinAsync::ResolveAsyncEventsFunction"].SetFunctionName(
|
||||
"gdjs.evtTools.common.resolveAsyncEventsFunction");
|
||||
}
|
||||
|
||||
} // namespace gdjs
|
||||
|
@@ -164,7 +164,7 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
objectConditions["CollisionPoint"]
|
||||
.SetFunctionName("isCollidingWithPoint")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
objectConditions["ObjectTimer"] // deprecated
|
||||
objectConditions["ObjectTimer"] // deprecated
|
||||
.SetFunctionName("timerElapsedTime")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
objectConditions["CompareObjectTimer"]
|
||||
@@ -223,18 +223,6 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
objectExpressions["VariableChildCount"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getVariableChildCount")
|
||||
.SetStatic();
|
||||
objectExpressions["ArrayVariableFirstNumber"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getFirstVariableNumber")
|
||||
.SetStatic();
|
||||
objectStrExpressions["ArrayVariableFirstString"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getFirstVariableString")
|
||||
.SetStatic();
|
||||
objectExpressions["ArrayVariableLastNumber"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getLastVariableNumber")
|
||||
.SetStatic();
|
||||
objectStrExpressions["ArrayVariableLastString"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getLastVariableString")
|
||||
.SetStatic();
|
||||
objectExpressions["ForceX"].SetFunctionName("getAverageForce().getX");
|
||||
objectExpressions["ForceY"].SetFunctionName("getAverageForce().getY");
|
||||
objectExpressions["ForceAngle"].SetFunctionName("getAverageForce().getAngle");
|
||||
@@ -266,9 +254,9 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
"gdjs.evtTools.object.createObjectFromGroupOnScene");
|
||||
|
||||
GetAllExpressions()["Count"].SetFunctionName(
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
GetAllConditions()["NbObjet"].SetFunctionName(
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
|
||||
GetAllExpressions()["SceneInstancesCount"].SetFunctionName(
|
||||
"gdjs.evtTools.object.getSceneInstancesCount");
|
||||
@@ -347,9 +335,6 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
objectActions["ObjectVariableRemoveAt"]
|
||||
.SetFunctionName("variableRemoveAt")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
objectConditions["ObjectVariableChildCount"]
|
||||
.SetFunctionName("getVariableChildCount")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
|
||||
GetAllActions()["MoveObjects"].codeExtraInformation.SetCustomCodeGenerator(
|
||||
[](gd::Instruction &,
|
||||
|
@@ -34,46 +34,23 @@ VariablesExtension::VariablesExtension() {
|
||||
"gdjs.evtTools.variable.getVariableString");
|
||||
GetAllConditions()["GlobalVariableAsBoolean"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableBoolean");
|
||||
|
||||
GetAllExpressions()["VariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
GetAllExpressions()["GlobalVariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
|
||||
GetAllExpressions()["Variable"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableNumber");
|
||||
GetAllStrExpressions()["VariableString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableString");
|
||||
GetAllExpressions()["VariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
GetAllExpressions()["GlobalVariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
GetAllExpressions()["GlobalVariable"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableNumber");
|
||||
GetAllStrExpressions()["GlobalVariableString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableString");
|
||||
|
||||
GetAllStrExpressions()["GlobalVariableFirstString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableString");
|
||||
GetAllExpressions()["GlobalVariableFirstNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableNumber");
|
||||
GetAllStrExpressions()["GlobalVariableLastString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableString");
|
||||
GetAllExpressions()["GlobalVariableLastNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableNumber");
|
||||
GetAllStrExpressions()["SceneVariableFirstString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableString");
|
||||
GetAllExpressions()["SceneVariableFirstNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableNumber");
|
||||
GetAllStrExpressions()["SceneVariableLastString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableString");
|
||||
GetAllExpressions()["SceneVariableLastNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableNumber");
|
||||
|
||||
GetAllConditions()["VarSceneDef"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.sceneVariableExists");
|
||||
GetAllConditions()["VarGlobalDef"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.globalVariableExists");
|
||||
GetAllConditions()["SceneVariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
GetAllConditions()["GlobalVariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
|
||||
GetAllActions()["SetSceneVariableAsBoolean"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.setVariableBoolean");
|
||||
|
@@ -50,29 +50,25 @@ bool Exporter::ExportProjectForPixiPreview(
|
||||
return helper.ExportProjectForPixiPreview(options);
|
||||
}
|
||||
|
||||
bool Exporter::ExportWholePixiProject(const ExportOptions &options) {
|
||||
bool Exporter::ExportWholePixiProject(
|
||||
gd::Project &project,
|
||||
gd::String exportDir,
|
||||
std::map<gd::String, bool> &exportOptions) {
|
||||
ExporterHelper helper(fs, gdjsRoot, codeOutputDir);
|
||||
gd::Project exportedProject = options.project;
|
||||
gd::Project exportedProject = project;
|
||||
|
||||
auto usedExtensionsResult =
|
||||
gd::UsedExtensionsFinder::ScanProject(options.project);
|
||||
auto &usedExtensions = usedExtensionsResult.GetUsedExtensions();
|
||||
auto usedExtensionsResult = gd::UsedExtensionsFinder::ScanProject(project);
|
||||
auto& usedExtensions = usedExtensionsResult.GetUsedExtensions();
|
||||
|
||||
auto exportProject = [this,
|
||||
&exportedProject,
|
||||
&options,
|
||||
&helper,
|
||||
auto exportProject = [this, &exportedProject, &exportOptions, &helper,
|
||||
&usedExtensionsResult](gd::String exportDir) {
|
||||
// Use project properties fallback to set empty properties
|
||||
if (exportedProject.GetAuthorIds().empty() &&
|
||||
!options.fallbackAuthorId.empty()) {
|
||||
exportedProject.GetAuthorIds().push_back(options.fallbackAuthorId);
|
||||
}
|
||||
if (exportedProject.GetAuthorUsernames().empty() &&
|
||||
!options.fallbackAuthorUsername.empty()) {
|
||||
exportedProject.GetAuthorUsernames().push_back(
|
||||
options.fallbackAuthorUsername);
|
||||
}
|
||||
bool exportForCordova = exportOptions["exportForCordova"];
|
||||
bool exportForFacebookInstantGames =
|
||||
exportOptions["exportForFacebookInstantGames"];
|
||||
|
||||
// Always disable the splash for Facebook Instant Games
|
||||
if (exportForFacebookInstantGames)
|
||||
exportedProject.GetLoadingScreen().ShowGDevelopSplash(false);
|
||||
|
||||
// Prepare the export directory
|
||||
fs.MkDir(exportDir);
|
||||
@@ -147,9 +143,9 @@ bool Exporter::ExportWholePixiProject(const ExportOptions &options) {
|
||||
helper.ExportIncludesAndLibs(resourcesFiles, exportDir, false);
|
||||
|
||||
gd::String source = gdjsRoot + "/Runtime/index.html";
|
||||
if (options.target == "cordova")
|
||||
if (exportForCordova)
|
||||
source = gdjsRoot + "/Runtime/Cordova/www/index.html";
|
||||
else if (options.target == "facebookInstantGames")
|
||||
else if (exportForFacebookInstantGames)
|
||||
source = gdjsRoot + "/Runtime/FacebookInstantGames/index.html";
|
||||
|
||||
if (!helper.ExportPixiIndexFile(exportedProject,
|
||||
@@ -165,31 +161,28 @@ bool Exporter::ExportWholePixiProject(const ExportOptions &options) {
|
||||
return true;
|
||||
};
|
||||
|
||||
if (options.target == "cordova") {
|
||||
fs.MkDir(options.exportPath);
|
||||
fs.MkDir(options.exportPath + "/www");
|
||||
if (exportOptions["exportForCordova"]) {
|
||||
fs.MkDir(exportDir);
|
||||
fs.MkDir(exportDir + "/www");
|
||||
|
||||
if (!exportProject(options.exportPath + "/www")) return false;
|
||||
if (!exportProject(exportDir + "/www")) return false;
|
||||
|
||||
if (!helper.ExportCordovaFiles(
|
||||
exportedProject, options.exportPath, usedExtensions))
|
||||
if (!helper.ExportCordovaFiles(exportedProject, exportDir, usedExtensions))
|
||||
return false;
|
||||
} else if (options.target == "electron") {
|
||||
fs.MkDir(options.exportPath);
|
||||
} else if (exportOptions["exportForElectron"]) {
|
||||
fs.MkDir(exportDir);
|
||||
|
||||
if (!exportProject(options.exportPath + "/app")) return false;
|
||||
if (!exportProject(exportDir + "/app")) return false;
|
||||
|
||||
if (!helper.ExportElectronFiles(
|
||||
exportedProject, options.exportPath, usedExtensions))
|
||||
if (!helper.ExportElectronFiles(exportedProject, exportDir, usedExtensions))
|
||||
return false;
|
||||
} else if (options.target == "facebookInstantGames") {
|
||||
if (!exportProject(options.exportPath)) return false;
|
||||
} else if (exportOptions["exportForFacebookInstantGames"]) {
|
||||
if (!exportProject(exportDir)) return false;
|
||||
|
||||
if (!helper.ExportFacebookInstantGamesFiles(exportedProject,
|
||||
options.exportPath))
|
||||
if (!helper.ExportFacebookInstantGamesFiles(exportedProject, exportDir))
|
||||
return false;
|
||||
} else {
|
||||
if (!exportProject(options.exportPath)) return false;
|
||||
if (!exportProject(exportDir)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -17,10 +17,7 @@ class Layout;
|
||||
class ExternalLayout;
|
||||
class AbstractFileSystem;
|
||||
} // namespace gd
|
||||
namespace gdjs {
|
||||
struct PreviewExportOptions;
|
||||
struct ExportOptions;
|
||||
}
|
||||
namespace gdjs { struct PreviewExportOptions; }
|
||||
|
||||
namespace gdjs {
|
||||
|
||||
@@ -48,7 +45,9 @@ class Exporter {
|
||||
*
|
||||
* Called by ShowProjectExportDialog if the user clicked on Ok.
|
||||
*/
|
||||
bool ExportWholePixiProject(const ExportOptions& options);
|
||||
bool ExportWholePixiProject(gd::Project& project,
|
||||
gd::String exportDir,
|
||||
std::map<gd::String, bool>& exportOptions);
|
||||
|
||||
/**
|
||||
* \brief Return the error that occurred during the last export.
|
||||
|
@@ -23,17 +23,16 @@
|
||||
#include "GDCore/Extensions/Platform.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/IDE/AbstractFileSystem.h"
|
||||
#include "GDCore/IDE/Events/UsedExtensionsFinder.h"
|
||||
#include "GDCore/IDE/ExportedDependencyResolver.h"
|
||||
#include "GDCore/IDE/Project/ProjectResourcesCopier.h"
|
||||
#include "GDCore/IDE/ProjectStripper.h"
|
||||
#include "GDCore/IDE/SceneNameMangler.h"
|
||||
#include "GDCore/Project/EventsBasedObject.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
#include "GDCore/Project/ExternalEvents.h"
|
||||
#include "GDCore/Project/ExternalLayout.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Project/EventsBasedObject.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/Project/SourceFile.h"
|
||||
#include "GDCore/Serialization/Serializer.h"
|
||||
@@ -42,6 +41,7 @@
|
||||
#include "GDCore/Tools/Log.h"
|
||||
#include "GDJS/Events/CodeGeneration/LayoutCodeGenerator.h"
|
||||
#include "GDJS/Extensions/JsPlatform.h"
|
||||
#include "GDCore/IDE/Events/UsedExtensionsFinder.h"
|
||||
#undef CopyFile // Disable an annoying macro
|
||||
|
||||
namespace {
|
||||
@@ -87,23 +87,11 @@ bool ExporterHelper::ExportProjectForPixiPreview(
|
||||
gd::Project exportedProject = options.project;
|
||||
const gd::Project &immutableProject = exportedProject;
|
||||
|
||||
if (options.fullLoadingScreen) {
|
||||
// Use project properties fallback to set empty properties
|
||||
if (exportedProject.GetAuthorIds().empty() &&
|
||||
!options.fallbackAuthorId.empty()) {
|
||||
exportedProject.GetAuthorIds().push_back(options.fallbackAuthorId);
|
||||
}
|
||||
if (exportedProject.GetAuthorUsernames().empty() &&
|
||||
!options.fallbackAuthorUsername.empty()) {
|
||||
exportedProject.GetAuthorUsernames().push_back(
|
||||
options.fallbackAuthorUsername);
|
||||
}
|
||||
} else {
|
||||
if (!options.fullLoadingScreen) {
|
||||
// Most of the time, we skip the logo and minimum duration so that
|
||||
// the preview start as soon as possible.
|
||||
exportedProject.GetLoadingScreen().ShowGDevelopLogoDuringLoadingScreen(false).SetMinDuration(
|
||||
0);
|
||||
exportedProject.GetWatermark().ShowGDevelopWatermark(false);
|
||||
exportedProject.GetLoadingScreen().ShowGDevelopSplash(false);
|
||||
exportedProject.GetLoadingScreen().SetMinDuration(0);
|
||||
}
|
||||
|
||||
// Export resources (*before* generating events as some resources filenames
|
||||
@@ -186,10 +174,6 @@ bool ExporterHelper::ExportProjectForPixiPreview(
|
||||
if (options.isDevelopmentEnvironment) {
|
||||
runtimeGameOptions.AddChild("environment").SetStringValue("dev");
|
||||
}
|
||||
if (!options.gdevelopResourceToken.empty()) {
|
||||
runtimeGameOptions.AddChild("gdevelopResourceToken")
|
||||
.SetStringValue(options.gdevelopResourceToken);
|
||||
}
|
||||
|
||||
// Pass in the options the list of scripts files - useful for hot-reloading.
|
||||
auto &scriptFilesElement = runtimeGameOptions.AddChild("scriptFiles");
|
||||
@@ -592,7 +576,6 @@ void ExporterHelper::AddLibsInclude(bool pixiRenderers,
|
||||
InsertUnique(includesFiles, "layer.js");
|
||||
InsertUnique(includesFiles, "RuntimeSceneLayer.js");
|
||||
InsertUnique(includesFiles, "timer.js");
|
||||
InsertUnique(includesFiles, "runtimewatermark.js");
|
||||
InsertUnique(includesFiles, "runtimegame.js");
|
||||
InsertUnique(includesFiles, "variable.js");
|
||||
InsertUnique(includesFiles, "variablescontainer.js");
|
||||
|
@@ -38,9 +38,7 @@ struct PreviewExportOptions {
|
||||
projectDataOnlyExport(false),
|
||||
fullLoadingScreen(false),
|
||||
isDevelopmentEnvironment(false),
|
||||
nonRuntimeScriptsCacheBurst(0),
|
||||
fallbackAuthorId(""),
|
||||
fallbackAuthorUsername(""){};
|
||||
nonRuntimeScriptsCacheBurst(0){};
|
||||
|
||||
/**
|
||||
* \brief Set the address of the debugger server that the game should reach
|
||||
@@ -53,17 +51,6 @@ struct PreviewExportOptions {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the fallback author info (if info not present in project
|
||||
* properties).
|
||||
*/
|
||||
PreviewExportOptions &SetFallbackAuthor(const gd::String &id,
|
||||
const gd::String &username) {
|
||||
fallbackAuthorId = id;
|
||||
fallbackAuthorUsername = username;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set that the game should connect to the debugger server using
|
||||
* the "Window Message " debugger client.
|
||||
@@ -150,16 +137,6 @@ struct PreviewExportOptions {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the token to use by the game engine when requiring any resource stored on
|
||||
* GDevelop Cloud buckets. Note that this is only useful during previews.
|
||||
*/
|
||||
PreviewExportOptions &SetGDevelopResourceToken(
|
||||
const gd::String &gdevelopResourceToken_) {
|
||||
gdevelopResourceToken = gdevelopResourceToken_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
gd::Project &project;
|
||||
gd::String exportPath;
|
||||
gd::String websocketDebuggerServerAddress;
|
||||
@@ -167,59 +144,12 @@ struct PreviewExportOptions {
|
||||
bool useWindowMessageDebuggerClient;
|
||||
gd::String layoutName;
|
||||
gd::String externalLayoutName;
|
||||
gd::String fallbackAuthorUsername;
|
||||
gd::String fallbackAuthorId;
|
||||
std::map<gd::String, int> includeFileHashes;
|
||||
bool projectDataOnlyExport;
|
||||
bool fullLoadingScreen;
|
||||
bool isDevelopmentEnvironment;
|
||||
unsigned int nonRuntimeScriptsCacheBurst;
|
||||
gd::String electronRemoteRequirePath;
|
||||
gd::String gdevelopResourceToken;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief The options used to export a project.
|
||||
*/
|
||||
struct ExportOptions {
|
||||
/**
|
||||
* \param project_ The project to export
|
||||
* \param exportPath_ The path in the filesystem where to export the files
|
||||
*/
|
||||
ExportOptions(gd::Project &project_, const gd::String &exportPath_)
|
||||
: project(project_),
|
||||
exportPath(exportPath_),
|
||||
target(""),
|
||||
fallbackAuthorId(""),
|
||||
fallbackAuthorUsername(""){};
|
||||
|
||||
/**
|
||||
* \brief Set the fallback author info (if info not present in project
|
||||
* properties).
|
||||
*/
|
||||
ExportOptions &SetFallbackAuthor(const gd::String &id,
|
||||
const gd::String &username) {
|
||||
fallbackAuthorId = id;
|
||||
fallbackAuthorUsername = username;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the (optional) target platform.
|
||||
*
|
||||
* \param target_ The target platform (`cordova`, `facebookInstantGames` or
|
||||
* `electron`)
|
||||
*/
|
||||
ExportOptions &SetTarget(const gd::String &target_) {
|
||||
target = target_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
gd::Project &project;
|
||||
gd::String exportPath;
|
||||
gd::String target;
|
||||
gd::String fallbackAuthorUsername;
|
||||
gd::String fallbackAuthorId;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -117,16 +117,4 @@ ${error ? 'The following error was thrown: ' + error : ''}`
|
||||
return this.isResolved;
|
||||
}
|
||||
}
|
||||
|
||||
export class ManuallyResolvableTask extends AsyncTask {
|
||||
private isResolved = false;
|
||||
|
||||
resolve() {
|
||||
this.isResolved = true;
|
||||
}
|
||||
|
||||
update(): boolean {
|
||||
return this.isResolved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -385,17 +385,6 @@ namespace gdjs {
|
||||
angle1 + gdjs.evtTools.common.angleDifference(angle2, angle1) * x
|
||||
);
|
||||
};
|
||||
|
||||
export const resolveAsyncEventsFunction = (
|
||||
eventsFunctionContext: EventsFunctionContext
|
||||
) => {
|
||||
if (
|
||||
!!eventsFunctionContext &&
|
||||
!!eventsFunctionContext.task &&
|
||||
!!eventsFunctionContext.task.resolve
|
||||
)
|
||||
eventsFunctionContext.task.resolve();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -170,54 +170,6 @@ namespace gdjs {
|
||||
): number {
|
||||
return variable.getChildrenCount();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the first value of an array variable as a number.
|
||||
*/
|
||||
export const getFirstVariableNumber = function (
|
||||
array: gdjs.Variable
|
||||
): number {
|
||||
if (array.getChildrenCount() === 0) {
|
||||
return 0;
|
||||
}
|
||||
return array.getAllChildrenArray()[0].getAsNumber();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a string.
|
||||
*/
|
||||
export const getFirstVariableString = function (
|
||||
array: gdjs.Variable
|
||||
): string {
|
||||
if (array.getChildrenCount() === 0) {
|
||||
return '';
|
||||
}
|
||||
return array.getAllChildrenArray()[0].getAsString();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a number.
|
||||
*/
|
||||
export const getLastVariableNumber = function (
|
||||
array: gdjs.Variable
|
||||
): number {
|
||||
const children = array.getAllChildrenArray();
|
||||
return children.length === 0
|
||||
? 0
|
||||
: children[children.length - 1].getAsNumber();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a string.
|
||||
*/
|
||||
export const getLastVariableString = function (
|
||||
array: gdjs.Variable
|
||||
): string {
|
||||
const children = array.getAllChildrenArray();
|
||||
return children.length === 0
|
||||
? ''
|
||||
: children[children.length - 1].getAsString();
|
||||
};
|
||||
}
|
||||
|
||||
export namespace common {
|
||||
|
@@ -6,30 +6,40 @@
|
||||
namespace gdjs {
|
||||
const logger = new gdjs.Logger('Font manager');
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* FontFaceObserverFontManager loads fonts (using `FontFace` or `fontfaceobserver` library)
|
||||
* from the game resources (see `loadFonts`), and allow to access to
|
||||
* the font families of the loaded fonts during the game (see `getFontFamily`).
|
||||
*/
|
||||
export class FontFaceObserverFontManager {
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
_resources: ResourceData[];
|
||||
// Associate font resource names to the loaded font family
|
||||
_resources: any;
|
||||
_loadedFontFamily: { [key: string]: string } = {};
|
||||
// Associate font resource names to the resources, for faster access
|
||||
_loadedFonts: { [key: string]: ResourceData } = {};
|
||||
_filenameToFontFamily: { [key: string]: string } = {};
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
*/
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader
|
||||
) {
|
||||
constructor(resources: ResourceData[]) {
|
||||
this._resources = resources;
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
|
||||
// Associate font resource names to the loaded font family
|
||||
|
||||
// Associate font resource names to the resources, for faster access
|
||||
}
|
||||
|
||||
// Cache the result of transforming a filename to a font family - useful to avoid duplicates.
|
||||
@@ -118,15 +128,15 @@ namespace gdjs {
|
||||
* @param fontFamily The font
|
||||
* @returns The font family to be used for this font resource.
|
||||
*/
|
||||
private _loadFont(fontFamily: string, src): Promise<void> {
|
||||
static _loadFont(fontFamily: string, src): Promise<void> {
|
||||
const descriptors = {};
|
||||
const srcWithUrl = 'url(' + encodeURI(src) + ')';
|
||||
|
||||
// @ts-ignore
|
||||
if (typeof FontFace !== 'undefined') {
|
||||
// Load the given font using CSS Font Loading API.
|
||||
return fetch(this._resourcesLoader.getFullUrl(src), {
|
||||
credentials: this._resourcesLoader.checkIfCredentialsRequired(src)
|
||||
return fetch(src, {
|
||||
credentials: checkIfCredentialsRequired(src)
|
||||
? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
'include'
|
||||
@@ -205,34 +215,32 @@ namespace gdjs {
|
||||
const totalCount = Object.keys(filesResources).length;
|
||||
if (totalCount === 0) {
|
||||
return onComplete(
|
||||
// Nothing to load.
|
||||
//Nothing to load.
|
||||
totalCount
|
||||
);
|
||||
}
|
||||
let loadingCount = 0;
|
||||
const that = this;
|
||||
|
||||
const onFontLoaded = (
|
||||
fontFamily: string,
|
||||
fontResources: ResourceData[]
|
||||
) => {
|
||||
fontResources.forEach((resource) => {
|
||||
this._loadedFontFamily[resource.name] = fontFamily;
|
||||
this._loadedFonts[resource.name] = resource;
|
||||
function onFontLoaded(fontFamily: string, fontResources: ResourceData[]) {
|
||||
fontResources.forEach(function (resource) {
|
||||
that._loadedFontFamily[resource.name] = fontFamily;
|
||||
that._loadedFonts[resource.name] = resource;
|
||||
});
|
||||
loadingCount++;
|
||||
onProgress(loadingCount, totalCount);
|
||||
if (loadingCount === totalCount) {
|
||||
onComplete(totalCount);
|
||||
}
|
||||
};
|
||||
Object.keys(filesResources).forEach((file) => {
|
||||
const fontFamily = this._getFontFamilyFromFilename(file);
|
||||
}
|
||||
Object.keys(filesResources).forEach(function (file) {
|
||||
const fontFamily = that._getFontFamilyFromFilename(file);
|
||||
const fontResources = filesResources[file];
|
||||
this._loadFont(fontFamily, file).then(
|
||||
() => {
|
||||
FontFaceObserverFontManager._loadFont(fontFamily, file).then(
|
||||
function () {
|
||||
onFontLoaded(fontFamily, fontResources);
|
||||
},
|
||||
(error) => {
|
||||
function (error) {
|
||||
logger.error(
|
||||
'Error loading font resource "' +
|
||||
fontResources[0].name +
|
||||
|
@@ -15,6 +15,20 @@ namespace gdjs {
|
||||
logger.error('Error while loading an audio file: ' + error),
|
||||
};
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensure the volume is between 0 and 1.
|
||||
*/
|
||||
@@ -378,18 +392,8 @@ namespace gdjs {
|
||||
_pausedSounds: HowlerSound[] = [];
|
||||
_paused: boolean = false;
|
||||
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
*/
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader
|
||||
) {
|
||||
constructor(resources: ResourceData[]) {
|
||||
this._resources = resources;
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
|
||||
const that = this;
|
||||
document.addEventListener('deviceready', function () {
|
||||
@@ -525,12 +529,10 @@ namespace gdjs {
|
||||
cacheContainer[soundFile] = new Howl(
|
||||
Object.assign(
|
||||
{
|
||||
src: [this._resourcesLoader.getFullUrl(soundFile)],
|
||||
src: [soundFile],
|
||||
html5: isMusic,
|
||||
xhr: {
|
||||
withCredentials: this._resourcesLoader.checkIfCredentialsRequired(
|
||||
soundFile
|
||||
),
|
||||
withCredentials: checkIfCredentialsRequired(soundFile),
|
||||
},
|
||||
// Cache the sound with no volume. This avoids a bug where it plays at full volume
|
||||
// for a split second before setting its correct volume.
|
||||
@@ -564,12 +566,10 @@ namespace gdjs {
|
||||
cacheContainer[soundFile] = new Howl(
|
||||
Object.assign(
|
||||
{
|
||||
src: [this._resourcesLoader.getFullUrl(soundFile)],
|
||||
src: [soundFile],
|
||||
html5: isMusic,
|
||||
xhr: {
|
||||
withCredentials: this._resourcesLoader.checkIfCredentialsRequired(
|
||||
soundFile
|
||||
),
|
||||
withCredentials: checkIfCredentialsRequired(soundFile),
|
||||
},
|
||||
// Cache the sound with no volume. This avoids a bug where it plays at full volume
|
||||
// for a split second before setting its correct volume.
|
||||
@@ -807,14 +807,12 @@ namespace gdjs {
|
||||
const container = isMusic ? this._loadedMusics : this._loadedSounds;
|
||||
container[file] = new Howl(
|
||||
Object.assign({}, HowlParameters, {
|
||||
src: [this._resourcesLoader.getFullUrl(file)],
|
||||
src: [file],
|
||||
onload: onLoadCallback,
|
||||
onloaderror: onLoadCallback,
|
||||
html5: isMusic,
|
||||
xhr: {
|
||||
withCredentials: this._resourcesLoader.checkIfCredentialsRequired(
|
||||
file
|
||||
),
|
||||
withCredentials: checkIfCredentialsRequired(file),
|
||||
},
|
||||
// Cache the sound with no volume. This avoids a bug where it plays at full volume
|
||||
// for a split second before setting its correct volume.
|
||||
@@ -848,9 +846,7 @@ namespace gdjs {
|
||||
// preloading as sound already does a XHR request, hence "else if"
|
||||
loadCounter++;
|
||||
const sound = new XMLHttpRequest();
|
||||
sound.withCredentials = this._resourcesLoader.checkIfCredentialsRequired(
|
||||
file
|
||||
);
|
||||
sound.withCredentials = checkIfCredentialsRequired(file);
|
||||
sound.addEventListener('load', callback);
|
||||
sound.addEventListener('error', (_) =>
|
||||
callback(_, 'XHR error: ' + file)
|
||||
@@ -858,7 +854,7 @@ namespace gdjs {
|
||||
sound.addEventListener('abort', (_) =>
|
||||
callback(_, 'XHR abort: ' + file)
|
||||
);
|
||||
sound.open('GET', this._resourcesLoader.getFullUrl(file));
|
||||
sound.open('GET', file);
|
||||
sound.send();
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,20 @@ namespace gdjs {
|
||||
content: Object | null
|
||||
) => void;
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* JsonManager loads json files (using `XMLHttpRequest`), using the "json" resources
|
||||
* registered in the game resources.
|
||||
@@ -26,7 +40,6 @@ namespace gdjs {
|
||||
* that loading failed.
|
||||
*/
|
||||
export class JsonManager {
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
_resources: ResourceData[];
|
||||
|
||||
_loadedJsons: { [key: string]: Object } = {};
|
||||
@@ -34,14 +47,9 @@ namespace gdjs {
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
*/
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader
|
||||
) {
|
||||
constructor(resources: ResourceData[]) {
|
||||
this._resources = resources;
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,10 +151,8 @@ namespace gdjs {
|
||||
const that = this;
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.responseType = 'json';
|
||||
xhr.withCredentials = this._resourcesLoader.checkIfCredentialsRequired(
|
||||
resource.file
|
||||
);
|
||||
xhr.open('GET', this._resourcesLoader.getFullUrl(resource.file));
|
||||
xhr.withCredentials = checkIfCredentialsRequired(resource.file);
|
||||
xhr.open('GET', resource.file);
|
||||
xhr.onload = function () {
|
||||
const callbacks = that._callbacks[resourceName];
|
||||
if (!callbacks) {
|
||||
|
@@ -25,11 +25,6 @@ namespace gdjs {
|
||||
_isLightingLayer: boolean;
|
||||
_clearColor: Array<integer>;
|
||||
|
||||
/**
|
||||
* Pixi doesn't sort children with zIndex == 0.
|
||||
*/
|
||||
private static readonly zeroZOrder = Math.pow(2, -24);
|
||||
|
||||
/**
|
||||
* @param layer The layer
|
||||
* @param runtimeInstanceContainerRenderer The scene renderer
|
||||
@@ -40,7 +35,6 @@ namespace gdjs {
|
||||
pixiRenderer: PIXI.Renderer | null
|
||||
) {
|
||||
this._pixiContainer = new PIXI.Container();
|
||||
this._pixiContainer.sortableChildren = true;
|
||||
this._layer = layer;
|
||||
this._runtimeSceneRenderer = runtimeInstanceContainerRenderer;
|
||||
this._pixiRenderer = pixiRenderer;
|
||||
@@ -139,24 +133,33 @@ namespace gdjs {
|
||||
* Add a child to the pixi container associated to the layer.
|
||||
* All objects which are on this layer must be children of this container.
|
||||
*
|
||||
* @param pixiChild The child (PIXI object) to be added.
|
||||
* @param child The child (PIXI object) to be added.
|
||||
* @param zOrder The z order of the associated object.
|
||||
*/
|
||||
addRendererObject(pixiChild, zOrder: float): void {
|
||||
const child = pixiChild as PIXI.DisplayObject;
|
||||
child.zIndex = zOrder || LayerPixiRenderer.zeroZOrder;
|
||||
addRendererObject(child, zOrder: integer): void {
|
||||
child.zOrder = zOrder;
|
||||
|
||||
//Extend the pixi object with a z order.
|
||||
for (let i = 0, len = this._pixiContainer.children.length; i < len; ++i) {
|
||||
// @ts-ignore - we added a "zOrder" property.
|
||||
if (this._pixiContainer.children[i].zOrder >= zOrder) {
|
||||
//TODO : Dichotomic search
|
||||
this._pixiContainer.addChildAt(child, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._pixiContainer.addChild(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the z order of a child associated to an object.
|
||||
*
|
||||
* @param pixiChild The child (PIXI object) to be modified.
|
||||
* @param child The child (PIXI object) to be modified.
|
||||
* @param newZOrder The z order of the associated object.
|
||||
*/
|
||||
changeRendererObjectZOrder(pixiChild, newZOrder: float): void {
|
||||
const child = pixiChild as PIXI.DisplayObject;
|
||||
child.zIndex = newZOrder;
|
||||
changeRendererObjectZOrder(child, newZOrder: integer): void {
|
||||
this._pixiContainer.removeChild(child);
|
||||
this.addRendererObject(child, newZOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,20 @@ namespace gdjs {
|
||||
// Set this to 0 to unload from memory ("uninstall") as soon as a font is unused.
|
||||
const uninstallCacheSize = 5;
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* We patch the installed font to use a name that is unique for each font data and texture,
|
||||
* to avoid conflicts between different font files using the same font name (by default, the
|
||||
@@ -58,21 +72,16 @@ namespace gdjs {
|
||||
|
||||
private _defaultSlugFontName: string | null = null;
|
||||
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
* @param imageManager The image manager to be used to get textures used by fonts.
|
||||
*/
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader,
|
||||
imageManager: gdjs.PixiImageManager
|
||||
) {
|
||||
this._resources = resources;
|
||||
this._imageManager = imageManager;
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,19 +275,14 @@ namespace gdjs {
|
||||
let loadedCount = 0;
|
||||
return Promise.all(
|
||||
bitmapFontResources.map((bitmapFontResource) => {
|
||||
return fetch(
|
||||
this._resourcesLoader.getFullUrl(bitmapFontResource.file),
|
||||
{
|
||||
credentials: this._resourcesLoader.checkIfCredentialsRequired(
|
||||
bitmapFontResource.file
|
||||
)
|
||||
? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
'include'
|
||||
: // For other resources, use "same-origin" as done by default by fetch.
|
||||
'same-origin',
|
||||
}
|
||||
)
|
||||
return fetch(bitmapFontResource.file, {
|
||||
credentials: checkIfCredentialsRequired(bitmapFontResource.file)
|
||||
? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
'include'
|
||||
: // For other resources, use "same-origin" as done by default by fetch.
|
||||
'same-origin',
|
||||
})
|
||||
.then((response) => response.text())
|
||||
.then((fontData) => {
|
||||
this._loadedFontsData[bitmapFontResource.name] = fontData;
|
||||
|
@@ -40,6 +40,20 @@ namespace gdjs {
|
||||
return null;
|
||||
};
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* PixiImageManager loads and stores textures that can be used by the Pixi.js renderers.
|
||||
*/
|
||||
@@ -57,18 +71,11 @@ namespace gdjs {
|
||||
*/
|
||||
_loadedTextures: Hashtable<PIXI.Texture<PIXI.Resource>>;
|
||||
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
*/
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader
|
||||
) {
|
||||
constructor(resources: ResourceData[]) {
|
||||
this._resources = resources;
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
this._invalidTexture = PIXI.Texture.from(
|
||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAFElEQVQoU2P8z/D/PwMewDgyFAAApMMX8Zi0uXAAAAAASUVORK5CYIIA'
|
||||
);
|
||||
@@ -123,19 +130,16 @@ namespace gdjs {
|
||||
|
||||
logger.log('Loading texture for resource "' + resourceName + '"...');
|
||||
const file = resource.file;
|
||||
const texture = PIXI.Texture.from(
|
||||
this._resourcesLoader.getFullUrl(file),
|
||||
{
|
||||
resourceOptions: {
|
||||
// Note that using `false`
|
||||
// to not having `crossorigin` at all would NOT work because the browser would taint the
|
||||
// loaded resource so that it can't be read/used in a canvas (it's only working for display `<img>` on screen).
|
||||
crossorigin: this._resourcesLoader.checkIfCredentialsRequired(file)
|
||||
? 'use-credentials'
|
||||
: 'anonymous',
|
||||
},
|
||||
}
|
||||
).on('error', (error) => {
|
||||
const texture = PIXI.Texture.from(file, {
|
||||
resourceOptions: {
|
||||
// Note that using `false`
|
||||
// to not having `crossorigin` at all would NOT work because the browser would taint the
|
||||
// loaded resource so that it can't be read/used in a canvas (it's only working for display `<img>` on screen).
|
||||
crossorigin: checkIfCredentialsRequired(file)
|
||||
? 'use-credentials'
|
||||
: 'anonymous',
|
||||
},
|
||||
}).on('error', (error) => {
|
||||
logFileLoadingError(file, error);
|
||||
});
|
||||
applyTextureSettings(texture, resource);
|
||||
@@ -175,19 +179,16 @@ namespace gdjs {
|
||||
logger.log(
|
||||
'Loading video texture for resource "' + resourceName + '"...'
|
||||
);
|
||||
const texture = PIXI.Texture.from(
|
||||
this._resourcesLoader.getFullUrl(file),
|
||||
{
|
||||
resourceOptions: {
|
||||
// Note that using `false`
|
||||
// to not having `crossorigin` at all would NOT work because the browser would taint the
|
||||
// loaded resource so that it can't be read/used in a canvas (it's only working for display `<img>` on screen).
|
||||
crossorigin: this._resourcesLoader.checkIfCredentialsRequired(file)
|
||||
? 'use-credentials'
|
||||
: 'anonymous',
|
||||
},
|
||||
}
|
||||
).on('error', (error) => {
|
||||
const texture = PIXI.Texture.from(file, {
|
||||
resourceOptions: {
|
||||
// Note that using `false`
|
||||
// to not having `crossorigin` at all would NOT work because the browser would taint the
|
||||
// loaded resource so that it can't be read/used in a canvas (it's only working for display `<img>` on screen).
|
||||
crossorigin: checkIfCredentialsRequired(file)
|
||||
? 'use-credentials'
|
||||
: 'anonymous',
|
||||
},
|
||||
}).on('error', (error) => {
|
||||
logFileLoadingError(file, error);
|
||||
});
|
||||
|
||||
@@ -244,9 +245,9 @@ namespace gdjs {
|
||||
if (resourceFiles.hasOwnProperty(file)) {
|
||||
loader.add({
|
||||
name: file,
|
||||
url: this._resourcesLoader.getFullUrl(file),
|
||||
url: file,
|
||||
loadType: PIXI.LoaderResource.LOAD_TYPE.IMAGE,
|
||||
crossOrigin: this._resourcesLoader.checkIfCredentialsRequired(file)
|
||||
crossOrigin: checkIfCredentialsRequired(file)
|
||||
? 'use-credentials'
|
||||
: 'anonymous',
|
||||
});
|
||||
|
@@ -527,14 +527,6 @@ namespace gdjs {
|
||||
|
||||
return true;
|
||||
};
|
||||
const isTargetDomElement = (event: TouchEvent) => {
|
||||
// Fast bailout when the game canvas should receive the inputs (i.e: almost always).
|
||||
// Any event with a target that is not the body or the canvas should
|
||||
// not go to the game (<input> or <a> elements for instances).
|
||||
if (event.target === canvas || event.target === document.body)
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
document.onkeydown = function (e) {
|
||||
if (isFocusingDomElement()) {
|
||||
// Bail out if the game canvas is not focused. For example,
|
||||
@@ -648,6 +640,7 @@ namespace gdjs {
|
||||
if (window.focus !== undefined) {
|
||||
window.focus();
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
},
|
||||
false
|
||||
@@ -664,7 +657,7 @@ namespace gdjs {
|
||||
|
||||
// Touches:
|
||||
window.addEventListener('touchmove', function (e) {
|
||||
if (isTargetDomElement(e)) {
|
||||
if (isFocusingDomElement()) {
|
||||
// Bail out if the game canvas is not focused. For example,
|
||||
// an `<input>` element can be focused, and needs to receive
|
||||
// touch events to move the selection (and do other native gestures).
|
||||
@@ -689,7 +682,7 @@ namespace gdjs {
|
||||
}
|
||||
});
|
||||
window.addEventListener('touchstart', function (e) {
|
||||
if (isTargetDomElement(e)) {
|
||||
if (isFocusingDomElement()) {
|
||||
// Bail out if the game canvas is not focused. For example,
|
||||
// an `<input>` element can be focused, and needs to receive
|
||||
// touch events to move the selection (and do other native gestures).
|
||||
@@ -710,7 +703,7 @@ namespace gdjs {
|
||||
return false;
|
||||
});
|
||||
window.addEventListener('touchend', function (e) {
|
||||
if (isTargetDomElement(e)) {
|
||||
if (isFocusingDomElement()) {
|
||||
// Bail out if the game canvas is not focused. For example,
|
||||
// an `<input>` element can be focused, and needs to receive
|
||||
// touch events to move the selection (and do other native gestures).
|
||||
|
@@ -42,12 +42,6 @@ namespace gdjs {
|
||||
*/
|
||||
electronRemoteRequirePath?: string;
|
||||
|
||||
/**
|
||||
* the token to use by the game engine when requiring any resource stored on
|
||||
* GDevelop Cloud buckets. Note that this is only useful during previews.
|
||||
*/
|
||||
gdevelopResourceToken?: string;
|
||||
|
||||
/**
|
||||
* If set, the game should use the specified environment for making calls
|
||||
* to GDevelop APIs ("dev" = development APIs).
|
||||
@@ -55,76 +49,10 @@ namespace gdjs {
|
||||
environment?: 'dev';
|
||||
};
|
||||
|
||||
const addSearchParameterToUrl = (
|
||||
url: string,
|
||||
urlEncodedParameterName: string,
|
||||
urlEncodedValue: string
|
||||
) => {
|
||||
if (url.startsWith('data:') || url.startsWith('blob:')) {
|
||||
// blob/data protocol does not support search parameters, which are useless anyway.
|
||||
return url;
|
||||
}
|
||||
|
||||
const separator = url.indexOf('?') === -1 ? '?' : '&';
|
||||
return url + separator + urlEncodedParameterName + '=' + urlEncodedValue;
|
||||
};
|
||||
|
||||
const checkIfIsGDevelopCloudBucketUrl = (url: string): boolean => {
|
||||
return (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gives helper methods used when resources are loaded from an URL.
|
||||
*/
|
||||
export class RuntimeGameResourcesLoader {
|
||||
_runtimeGame: RuntimeGame;
|
||||
|
||||
constructor(runtimeGame: RuntimeGame) {
|
||||
this._runtimeGame = runtimeGame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete the given URL with any specific parameter required to access
|
||||
* the resource (this can be for example a token needed to access the resource).
|
||||
*/
|
||||
getFullUrl(url: string) {
|
||||
const { gdevelopResourceToken } = this._runtimeGame._options;
|
||||
if (!gdevelopResourceToken) return url;
|
||||
|
||||
if (!checkIfIsGDevelopCloudBucketUrl(url)) return url;
|
||||
|
||||
return addSearchParameterToUrl(
|
||||
url,
|
||||
'gd_resource_token',
|
||||
encodeURIComponent(gdevelopResourceToken)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the specified URL must be loaded with cookies ("credentials")
|
||||
* sent to grant access to them.
|
||||
*/
|
||||
checkIfCredentialsRequired(url: string) {
|
||||
if (this._runtimeGame._options.gdevelopResourceToken) return false;
|
||||
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (checkIfIsGDevelopCloudBucketUrl(url)) return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a game being played.
|
||||
*/
|
||||
export class RuntimeGame {
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
_variables: VariablesContainer;
|
||||
_data: ProjectData;
|
||||
_eventsBasedObjectDatas: Map<String, EventsBasedObjectData>;
|
||||
@@ -150,7 +78,6 @@ namespace gdjs {
|
||||
_renderer: RuntimeGameRenderer;
|
||||
_sessionId: string | null;
|
||||
_playerId: string | null;
|
||||
_watermark: watermark.RuntimeWatermark;
|
||||
|
||||
_sceneStack: SceneStack;
|
||||
/**
|
||||
@@ -199,26 +126,16 @@ namespace gdjs {
|
||||
this._options = options || {};
|
||||
this._variables = new gdjs.VariablesContainer(data.variables);
|
||||
this._data = data;
|
||||
this._resourcesLoader = new gdjs.RuntimeGameResourcesLoader(this);
|
||||
this._imageManager = new gdjs.ImageManager(
|
||||
this._data.resources.resources,
|
||||
this._resourcesLoader
|
||||
this._data.resources.resources
|
||||
);
|
||||
this._soundManager = new gdjs.SoundManager(
|
||||
this._data.resources.resources,
|
||||
this._resourcesLoader
|
||||
);
|
||||
this._fontManager = new gdjs.FontManager(
|
||||
this._data.resources.resources,
|
||||
this._resourcesLoader
|
||||
);
|
||||
this._jsonManager = new gdjs.JsonManager(
|
||||
this._data.resources.resources,
|
||||
this._resourcesLoader
|
||||
this._data.resources.resources
|
||||
);
|
||||
this._fontManager = new gdjs.FontManager(this._data.resources.resources);
|
||||
this._jsonManager = new gdjs.JsonManager(this._data.resources.resources);
|
||||
this._bitmapFontManager = new gdjs.BitmapFontManager(
|
||||
this._data.resources.resources,
|
||||
this._resourcesLoader,
|
||||
this._imageManager
|
||||
);
|
||||
this._effectsManager = new gdjs.EffectsManager();
|
||||
@@ -236,11 +153,6 @@ namespace gdjs {
|
||||
this,
|
||||
this._options.forceFullscreen || false
|
||||
);
|
||||
this._watermark = new gdjs.watermark.RuntimeWatermark(
|
||||
this,
|
||||
data.properties.authorUsernames,
|
||||
this._data.properties.watermark
|
||||
);
|
||||
this._sceneStack = new gdjs.SceneStack(this);
|
||||
this._inputManager = new gdjs.InputManager();
|
||||
this._injectExternalLayout = this._options.injectExternalLayout || '';
|
||||
@@ -752,7 +664,6 @@ namespace gdjs {
|
||||
this.getSceneData().name,
|
||||
this._injectExternalLayout
|
||||
);
|
||||
this._watermark.displayAtStartup();
|
||||
|
||||
//Uncomment to profile the first x frames of the game.
|
||||
// var x = 500;
|
||||
|
@@ -940,46 +940,6 @@ namespace gdjs {
|
||||
array.removeAtIndex(index);
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the first value of an array variable as a string.
|
||||
*/
|
||||
static getFirstVariableString = function (array: gdjs.Variable): string {
|
||||
if (array.getChildrenCount() === 0) {
|
||||
return '';
|
||||
}
|
||||
return array.getAllChildrenArray()[0].getAsString();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the first value of an array variable as a number.
|
||||
*/
|
||||
static getFirstVariableNumber = function (array: gdjs.Variable): number {
|
||||
if (array.getChildrenCount() === 0) {
|
||||
return 0;
|
||||
}
|
||||
return array.getAllChildrenArray()[0].getAsNumber();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a string.
|
||||
*/
|
||||
static getLastVariableString = function (array: gdjs.Variable): string {
|
||||
const children = array.getAllChildrenArray();
|
||||
return children.length === 0
|
||||
? ''
|
||||
: children[children.length - 1].getAsString();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a number.
|
||||
*/
|
||||
static getLastVariableNumber = function (array: gdjs.Variable): number {
|
||||
const children = array.getAllChildrenArray();
|
||||
return children.length === 0
|
||||
? 0
|
||||
: children[children.length - 1].getAsNumber();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to test if a variable exists for the object.
|
||||
* @param name The variable to be tested
|
||||
@@ -2571,11 +2531,6 @@ namespace gdjs {
|
||||
setVariableString = RuntimeObject.setVariableString;
|
||||
getVariableBoolean = RuntimeObject.getVariableBoolean;
|
||||
setVariableBoolean = RuntimeObject.setVariableBoolean;
|
||||
getVariableChildCount = RuntimeObject.getVariableChildCount;
|
||||
getFirstVariableNumber = RuntimeObject.getFirstVariableNumber;
|
||||
getFirstVariableString = RuntimeObject.getFirstVariableString;
|
||||
getLastVariableNumber = RuntimeObject.getLastVariableNumber;
|
||||
getLastVariableString = RuntimeObject.getLastVariableString;
|
||||
toggleVariableBoolean = RuntimeObject.toggleVariableBoolean;
|
||||
variableChildExists = RuntimeObject.variableChildExists;
|
||||
variableRemoveChild = RuntimeObject.variableRemoveChild;
|
||||
|
@@ -1,445 +0,0 @@
|
||||
namespace gdjs {
|
||||
export namespace watermark {
|
||||
export class RuntimeWatermark {
|
||||
_gameRenderer: RuntimeGameRenderer;
|
||||
_isDevEnvironment: boolean;
|
||||
|
||||
// Configuration
|
||||
_placement:
|
||||
| 'top-left'
|
||||
| 'top-right'
|
||||
| 'bottom-left'
|
||||
| 'bottom-right'
|
||||
| 'bottom'
|
||||
| 'top';
|
||||
_showAtStartup: boolean;
|
||||
_authorUsername: string | undefined;
|
||||
_gameId: string | undefined;
|
||||
|
||||
// Dom elements
|
||||
_linkElement: HTMLAnchorElement | null = null;
|
||||
_containerElement: HTMLDivElement | null = null;
|
||||
_backgroundElement: HTMLDivElement | null = null;
|
||||
_svgElement: SVGElement | null = null;
|
||||
_usernameTextElement: HTMLSpanElement | null = null;
|
||||
_madeWithTextElement: HTMLSpanElement | null = null;
|
||||
|
||||
_resizeObserver: ResizeObserver | null = null;
|
||||
|
||||
// Durations in seconds
|
||||
_displayDuration: number = 20;
|
||||
_changeTextDelay: number = 7;
|
||||
_fadeInDelayAfterGameLoaded: number = 1;
|
||||
_fadeDuration: number = 0.3;
|
||||
|
||||
// Timeout registration
|
||||
_fadeOutTimeout: NodeJS.Timeout | null = null;
|
||||
_hideTimeout: NodeJS.Timeout | null = null;
|
||||
_fadeOutFirstTextTimeout: NodeJS.Timeout | null = null;
|
||||
_fadeInSecondTextTimeout: NodeJS.Timeout | null = null;
|
||||
|
||||
// Sizes
|
||||
_textFontSize: number = 14;
|
||||
_logoWidth: number = 56;
|
||||
_logoHeight: number = 45;
|
||||
_backgroundHeight: number = 150;
|
||||
_margin: number = 10;
|
||||
|
||||
constructor(
|
||||
game: RuntimeGame,
|
||||
authorUsernames: Array<string>,
|
||||
watermarkData: WatermarkData
|
||||
) {
|
||||
this._gameId = game._data.properties.projectUuid;
|
||||
this._gameRenderer = game.getRenderer();
|
||||
this._authorUsername = authorUsernames[0];
|
||||
this._placement = watermarkData.placement;
|
||||
this._showAtStartup = watermarkData.showWatermark;
|
||||
this._isDevEnvironment = game.isUsingGDevelopDevelopmentEnvironment();
|
||||
this.addStyle();
|
||||
}
|
||||
|
||||
displayAtStartup() {
|
||||
if (this._showAtStartup) {
|
||||
this.display();
|
||||
}
|
||||
}
|
||||
|
||||
display() {
|
||||
const gameContainer = this._gameRenderer.getDomElementContainer();
|
||||
if (gameContainer) {
|
||||
this.addWatermarkToGameContainer(gameContainer);
|
||||
this._resizeObserver = new ResizeObserver(() => {
|
||||
const gameContainerRectangle = gameContainer.getBoundingClientRect();
|
||||
this.onResizeGameContainer(gameContainerRectangle.height);
|
||||
});
|
||||
this._resizeObserver.observe(gameContainer);
|
||||
}
|
||||
}
|
||||
|
||||
private updateFontSize(height: number) {
|
||||
this._textFontSize = Math.max(0.025 * height, 12);
|
||||
}
|
||||
private updateLogoSize(height: number) {
|
||||
this._logoWidth = Math.max(0.06 * height, 25);
|
||||
this._logoHeight = Math.round((45 / 56) * this._logoWidth);
|
||||
}
|
||||
private updateBackgroundHeight(height: number) {
|
||||
this._backgroundHeight = Math.max(0.13 * height, 45);
|
||||
}
|
||||
private updateMargin(height: number) {
|
||||
this._margin = Math.max(0.025 * height, 8);
|
||||
}
|
||||
|
||||
private onResizeGameContainer(height: number) {
|
||||
this.updateFontSize(height);
|
||||
if (this._madeWithTextElement) {
|
||||
this._madeWithTextElement.style.fontSize = `${this._textFontSize}px`;
|
||||
}
|
||||
if (this._usernameTextElement) {
|
||||
this._usernameTextElement.style.fontSize = `${this._textFontSize}px`;
|
||||
}
|
||||
this.updateLogoSize(height);
|
||||
if (this._svgElement) {
|
||||
this._svgElement.setAttribute('height', this._logoHeight.toString());
|
||||
this._svgElement.setAttribute('width', this._logoWidth.toString());
|
||||
}
|
||||
this.updateBackgroundHeight(height);
|
||||
if (this._backgroundElement) {
|
||||
this._backgroundElement.style.height = `${this._backgroundHeight}px`;
|
||||
}
|
||||
this.updateMargin(height);
|
||||
if (this._linkElement) {
|
||||
this.updateElementMargins(this._linkElement);
|
||||
}
|
||||
}
|
||||
|
||||
private addWatermarkToGameContainer(container: HTMLElement) {
|
||||
const gameContainerRectangle = container.getBoundingClientRect();
|
||||
this.updateFontSize(gameContainerRectangle.height);
|
||||
this.updateLogoSize(gameContainerRectangle.height);
|
||||
this.updateBackgroundHeight(gameContainerRectangle.height);
|
||||
|
||||
this._containerElement = this.createDivContainer();
|
||||
this.createBackground();
|
||||
const textContainer = document.createElement('div');
|
||||
|
||||
this.generateSVGLogo(gameContainerRectangle.height);
|
||||
this.createMadeWithTextElement();
|
||||
this.createUsernameTextElement();
|
||||
|
||||
this._linkElement = this.createLinkElement();
|
||||
|
||||
if (this._svgElement)
|
||||
this._containerElement.appendChild(this._svgElement);
|
||||
if (this._madeWithTextElement)
|
||||
textContainer.appendChild(this._madeWithTextElement);
|
||||
if (this._usernameTextElement)
|
||||
textContainer.appendChild(this._usernameTextElement);
|
||||
this._containerElement.appendChild(textContainer);
|
||||
if (this._backgroundElement)
|
||||
container.appendChild(this._backgroundElement);
|
||||
|
||||
this._linkElement.append(this._containerElement);
|
||||
container.appendChild(this._linkElement);
|
||||
|
||||
this.setupAnimations();
|
||||
}
|
||||
|
||||
private createBackground() {
|
||||
this._backgroundElement = document.createElement('div');
|
||||
this._backgroundElement.setAttribute('id', 'watermark-background');
|
||||
this._backgroundElement.style.height = `${this._backgroundHeight}px`;
|
||||
this._backgroundElement.style.opacity = '0';
|
||||
if (this._placement.startsWith('top')) {
|
||||
this._backgroundElement.style.top = '0';
|
||||
this._backgroundElement.style.backgroundImage =
|
||||
'linear-gradient(180deg, rgba(38, 38, 38, .6) 0%, rgba(38, 38, 38, 0) 100% )';
|
||||
} else {
|
||||
this._backgroundElement.style.bottom = '0';
|
||||
this._backgroundElement.style.backgroundImage =
|
||||
'linear-gradient(0deg, rgba(38, 38, 38, .6) 0%, rgba(38, 38, 38, 0) 100% )';
|
||||
}
|
||||
}
|
||||
|
||||
private setupAnimations() {
|
||||
// Necessary to trigger fade in transition
|
||||
requestAnimationFrame(() => {
|
||||
// Display the watermark
|
||||
setTimeout(() => {
|
||||
if (
|
||||
!this._containerElement ||
|
||||
!this._backgroundElement ||
|
||||
!this._linkElement
|
||||
)
|
||||
return;
|
||||
this._containerElement.style.opacity = '1';
|
||||
this._backgroundElement.style.opacity = '1';
|
||||
this._linkElement.style.pointerEvents = 'all';
|
||||
if (this._svgElement) this._svgElement.classList.add('spinning');
|
||||
}, this._fadeInDelayAfterGameLoaded * 1000);
|
||||
});
|
||||
|
||||
// Hide the watermark
|
||||
this._fadeOutTimeout = setTimeout(() => {
|
||||
if (!this._containerElement || !this._backgroundElement) {
|
||||
return;
|
||||
}
|
||||
this._containerElement.style.opacity = '0';
|
||||
this._backgroundElement.style.opacity = '0';
|
||||
|
||||
// Completely remove the watermark once the fade out duration has ended.
|
||||
this._hideTimeout = setTimeout(
|
||||
() => {
|
||||
if (
|
||||
!this._containerElement ||
|
||||
!this._backgroundElement ||
|
||||
!this._linkElement
|
||||
)
|
||||
return;
|
||||
this._linkElement.style.pointerEvents = 'none';
|
||||
this._containerElement.style.display = 'none';
|
||||
this._backgroundElement.style.display = 'none';
|
||||
if (this._resizeObserver) this._resizeObserver.disconnect();
|
||||
},
|
||||
// Deactivate all interaction possibilities with watermark at
|
||||
// the end of the animation to make sure it doesn't deactivate too early
|
||||
this._fadeDuration * 1000
|
||||
);
|
||||
}, (this._fadeInDelayAfterGameLoaded + this._displayDuration) * 1000);
|
||||
|
||||
// Change text below watermark
|
||||
this._fadeOutFirstTextTimeout = setTimeout(() => {
|
||||
const { _madeWithTextElement, _usernameTextElement } = this;
|
||||
if (!_madeWithTextElement) return;
|
||||
|
||||
// Do not hide madeWith text if there is no author username to display.
|
||||
if (_usernameTextElement) {
|
||||
_madeWithTextElement.style.opacity = '0';
|
||||
this._fadeInSecondTextTimeout = setTimeout(() => {
|
||||
_usernameTextElement.style.lineHeight = 'normal';
|
||||
_usernameTextElement.style.opacity = '1';
|
||||
_madeWithTextElement.style.lineHeight = '0';
|
||||
}, this._fadeDuration * 1000);
|
||||
}
|
||||
}, (this._fadeInDelayAfterGameLoaded + this._changeTextDelay) * 1000);
|
||||
}
|
||||
|
||||
private createMadeWithTextElement() {
|
||||
this._madeWithTextElement = document.createElement('span');
|
||||
this._madeWithTextElement.innerText = 'Made with GDevelop';
|
||||
this._madeWithTextElement.style.fontSize = `${this._textFontSize}px`;
|
||||
}
|
||||
|
||||
private createUsernameTextElement() {
|
||||
if (!this._authorUsername) return;
|
||||
this._usernameTextElement = document.createElement('span');
|
||||
this._usernameTextElement.innerText = `@${this._authorUsername}`;
|
||||
this._usernameTextElement.style.fontSize = `${this._textFontSize}px`;
|
||||
this._usernameTextElement.style.opacity = '0';
|
||||
this._usernameTextElement.style.lineHeight = '0';
|
||||
}
|
||||
|
||||
private updateElementMargins(element: HTMLElement) {
|
||||
switch (this._placement) {
|
||||
case 'top-left':
|
||||
element.style.top = `${this._margin}px`;
|
||||
element.style.left = `${this._margin}px`;
|
||||
break;
|
||||
case 'top-right':
|
||||
element.style.top = `${this._margin}px`;
|
||||
element.style.right = `${this._margin}px`;
|
||||
break;
|
||||
case 'bottom-left':
|
||||
element.style.bottom = `${this._margin}px`;
|
||||
element.style.left = `${this._margin}px`;
|
||||
break;
|
||||
case 'bottom-right':
|
||||
element.style.bottom = `${this._margin}px`;
|
||||
element.style.right = `${this._margin}px`;
|
||||
break;
|
||||
case 'top':
|
||||
element.style.top = `${this._margin}px`;
|
||||
element.style.left = '50%';
|
||||
element.style.transform = 'translate(-50%, 0)';
|
||||
break;
|
||||
case 'bottom':
|
||||
default:
|
||||
element.style.bottom = `${this._margin}px`;
|
||||
element.style.left = '50%';
|
||||
element.style.transform = 'translate(-50%, 0)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private createLinkElement(): HTMLAnchorElement {
|
||||
const linkElement = document.createElement('a');
|
||||
linkElement.id = 'watermark-link';
|
||||
|
||||
let targetUrl = this._authorUsername
|
||||
? new URL(`https://liluo.io/${this._authorUsername}`)
|
||||
: new URL('https://liluo.io');
|
||||
|
||||
if (this._isDevEnvironment) {
|
||||
targetUrl.searchParams.set('dev', 'true');
|
||||
} else {
|
||||
targetUrl.searchParams.set('utm_source', 'gdevelop-game');
|
||||
targetUrl.searchParams.set('utm_medium', 'game-watermark');
|
||||
|
||||
if (this._gameId) {
|
||||
targetUrl.searchParams.set('utm_campaign', this._gameId);
|
||||
}
|
||||
}
|
||||
linkElement.href = targetUrl.href;
|
||||
linkElement.target = '_blank';
|
||||
|
||||
this.updateElementMargins(linkElement);
|
||||
|
||||
return linkElement;
|
||||
}
|
||||
|
||||
private createDivContainer(): HTMLDivElement {
|
||||
const divContainer = document.createElement('div');
|
||||
divContainer.setAttribute('id', 'watermark');
|
||||
|
||||
divContainer.style.opacity = '0';
|
||||
return divContainer;
|
||||
}
|
||||
|
||||
private generateSVGLogo(height: number) {
|
||||
this._svgElement = document.createElementNS(
|
||||
'http://www.w3.org/2000/svg',
|
||||
'svg'
|
||||
);
|
||||
|
||||
this.updateLogoSize(height);
|
||||
this._svgElement.setAttribute('height', this._logoHeight.toString());
|
||||
this._svgElement.setAttribute('width', this._logoWidth.toString());
|
||||
this._svgElement.setAttribute('viewBox', '-2 -2 59 48');
|
||||
this._svgElement.setAttribute('fill', 'none');
|
||||
const path1 = document.createElementNS(
|
||||
'http://www.w3.org/2000/svg',
|
||||
'path'
|
||||
);
|
||||
const path2 = document.createElementNS(
|
||||
'http://www.w3.org/2000/svg',
|
||||
'path'
|
||||
);
|
||||
path1.setAttribute(
|
||||
'd',
|
||||
'M29.3447 33C25.1061 33 21.0255 31.8475 17.4207 29.3381C14.9081 27.5897 12 23.6418 12 16.9488C12 4.53178 18.3074 0 30.9827 0H53.8027L56 7.07232H32.7217C24.3558 7.07232 19.3813 7.72835 19.3813 16.9488C19.3813 19.9944 20.2354 22.1618 21.9933 23.574C24.9642 25.9612 30.7388 26.0628 34.2673 25.7208C34.2673 25.7208 35.715 21.0394 35.9534 20.2794C36.2327 19.3888 36.1104 19.1763 35.2392 19.1763C33.9808 19.1763 31.7185 19.1763 29.3175 19.1763C27.6349 19.1763 25.9818 18.3247 25.9818 16.2793C25.9818 14.3039 27.5198 13.1573 29.6281 13.1573C33.2786 13.1573 40.7969 13.1573 42.2041 13.1573C44.0489 13.1573 45.9315 13.4233 44.971 16.3601L39.8842 31.8734C39.8845 31.8738 35.7287 33 29.3447 33Z'
|
||||
);
|
||||
path2.setAttribute(
|
||||
'd',
|
||||
'M43.3039 35.3278C40.7894 37.1212 37.0648 38.1124 30.7449 38.1124C19.852 38.1124 11.8797 34.1251 8.62927 26.3952C7.0925 22.7415 7.24041 18.6005 7.24041 13H0.00129513C0.00129513 18.9056 -0.0984386 23.5361 1.45249 27.8011C5.51933 38.989 15.992 45 30.0606 45C43.6783 45 49.3213 41.0443 53 35.3278H43.3039Z'
|
||||
);
|
||||
this._svgElement.appendChild(path1);
|
||||
this._svgElement.appendChild(path2);
|
||||
}
|
||||
|
||||
private addStyle() {
|
||||
const styleElement = document.createElement('style');
|
||||
styleElement.innerHTML = `
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
5% {
|
||||
transform: rotate(-10deg);
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
|
||||
17% {
|
||||
transform: rotate(370deg);
|
||||
animation-timing-function: ease-in-out;
|
||||
}
|
||||
|
||||
20% {
|
||||
transform: rotate(360deg);
|
||||
animation-timing-function: ease-in-out;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
#watermark-background {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
width: 100%;
|
||||
transition-property: opacity;
|
||||
transition-duration: ${this._fadeDuration}s;
|
||||
}
|
||||
|
||||
#watermark-link {
|
||||
all: unset;
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
|
||||
/* For Safari */
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
#watermark {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
transition-property: opacity;
|
||||
transition-duration: ${this._fadeDuration}s;
|
||||
transition-timing-function: ease-out;
|
||||
}
|
||||
|
||||
#watermark > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#watermark span {
|
||||
color: white;
|
||||
font-family: 'Tahoma', 'Gill sans', 'Helvetica', 'Arial';
|
||||
font-size: ${this._textFontSize}px;
|
||||
transition: opacity;
|
||||
transition-duration: ${this._fadeDuration}s;
|
||||
|
||||
/* For Safari */
|
||||
-webkit-transition: opacity;
|
||||
-webkit-transition-duration: ${this._fadeDuration}s;
|
||||
}
|
||||
|
||||
#watermark svg.spinning {
|
||||
animation-name: spin;
|
||||
animation-direction: normal;
|
||||
animation-duration: 5s;
|
||||
animation-iteration-count: 3;
|
||||
animation-delay: 1.5s;
|
||||
}
|
||||
|
||||
#watermark svg path {
|
||||
fill: white;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
#watermark span {
|
||||
text-decoration: underline;
|
||||
text-decoration-style: solid;
|
||||
text-decoration-color: transparent;
|
||||
}
|
||||
|
||||
#watermark:hover span {
|
||||
text-decoration-color: white;
|
||||
|
||||
/* For Safari */
|
||||
-webkit-text-decoration-color: white;
|
||||
}
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(styleElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -944,9 +944,6 @@ namespace gdjs {
|
||||
* @return the X position, on the scene, of the origin of the texture of the object.
|
||||
*/
|
||||
getDrawableX(): float {
|
||||
if (this._animationFrameDirty) {
|
||||
this._updateAnimationFrame();
|
||||
}
|
||||
if (this._animationFrame === null) {
|
||||
return this.x;
|
||||
}
|
||||
@@ -969,9 +966,6 @@ namespace gdjs {
|
||||
* @return the Y position, on the scene, of the origin of the texture of the object.
|
||||
*/
|
||||
getDrawableY(): float {
|
||||
if (this._animationFrameDirty) {
|
||||
this._updateAnimationFrame();
|
||||
}
|
||||
if (this._animationFrame === null) {
|
||||
return this.y;
|
||||
}
|
||||
|
2
GDJS/Runtime/types/global-types.d.ts
vendored
2
GDJS/Runtime/types/global-types.d.ts
vendored
@@ -21,8 +21,6 @@ declare type ObjectsLists = Hashtable<gdjs.RuntimeObject[]>;
|
||||
* if any. If the JavaScript code is running in a scene, this will be undefined (so you can't use this in a scene).
|
||||
*/
|
||||
declare type EventsFunctionContext = {
|
||||
task?: gdjs.ManuallyResolvableTask;
|
||||
|
||||
/** Get the list of instances of the specified object. */
|
||||
getObjects: (objectName: string) => Array<gdjs.RuntimeObject>;
|
||||
|
||||
|
14
GDJS/Runtime/types/project-data.d.ts
vendored
14
GDJS/Runtime/types/project-data.d.ts
vendored
@@ -181,8 +181,6 @@ declare interface ProjectPropertiesData {
|
||||
version: string;
|
||||
name: string;
|
||||
author: string;
|
||||
authorIds: string[];
|
||||
authorUsernames: string[];
|
||||
windowWidth: number;
|
||||
windowHeight: number;
|
||||
latestCompilationDirectory: string;
|
||||
@@ -190,7 +188,6 @@ declare interface ProjectPropertiesData {
|
||||
minFPS: number;
|
||||
verticalSync: boolean;
|
||||
loadingScreen: LoadingScreenData;
|
||||
watermark: WatermarkData;
|
||||
currentPlatform: string;
|
||||
extensionProperties: Array<ExtensionProperty>;
|
||||
useDeprecatedZeroAsDefaultZOrder?: boolean;
|
||||
@@ -203,17 +200,6 @@ declare interface ExtensionProperty {
|
||||
value: string;
|
||||
}
|
||||
|
||||
declare interface WatermarkData {
|
||||
showWatermark: boolean;
|
||||
placement:
|
||||
| 'top-left'
|
||||
| 'top-right'
|
||||
| 'bottom-left'
|
||||
| 'bottom-right'
|
||||
| 'bottom'
|
||||
| 'top';
|
||||
}
|
||||
|
||||
declare interface LoadingScreenData {
|
||||
showGDevelopSplash: boolean;
|
||||
backgroundImageResourceName: string;
|
||||
|
45
GDJS/package-lock.json
generated
45
GDJS/package-lock.json
generated
@@ -13,7 +13,6 @@
|
||||
"@types/expect.js": "^0.3.29",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^14.11.1",
|
||||
"@types/sinon": "^10.0.13",
|
||||
"better-docs": "^2.3.2",
|
||||
"esbuild": "^0.13.12",
|
||||
"lebab": "^3.1.0",
|
||||
@@ -767,21 +766,6 @@
|
||||
"integrity": "sha512-BfbIHP9IapdupGhq/hc+jT5dyiBVZ2DdeC5WwJWQWDb0GijQlzUFAeIQn/2GtvZcd2HVUU7An8felIICFTC2qg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/sinon": {
|
||||
"version": "10.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.13.tgz",
|
||||
"integrity": "sha512-UVjDqJblVNQYvVNUsj0PuYYw0ELRmgt1Nt5Vk0pT5f16ROGfcKJY8o1HVuMOJOpD727RrGB9EGvoaTQE5tgxZQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/sinonjs__fake-timers": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/sinonjs__fake-timers": {
|
||||
"version": "8.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz",
|
||||
"integrity": "sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@yarnpkg/lockfile": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz",
|
||||
@@ -789,9 +773,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.8.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
|
||||
"version": "8.7.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz",
|
||||
"integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
@@ -1133,7 +1117,7 @@
|
||||
"version": "2.6.11",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
||||
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
|
||||
"deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.",
|
||||
"deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.",
|
||||
"dev": true,
|
||||
"hasInstallScript": true
|
||||
},
|
||||
@@ -3813,21 +3797,6 @@
|
||||
"integrity": "sha512-BfbIHP9IapdupGhq/hc+jT5dyiBVZ2DdeC5WwJWQWDb0GijQlzUFAeIQn/2GtvZcd2HVUU7An8felIICFTC2qg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/sinon": {
|
||||
"version": "10.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.13.tgz",
|
||||
"integrity": "sha512-UVjDqJblVNQYvVNUsj0PuYYw0ELRmgt1Nt5Vk0pT5f16ROGfcKJY8o1HVuMOJOpD727RrGB9EGvoaTQE5tgxZQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/sinonjs__fake-timers": "*"
|
||||
}
|
||||
},
|
||||
"@types/sinonjs__fake-timers": {
|
||||
"version": "8.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz",
|
||||
"integrity": "sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA==",
|
||||
"dev": true
|
||||
},
|
||||
"@yarnpkg/lockfile": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz",
|
||||
@@ -3835,9 +3804,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"acorn": {
|
||||
"version": "8.8.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
|
||||
"version": "8.7.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz",
|
||||
"integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
|
@@ -9,7 +9,6 @@
|
||||
"@types/expect.js": "^0.3.29",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^14.11.1",
|
||||
"@types/sinon": "^10.0.13",
|
||||
"better-docs": "^2.3.2",
|
||||
"esbuild": "^0.13.12",
|
||||
"lebab": "^3.1.0",
|
||||
|
@@ -1,18 +1,23 @@
|
||||
// @ts-check
|
||||
|
||||
describe('gdjs.Layer', function() {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
var runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: { resources: [] },
|
||||
// @ts-expect-error ts-migrate(2740) FIXME: Type '{ windowWidth: number; windowHeight: number;... Remove this comment to see the full error message
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
|
||||
it('benchmark convertCoords and convertInverseCoords', function() {
|
||||
this.timeout(30000);
|
||||
var layer = new gdjs.RuntimeSceneLayer(
|
||||
{ name: 'My layer',
|
||||
visibility: true,
|
||||
effects: [],
|
||||
cameras: [],
|
||||
isLightingLayer: false,
|
||||
followBaseLayerCamera: false,
|
||||
{ name: 'My layer',
|
||||
visibility: true,
|
||||
effects: [],
|
||||
cameras: [],
|
||||
isLightingLayer: false,
|
||||
followBaseLayerCamera: false,
|
||||
ambientLightColorR: 128,
|
||||
ambientLightColorG: 128,
|
||||
ambientLightColorB: 128,
|
||||
|
@@ -1,7 +1,12 @@
|
||||
// @ts-check
|
||||
|
||||
describe('gdjs.SpriteRuntimeObject', function () {
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
var runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-expect-error ts-migrate(2740) FIXME: Type '{ windowWidth: number; windowHeight: number;... Remove this comment to see the full error message
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
|
||||
const makeSpriteRuntimeObjectWithCustomHitBox = (runtimeScene) =>
|
||||
|
@@ -32,8 +32,6 @@
|
||||
"loadingScreen": {
|
||||
"showGDevelopSplash": true
|
||||
},
|
||||
"authorIds": [],
|
||||
"authorUsernames": [],
|
||||
"extensions": [
|
||||
{
|
||||
"name": "BuiltinObject"
|
||||
|
@@ -30,8 +30,6 @@
|
||||
"showGDevelopSplash": true
|
||||
},
|
||||
"extensionProperties": [],
|
||||
"authorIds": [],
|
||||
"authorUsernames": [],
|
||||
"extensions": [
|
||||
{
|
||||
"name": "BuiltinObject"
|
||||
|
@@ -32,8 +32,6 @@
|
||||
"loadingScreen": {
|
||||
"showGDevelopSplash": true
|
||||
},
|
||||
"authorIds": [],
|
||||
"authorUsernames": [],
|
||||
"extensions": [
|
||||
{
|
||||
"name": "BuiltinObject"
|
||||
|
@@ -32,8 +32,6 @@
|
||||
"loadingScreen": {
|
||||
"showGDevelopSplash": true
|
||||
},
|
||||
"authorIds": [],
|
||||
"authorUsernames": [],
|
||||
"extensions": [
|
||||
{
|
||||
"name": "BuiltinObject"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user