diff --git a/extensions/community/FloatingText.json b/extensions/community/FloatingText.json new file mode 100644 index 000000000..a7b3aa305 --- /dev/null +++ b/extensions/community/FloatingText.json @@ -0,0 +1,1581 @@ +{ + "author": "", + "category": "User interface", + "extensionNamespace": "", + "fullName": "Floating text", + "gdevelopVersion": ">=5.5.230", + "helpPath": "", + "iconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Text Editing/Text Editing_text_color_colour.svg", + "name": "FloatingText", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Text Editing/Text Editing_text_color_colour.svg", + "shortDescription": "A 2D text that moves and fades out, then disappears: damage numbers, \"+10 coins\", \"Perfect!\"... For 2D games.", + "dimension": "2D", + "version": "1.0.0", + "description": [ + "A 2D text (with an optional icon) that moves and fades out, then disappears: damage numbers, healing, \"+10 coins\", experience, \"Perfect!\", \"Game saved\"...", + "", + "It is made for **2D games**: it is a 2D object, placed and moving in the 2D scene. It does not work in 3D: it can not be placed in the 3D world or follow a 3D object.", + "", + "Create it where the text must appear (its position is its center) and change its text with the action \"Text\": it plays by itself and is deleted at the end. Its motion (rise, arc to a side, pop or stay), distance and duration are properties.", + "", + "Ready-to-use floating texts are in the asset store [floating texts pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=floating-texts-floating-texts)." + ], + "origin": { + "identifier": "FloatingText", + "name": "gdevelop-extension-store" + }, + "tags": [ + "floating text", + "damage", + "number", + "popup", + "score", + "feedback", + "juice", + "ui" + ], + "authorIds": [ + "R0F5QGNCzgOY5w2cxGeKJOq2UaD2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [ + { + "areaMaxX": 120.0, + "areaMaxY": 30.0, + "areaMaxZ": 64, + "areaMinX": -120.0, + "areaMinY": -30.0, + "areaMinZ": 0, + "assetStoreTag": "floating texts", + "defaultName": "FloatingText", + "description": "A 2D text (with an optional icon) that moves and fades out, then disappears: damage numbers, \"+10 coins\", \"Perfect!\"... For 2D games: it moves in the 2D scene, not in 3D.", + "fullName": "Floating text", + "isInnerAreaFollowingParentSize": false, + "isUsingLegacyInstancesRenderer": false, + "name": "FloatingText", + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "-12", + "font": "", + "textAlignment": "left", + "characterSize": 32, + "color": { + "r": 0, + "g": 0, + "b": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "-12", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "center", + "characterSize": 32, + "lineHeight": 0, + "color": "255;80;80" + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "Text", + "persistentUuid": "bd417c34-17ea-4cfe-8247-314c674be8dc", + "width": 0, + "x": -30, + "y": 0, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "propertyDescriptors": [ + { + "value": "-12", + "type": "String", + "label": "Text", + "name": "DisplayedText" + }, + { + "value": "Rise", + "type": "Choice", + "label": "Motion", + "name": "Motion", + "description": "Rise: goes up. Arc: jumps to a side, like a damage number. Pop: grows quickly then goes up a little. Stay: does not move.", + "choices": [ + { + "label": "Rise", + "value": "Rise" + }, + { + "label": "Arc", + "value": "Arc" + }, + { + "label": "Pop", + "value": "Pop" + }, + { + "label": "Stay", + "value": "Stay" + } + ] + }, + { + "value": "50", + "type": "Number", + "label": "Distance", + "name": "Distance", + "description": "How far the text goes.", + "unit": "Pixel" + }, + { + "value": "1", + "type": "Number", + "label": "Duration", + "name": "Duration", + "description": "How long the text is shown. It fades out at the end.", + "unit": "Second" + }, + { + "value": "true", + "type": "Boolean", + "label": "Delete when finished", + "name": "ShouldDeleteWhenFinished", + "description": "Delete the text when it disappeared. Otherwise, it stays hidden and can be played again with the action \"Play\"." + }, + { + "value": "true", + "type": "Boolean", + "label": "Play when created", + "name": "ShouldPlayOnCreation" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "Elapsed", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "BaseX", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "BaseY", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "ArcDirection", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "Progress", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "PopScale", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "IconWidth", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "TotalWidth", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "", + "type": "Boolean", + "label": "", + "name": "HasBase", + "hidden": true + }, + { + "value": "", + "type": "Boolean", + "label": "", + "name": "IsPlaying", + "hidden": true + }, + { + "value": "", + "type": "Boolean", + "label": "", + "name": "IsFinished", + "hidden": true + } + ], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The text (and the icon before it) are centered on the position of the object." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "DisplayedText" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneInstancesCount" + }, + "parameters": [ + "", + "Icon", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "Icon.Width() + 6" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TotalWidth", + "=", + "IconWidth + Text.Width()" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Text", + "=", + "-TotalWidth / 2 + IconWidth", + "=", + "0" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Icon", + "=", + "-TotalWidth / 2 + (IconWidth - 6) / 2", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "In the scene editor, the text stays visible to be placed and styled." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "FloatingText::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldPlayOnCreation", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "FloatingText::FloatingText::Play" + }, + "parameters": [ + "Object", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "FloatingText::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldPlayOnCreation", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Object" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onHotReloading", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The text (and the icon before it) are centered on the position of the object." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "DisplayedText" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneInstancesCount" + }, + "parameters": [ + "", + "Icon", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "Icon.Width() + 6" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TotalWidth", + "=", + "IconWidth + Text.Width()" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Text", + "=", + "-TotalWidth / 2 + IconWidth", + "=", + "0" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Icon", + "=", + "-TotalWidth / 2 + (IconWidth - 6) / 2", + "=", + "0" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The width of a text is known after it is changed: the layout is updated at every frame." + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The text (and the icon before it) are centered on the position of the object." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "DisplayedText" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneInstancesCount" + }, + "parameters": [ + "", + "Icon", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "Icon.Width() + 6" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TotalWidth", + "=", + "IconWidth + Text.Width()" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Text", + "=", + "-TotalWidth / 2 + IconWidth", + "=", + "0" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Icon", + "=", + "-TotalWidth / 2 + (IconWidth - 6) / 2", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsPlaying", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The position is read at the first step: when the text is created, its position is set after it is created." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "HasBase", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "BaseX", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "BaseY", + "=", + "Object.Y()" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "HasBase", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Elapsed", + "+", + "TimeDelta()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Progress", + "=", + "clamp(Elapsed / max(0.01, Duration), 0, 1)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Motion", + "=", + "\"Rise\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Object", + "=", + "BaseX", + "=", + "BaseY - Distance * (1 - pow(1 - Progress, 3))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Motion", + "=", + "\"Arc\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Object", + "=", + "BaseX + ArcDirection * Distance * 0.6 * Progress", + "=", + "BaseY - Distance * 4 * Progress * (1 - Progress) + Distance * 0.3 * Progress * Progress" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Motion", + "=", + "\"Pop\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Object", + "=", + "BaseX", + "=", + "BaseY - Distance * 0.3 * Progress" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "It grows to 125% then comes back to 100%." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Progress", + "<", + "0.12" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PopScale", + "=", + "lerp(0.4, 1.25, Progress / 0.12)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Progress", + ">=", + "0.12" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PopScale", + "=", + "lerp(1.25, 1, clamp((Progress - 0.12) / 0.13, 0, 1))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScalableCapability::ScalableBehavior::SetValue" + }, + "parameters": [ + "Object", + "Scale", + "=", + "PopScale" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Motion", + "=", + "\"Stay\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Object", + "=", + "BaseX", + "=", + "BaseY" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "It fades out during the last 40% of its duration." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "OpacityCapability::OpacityBehavior::SetValue" + }, + "parameters": [ + "Object", + "Opacity", + "=", + "255 * (1 - clamp((Progress - 0.6) / 0.4, 0, 1))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Progress", + ">=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsPlaying", + "False", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsFinished", + "True", + "" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Object", + "=", + "BaseX", + "=", + "BaseY" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldDeleteWhenFinished", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Delete" + }, + "parameters": [ + "Object", + "" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "Play", + "functionType": "Action", + "name": "Play", + "sentence": "Play _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Elapsed", + "=", + "0" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsPlaying", + "True", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsFinished", + "False", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "HasBase", + "False", + "" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ArcDirection", + "=", + "RandomWithStep(-1, 1, 2)" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [], + "description": "Show the text and play its motion from the start (it is played when it is created)." + }, + { + "fullName": "Text", + "functionType": "ExpressionAndCondition", + "name": "Text", + "sentence": "the text", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "DisplayedText" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [], + "description": "the text.", + "expressionType": { + "type": "string" + } + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "name": "SetText", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "DisplayedText", + "=", + "Value" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The text (and the icon before it) are centered on the position of the object." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "DisplayedText" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneInstancesCount" + }, + "parameters": [ + "", + "Icon", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IconWidth", + "=", + "Icon.Width() + 6" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TotalWidth", + "=", + "IconWidth + Text.Width()" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Text", + "=", + "-TotalWidth / 2 + IconWidth", + "=", + "0" + ] + }, + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Icon", + "=", + "-TotalWidth / 2 + (IconWidth - 6) / 2", + "=", + "0" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [], + "getterName": "Text" + }, + { + "fullName": "Is playing", + "functionType": "Condition", + "name": "IsPlaying", + "sentence": "_PARAM0_ is playing", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsPlaying", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [], + "description": "Check if the text is shown and moving." + }, + { + "fullName": "Is finished", + "functionType": "Condition", + "name": "IsFinished", + "sentence": "_PARAM0_ is finished", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsFinished", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "FloatingText::FloatingText", + "type": "object" + } + ], + "objectGroups": [], + "description": "Check if the text disappeared (when it is not deleted when finished)." + } + ] + } + ] +} \ No newline at end of file diff --git a/extensions/community/Toast.json b/extensions/community/Toast.json index 9a8c50d22..6392425c5 100644 --- a/extensions/community/Toast.json +++ b/extensions/community/Toast.json @@ -9,7 +9,7 @@ "name": "Toast", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/UI Essentials/UI Essentials_notification_alarm_bell.svg", "shortDescription": "A notification shown for a few seconds, with an icon, a title and a message (info, success, warning, error).", - "version": "1.0.2", + "version": "1.0.3", "description": [ "A toast is a small notification that appears for a few seconds without stopping the game: an achievement unlocked, an item found, a game saved, an error...", "", @@ -326,7 +326,7 @@ "height": 96, "layer": "", "name": "Panel", - "persistentUuid": "bf61210c-00ae-4823-b0e7-0cb7626cc5ad", + "persistentUuid": "f5f732e4-71bb-4c49-b9d8-b9df1f19635e", "width": 380, "x": 0, "y": 0, @@ -341,7 +341,7 @@ "height": 48, "layer": "", "name": "Icon", - "persistentUuid": "6c9b4cd6-07d3-4173-b96b-e63227ae0ac4", + "persistentUuid": "b6c1fe26-8289-4ba9-82b3-0f7d515f1346", "width": 48, "x": 48, "y": 48.0, @@ -356,7 +356,7 @@ "height": 32, "layer": "", "name": "Title", - "persistentUuid": "b8f97b90-4596-431e-8238-f9a7e65f3a57", + "persistentUuid": "2fc15a59-ac19-4402-8205-aaa29edf4e82", "width": 276, "x": 88, "y": 32, @@ -371,7 +371,7 @@ "height": 32, "layer": "", "name": "Message", - "persistentUuid": "54c4ad94-d3d3-43cb-aaa6-7944183be975", + "persistentUuid": "97f9999b-e246-4227-b673-e2e50990ab6f", "width": 276, "x": 88, "y": 64, @@ -454,17 +454,10 @@ "value": "0", "type": "Number", "label": "", - "name": "RestY", + "name": "SlideOffset", "hidden": true, "unit": "Dimensionless" }, - { - "value": "", - "type": "Boolean", - "label": "", - "name": "ShouldReadRestY", - "hidden": true - }, { "value": "", "type": "Boolean", @@ -902,43 +895,6 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldReadRestY", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "RestY", - "=", - "Object.Y()" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldReadRestY", - "False", - "" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -970,8 +926,18 @@ }, "parameters": [ "Object", + "-", + "(SlideDistance * (1 - Progress) * (1 - Progress)) - SlideOffset" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "SlideOffset", "=", - "RestY - SlideDistance * (1 - Progress) * (1 - Progress)" + "SlideDistance * (1 - Progress) * (1 - Progress)" ] } ], @@ -1092,8 +1058,18 @@ }, "parameters": [ "Object", + "-", + "(SlideDistance * Progress * Progress) - SlideOffset" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "SlideOffset", "=", - "RestY - SlideDistance * Progress * Progress" + "SlideDistance * Progress * Progress" ] } ], @@ -1129,8 +1105,18 @@ }, "parameters": [ "Object", + "-", + "(0) - SlideOffset" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "SlideOffset", "=", - "RestY" + "0" ] }, { @@ -1509,18 +1495,6 @@ "name": "Show", "sentence": "Show _PARAM0_", "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "The position is read at the next step: when the toast is shown at its creation, its position is not set yet." - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -1535,18 +1509,7 @@ ] } ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldReadRestY", - "True", - "" - ] - } - ], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1804,6 +1767,75 @@ "objectGroups": [], "description": "Hide the toast with an animation." }, + { + "fullName": "Display duration", + "functionType": "ExpressionAndCondition", + "name": "DisplayDuration", + "sentence": "the display duration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DisplayDuration" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Toast::Toast", + "type": "object" + } + ], + "objectGroups": [], + "description": "how long the toast stays visible (in seconds, 0 to keep it until it is hidden with an action).", + "expressionType": { + "type": "number" + } + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "name": "SetDisplayDuration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DisplayDuration", + "=", + "max(0, Value)" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Toast::Toast", + "type": "object" + } + ], + "objectGroups": [], + "getterName": "DisplayDuration" + }, { "fullName": "Is shown", "functionType": "Condition", diff --git a/extensions/community/ToastStack.json b/extensions/community/ToastStack.json new file mode 100644 index 000000000..ab91d71c8 --- /dev/null +++ b/extensions/community/ToastStack.json @@ -0,0 +1,2139 @@ +{ + "author": "", + "category": "User interface", + "extensionNamespace": "", + "fullName": "Toast stack", + "gdevelopVersion": ">=5.5.230", + "helpPath": "", + "iconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Communication/Communication_chat_message_sms_bell_ring_notification.svg", + "name": "ToastStack", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Communication/Communication_chat_message_sms_bell_ring_notification.svg", + "shortDescription": "Several toast notifications shown at the same time, the next ones waiting for a place.", + "version": "1.0.0", + "description": [ + "Show several toast notifications at the same time: achievements, items found, messages... Use the action \"Show a toast\" as many times as needed:", + "- up to the maximum number of toasts, they are shown one after the other (down or up),", + "- then the new ones wait for a place, replace the oldest toast, or are not shown (the \"When full\" property),", + "- when a toast disappears, the other ones slide to fill its place.", + "", + "Use a maximum of 1 to show only one toast at a time. \"Hide all the toasts\" hides them all.", + "", + "The toast inside the stack gives the position and the style of every toast: edit the variant to change it.", + "", + "Ready-to-use toast stacks are in the asset store [toast stacks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=toast-stacks-toast-stacks)." + ], + "origin": { + "identifier": "ToastStack", + "name": "gdevelop-extension-store" + }, + "tags": [ + "toast", + "notification", + "stack", + "queue", + "achievement", + "message", + "ui" + ], + "authorIds": [ + "R0F5QGNCzgOY5w2cxGeKJOq2UaD2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [ + { + "areaMaxX": 380, + "areaMaxY": 308, + "areaMaxZ": 64, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreTag": "toast stacks", + "defaultName": "ToastStack", + "description": "Several toast notifications shown at the same time (up to a maximum), the next ones waiting for a place.", + "fullName": "Toast stack", + "isInnerAreaFollowingParentSize": false, + "isUsingLegacyInstancesRenderer": false, + "name": "ToastStack", + "objects": [ + { + "assetStoreId": "", + "name": "Toast", + "type": "Toast::Toast", + "variant": "", + "variables": [ + { + "name": "Order", + "type": "number", + "value": 0 + }, + { + "name": "IsWaiting", + "type": "boolean", + "value": false + }, + { + "name": "HasBeenShown", + "type": "boolean", + "value": false + }, + { + "name": "Title", + "type": "string", + "value": "" + }, + { + "name": "Message", + "type": "string", + "value": "" + }, + { + "name": "Kind", + "type": "string", + "value": "Info" + }, + { + "name": "SlotY", + "type": "number", + "value": 0 + }, + { + "name": "Rank", + "type": "number", + "value": 0 + }, + { + "name": "IsLeaving", + "type": "boolean", + "value": false + } + ], + "effects": [], + "behaviors": [], + "content": { + "ShouldShowOnCreation": false + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Toast" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "height": 96, + "layer": "", + "name": "Toast", + "persistentUuid": "70a6d4c1-c862-4efd-a709-27f1388d5589", + "width": 380, + "x": 0, + "y": 0, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "propertyDescriptors": [ + { + "value": "3", + "type": "Number", + "label": "Maximum toasts shown", + "name": "MaxShownCount", + "description": "How many toasts can be shown at the same time. The other ones wait (or replace the oldest, see \"When full\").", + "unit": "Dimensionless" + }, + { + "value": "Down", + "type": "Choice", + "label": "Direction", + "name": "Direction", + "description": "Down: a new toast is shown at the position of the toast of the stack, and pushes the older ones down. Up: it pushes them up.", + "choices": [ + { + "label": "Down", + "value": "Down" + }, + { + "label": "Up", + "value": "Up" + } + ] + }, + { + "value": "Wait", + "type": "Choice", + "label": "When full", + "name": "WhenFull", + "description": "What happens to a new toast when the maximum is reached: it waits for a place, it replaces the oldest toast, or it is not shown.", + "choices": [ + { + "label": "Wait", + "value": "Wait" + }, + { + "label": "Replace the oldest", + "value": "Replace the oldest" + }, + { + "label": "Ignore the new one", + "value": "Ignore the new one" + } + ] + }, + { + "value": "10", + "type": "Number", + "label": "Spacing", + "name": "Spacing", + "description": "The space between two toasts.", + "unit": "Pixel" + }, + { + "value": "3", + "type": "Number", + "label": "Display duration", + "name": "DisplayDuration", + "description": "How long each toast stays visible. 0 to keep them until they are hidden with an action.", + "unit": "Second" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "ModelX", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "ModelY", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "ModelHeight", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "NextOrder", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "LowestOrder", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "Order", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "Rank", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "ShownCount", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "WaitingCount", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "OldestOrder", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "Iterations", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "0", + "type": "Number", + "label": "", + "name": "DirectionSign", + "hidden": true, + "unit": "Dimensionless" + }, + { + "value": "", + "type": "Boolean", + "label": "", + "name": "HasModel", + "hidden": true + } + ], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The toast of the stack is the model of every toast: its position and its size." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneInstancesCount" + }, + "parameters": [ + "", + "Toast", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "HasModel", + "True", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ModelX", + "=", + "Toast.X()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ModelY", + "=", + "Toast.Y()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ModelHeight", + "=", + "Toast.Height()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "In the scene editor, the model stays visible to be placed and styled." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "ToastStack::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Delete" + }, + "parameters": [ + "Toast", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "ToastStack::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DirectionSign", + "=", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Direction", + "=", + "\"Up\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DirectionSign", + "=", + "-1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "A toast that disappeared is deleted." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "HasBeenShown", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "Toast::Toast::IsShown" + }, + "parameters": [ + "Toast", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Delete" + }, + "parameters": [ + "Toast", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "=", + "0" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "+", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "+", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The oldest waiting toast is shown when there is a place." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ShownCount", + "<", + "MaxShownCount" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "WaitingCount", + ">", + "0" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OldestOrder", + "=", + "NextOrder" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "Toast.Variable(Order)", + "<", + "OldestOrder" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OldestOrder", + "=", + "Toast.Variable(Order)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + }, + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "Toast", + "Order", + "=", + "OldestOrder" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "Toast", + "SlotY", + "=", + "ModelY" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Toast", + "=", + "ModelY" + ] + }, + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "Toast", + "HasBeenShown", + "True", + "" + ] + }, + { + "type": { + "value": "Toast::Toast::SetDisplayDuration" + }, + "parameters": [ + "Toast", + "=", + "DisplayDuration", + "" + ] + }, + { + "type": { + "value": "Toast::Toast::ShowToast" + }, + "parameters": [ + "Toast", + "Toast.VariableString(Title)", + "Toast.VariableString(Message)", + "Toast.VariableString(Kind)", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Each shown toast goes to its place: the newest one at the position of the model, the older ones after it. The orders are checked from the newest to the oldest." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Order", + "=", + "NextOrder - 1" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Rank", + "=", + "0" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Iterations", + "=", + "NextOrder - LowestOrder" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "LowestOrder", + "=", + "NextOrder" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "Iterations", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "Toast", + "Order", + "=", + "Order" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "LowestOrder", + "=", + "Order" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "Toast", + "Order", + "=", + "Order" + ] + }, + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "Toast", + "Rank", + "=", + "Rank" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Rank", + "+", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Order", + "-", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The toasts slide to their place. They are moved by the change of their place, so that their own animation still works." + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Toast", + "+", + "(ModelY + Toast.Variable(Rank) * (ModelHeight + Spacing) * DirectionSign - Toast.Variable(SlotY)) * min(1, 12 * TimeDelta())" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "Toast", + "SlotY", + "+", + "(ModelY + Toast.Variable(Rank) * (ModelHeight + Spacing) * DirectionSign - Toast.Variable(SlotY)) * min(1, 12 * TimeDelta())" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "Show a toast", + "functionType": "Action", + "name": "ShowToast", + "sentence": "Show the toast _PARAM1_: _PARAM2_ (_PARAM3_) with _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "=", + "0" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "+", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "+", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "When full, the new toast waits (hidden), replaces the oldest toast, or is not shown." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ShownCount", + ">=", + "MaxShownCount" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "WhenFull", + "=", + "\"Replace the oldest\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ToastStack::ToastStack::HideOldest" + }, + "parameters": [ + "Object", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ShownCount", + "<", + "MaxShownCount" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "WhenFull", + "!=", + "\"Ignore the new one\"" + ] + } + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "Toast", + "ModelX", + "ModelY", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "Toast", + "Order", + "=", + "NextOrder" + ] + }, + { + "type": { + "value": "SetStringObjectVariable" + }, + "parameters": [ + "Toast", + "Title", + "=", + "NewTitle" + ] + }, + { + "type": { + "value": "SetStringObjectVariable" + }, + "parameters": [ + "Toast", + "Message", + "=", + "NewMessage" + ] + }, + { + "type": { + "value": "SetStringObjectVariable" + }, + "parameters": [ + "Toast", + "Kind", + "=", + "NewKind" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "Toast", + "SlotY", + "=", + "ModelY" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NextOrder", + "+", + "1" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The new toast is shown now if there is a place (or if it replaces the oldest one), else it waits." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ShownCount", + "<", + "MaxShownCount" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "WhenFull", + "=", + "\"Replace the oldest\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + }, + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "Toast", + "HasBeenShown", + "True", + "" + ] + }, + { + "type": { + "value": "Toast::Toast::SetDisplayDuration" + }, + "parameters": [ + "Toast", + "=", + "DisplayDuration", + "" + ] + }, + { + "type": { + "value": "Toast::Toast::ShowToast" + }, + "parameters": [ + "Toast", + "Toast.VariableString(Title)", + "Toast.VariableString(Message)", + "Toast.VariableString(Kind)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ShownCount", + ">=", + "MaxShownCount" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "WhenFull", + "=", + "\"Wait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + }, + { + "description": "Title (can be empty)", + "name": "NewTitle", + "type": "string" + }, + { + "description": "Message (can be empty)", + "name": "NewMessage", + "type": "string" + }, + { + "description": "Kind", + "name": "NewKind", + "type": "stringWithSelector", + "supplementaryInformation": "[\"Info\",\"Success\",\"Warning\",\"Error\"]" + } + ], + "objectGroups": [], + "description": "Show a toast with a title, a message and a kind (which changes the icon). It is added to the toasts already shown, up to the maximum (then it waits, replaces the oldest toast or is not shown, see \"When full\")." + }, + { + "fullName": "Hide the oldest toast", + "functionType": "Action", + "name": "HideOldest", + "sentence": "Hide the oldest toast of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OldestOrder", + "=", + "NextOrder" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + }, + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsLeaving", + "False", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "Toast.Variable(Order)", + "<", + "OldestOrder" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OldestOrder", + "=", + "Toast.Variable(Order)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + }, + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "Toast", + "Order", + "=", + "OldestOrder" + ] + } + ], + "actions": [ + { + "type": { + "value": "Toast::Toast::Hide" + }, + "parameters": [ + "Toast", + "" + ] + }, + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsLeaving", + "True", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + } + ], + "objectGroups": [], + "description": "Hide the oldest toast shown (the next waiting toast takes its place)." + }, + { + "fullName": "Hide all the toasts", + "functionType": "Action", + "name": "HideAll", + "sentence": "Hide all the toasts of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Delete" + }, + "parameters": [ + "Toast", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Toast::Toast::Hide" + }, + "parameters": [ + "Toast", + "" + ] + }, + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsLeaving", + "True", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + } + ], + "objectGroups": [], + "description": "Hide all the toasts shown, and forget the waiting ones." + }, + { + "fullName": "Number of toasts shown", + "functionType": "ExpressionAndCondition", + "name": "ShownToastCount", + "sentence": "the number of toasts shown", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "=", + "0" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "+", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "+", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ShownCount" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + } + ], + "objectGroups": [], + "description": "the number of toasts shown (including the ones appearing or disappearing).", + "expressionType": { + "type": "number" + } + }, + { + "fullName": "Number of waiting toasts", + "functionType": "ExpressionAndCondition", + "name": "WaitingToastCount", + "sentence": "the number of waiting toasts", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "=", + "0" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "+", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "+", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "WaitingCount" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + } + ], + "objectGroups": [], + "description": "the number of toasts waiting for a place to be shown.", + "expressionType": { + "type": "number" + } + }, + { + "fullName": "Is any toast shown", + "functionType": "Condition", + "name": "IsAnyToastShown", + "sentence": "A toast of _PARAM0_ is shown", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "=", + "0" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "Toast", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ShownCount", + "+", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanObjectVariable" + }, + "parameters": [ + "Toast", + "IsWaiting", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "WaitingCount", + "+", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ShownCount", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ToastStack::ToastStack", + "type": "object" + } + ], + "objectGroups": [], + "description": "Check if at least one toast is shown." + } + ] + } + ], + "requiredExtensions": [ + { + "extensionName": "Toast", + "extensionVersion": "1.0.3" + } + ] +} \ No newline at end of file