diff --git a/extensions/reviewed/CollapsibleVolumeControl.json b/extensions/reviewed/CollapsibleVolumeControl.json new file mode 100644 index 000000000..28785bef4 --- /dev/null +++ b/extensions/reviewed/CollapsibleVolumeControl.json @@ -0,0 +1,1112 @@ +{ + "author": "", + "category": "User interface", + "extensionNamespace": "", + "fullName": "Volume settings", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZvbHVtZS1oaWdoIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTE0LDMuMjNWNS4yOUMxNi44OSw2LjE1IDE5LDguODMgMTksMTJDMTksMTUuMTcgMTYuODksMTcuODQgMTQsMTguN1YyMC43N0MxOCwxOS44NiAyMSwxNi4yOCAyMSwxMkMyMSw3LjcyIDE4LDQuMTQgMTQsMy4yM00xNi41LDEyQzE2LjUsMTAuMjMgMTUuNSw4LjcxIDE0LDcuOTdWMTZDMTUuNSwxNS4yOSAxNi41LDEzLjc2IDE2LjUsMTJNMyw5VjE1SDdMMTIsMjBWNEw3LDlIM1oiIC8+PC9zdmc+", + "name": "CollapsibleVolumeControl", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/7447548d05f2c067f0403c5eb2fcf1c36756dc7e9540a418e7f14040fa20ac6f_volume-high.svg", + "shortDescription": "A collapsible volume setting menu.", + "version": "1.0.0", + "description": "A collapsible volume setting menu. The main button can be pressed to open the collapsable menu, consisting of a volume slider and mute button.", + "tags": [ + "sound" + ], + "authorIds": [ + "9MGDlUQAh8QUilno4JPycekjRCJ3" + ], + "dependencies": [], + "globalVariables": [ + { + "name": "MasterVolume", + "type": "number", + "value": 100 + }, + { + "name": "IsMuted", + "type": "boolean", + "value": false + } + ], + "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();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [ + { + "areaMaxX": 400, + "areaMaxY": 64, + "areaMaxZ": 64, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreTag": "collapsible-volume-controls", + "defaultName": "VolumeSettings", + "description": "Collapsible volume setting menu.", + "fullName": "Volume settings", + "isInnerAreaFollowingParentSize": true, + "isUsingLegacyInstancesRenderer": false, + "name": "CollapsibleVolumeControl", + "objects": [ + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "OpeningButton", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "leftEdgeAnchor": 0, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "ButtonFSM", + "type": "ButtonStates::ButtonFSM", + "ShouldCheckHovering": true, + "State": "Idle", + "TouchId": 0, + "TouchIsInside": false, + "MouseIsInside": false, + "Index": 2.0247e-320 + }, + { + "name": "ButtonScaleTween", + "type": "ButtonStates::ButtonScaleTween", + "Scale": "Scale", + "ButtonFSM": "ButtonFSM", + "Tween": "Tween", + "IdleScale": 1, + "FocusedScale": 1.1, + "FadeInDuration": 0.02, + "FadeOutDuration": 0.05, + "PressedScale": 0.95, + "FadeInEasing": "bouncePast", + "FadeOutEasing": "easeOutQuad", + "PreviousState": "Idle" + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + }, + { + "assetStoreId": "", + "bottomMargin": 0, + "height": 64, + "leftMargin": 0, + "name": "Background", + "rightMargin": 0, + "texture": "", + "tiled": false, + "topMargin": 0, + "type": "PanelSpriteObject::PanelSprite", + "width": 400, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + }, + { + "name": "TweenIntoView", + "type": "TweenIntoView::TweenIntoView", + "TweenDirection": "Left", + "Duration": 0.25, + "Distance": 144, + "ShouldPlayAtCreation": false, + "PositionEasingIn": "easeOutQuint", + "PositionEasingOut": "easeOutQuad", + "ShouldBeDeleted": false, + "ShouldFade": true, + "Initialized": false, + "StartingX": 0, + "StartingY": 0, + "Opacity": "Opacity", + "Tween": "Tween", + "ShouldMove": false + } + ] + }, + { + "assetStoreId": "bfeeb465a4a164b560a2215e3ff9e78e66123af43cbf7ef1f22d56fca4271c80", + "name": "VolumeSlider", + "type": "PanelSpriteSlider::PanelSpriteSlider", + "variant": "", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + }, + { + "name": "TweenIntoView", + "type": "TweenIntoView::TweenIntoView", + "TweenDirection": "Left", + "Duration": 0.25, + "Distance": 144, + "ShouldPlayAtCreation": false, + "PositionEasingIn": "easeOutQuint", + "PositionEasingOut": "easeOutQuad", + "ShouldBeDeleted": false, + "ShouldFade": true, + "Initialized": false, + "StartingX": 0, + "StartingY": 0, + "Opacity": "Opacity", + "Tween": "Tween" + } + ], + "content": { + "BarTopPadding": 6, + "BarLeftPadding": 6, + "BarRightPadding": 6, + "BarBottomPadding": 6, + "LabelMargin": 6, + "ShowLabelAtChanges": false + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "MuteButton", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "leftEdgeAnchor": 0, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "ButtonFSM", + "type": "ButtonStates::ButtonFSM", + "ShouldCheckHovering": true, + "State": "Idle", + "TouchId": 0, + "TouchIsInside": false, + "MouseIsInside": false, + "Index": 2.0247e-320 + }, + { + "name": "ButtonScaleTween", + "type": "ButtonStates::ButtonScaleTween", + "Scale": "Scale", + "ButtonFSM": "ButtonFSM", + "Tween": "Tween", + "IdleScale": 1, + "FocusedScale": 1.1, + "FadeInDuration": 0.02, + "FadeOutDuration": 0.05, + "PressedScale": 0.95, + "FadeInEasing": "bouncePast", + "FadeOutEasing": "easeOutQuad", + "PreviousState": "Idle" + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + }, + { + "name": "TweenIntoView", + "type": "TweenIntoView::TweenIntoView", + "TweenDirection": "Left", + "Duration": 0.25, + "Distance": 96, + "ShouldPlayAtCreation": false, + "PositionEasingIn": "easeOutQuint", + "PositionEasingOut": "easeOutQuad", + "ShouldBeDeleted": false, + "ShouldFade": true, + "Initialized": false, + "StartingX": 0, + "StartingY": 0, + "Opacity": "Opacity", + "Tween": "Tween" + } + ], + "animations": [ + { + "name": "On", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + }, + { + "name": "Off", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "OpeningButton" + }, + { + "objectName": "Background" + }, + { + "objectName": "VolumeSlider" + }, + { + "objectName": "MuteButton" + } + ] + }, + "objectsGroups": [ + { + "name": "Content", + "objects": [ + { + "name": "VolumeSlider" + }, + { + "name": "MuteButton" + }, + { + "name": "Background" + } + ] + } + ], + "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, + "depth": 1, + "height": 64, + "keepRatio": true, + "layer": "", + "name": "OpeningButton", + "persistentUuid": "713c4573-9987-408b-904b-ec3a6bf41ee5", + "width": 64, + "x": 0, + "y": 0, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 64, + "keepRatio": true, + "layer": "", + "name": "MuteButton", + "persistentUuid": "ee5e2e4a-cf0e-4ce3-a1dd-06fabe1b0b7e", + "width": 64, + "x": 64, + "y": 0, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 64, + "height": 32, + "keepRatio": true, + "layer": "", + "name": "VolumeSlider", + "persistentUuid": "eb4ad3ed-6518-42b9-9d33-657fede80252", + "width": 224, + "x": 144, + "y": 16, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 64, + "keepRatio": true, + "layer": "", + "name": "Background", + "persistentUuid": "e80bae6e-13ec-4d1a-b97e-df39a3ad8c08", + "width": 400, + "x": 0, + "y": 0, + "zOrder": 0, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "editionSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 16, + "gridHeight": 16, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.3, + "snap": true, + "zoomFactor": 2.2609999999999997, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "CollapsibleVolumeControl::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Content" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::Activate" + }, + "parameters": [ + "VolumeSlider", + "", + "" + ] + }, + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "MuteButton", + "ButtonFSM", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "CollapsibleVolumeControl::CollapsibleVolumeControl", + "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": "Opening settings menu" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsClicked" + }, + "parameters": [ + "OpeningButton", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsOpen", + "Toggle", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsOpen", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "CollapsibleVolumeControl::CollapsibleVolumeControl::TweenOpen" + }, + "parameters": [ + "Object", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsOpen", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "CollapsibleVolumeControl::CollapsibleVolumeControl::TweenClose" + }, + "parameters": [ + "Object", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Mute game" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsClicked" + }, + "parameters": [ + "MuteButton", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsMuted", + "Toggle", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsMuted", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetGlobalVolume" + }, + "parameters": [ + "", + "=", + "0" + ] + }, + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::SetName" + }, + "parameters": [ + "MuteButton", + "Animation", + "=", + "\"Off\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsMuted", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetGlobalVolume" + }, + "parameters": [ + "", + "=", + "MasterVolume" + ] + }, + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::SetName" + }, + "parameters": [ + "MuteButton", + "Animation", + "=", + "\"On\"" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Change global volume" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::IsBeingDragged" + }, + "parameters": [ + "VolumeSlider", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "MasterVolume", + "=", + "VolumeSlider.Value()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsMuted", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetGlobalVolume" + }, + "parameters": [ + "", + "=", + "MasterVolume" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Handle GlobalVolume changes done in the main events." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsMuted", + "True", + "" + ] + }, + { + "type": { + "value": "GlobalVolume" + }, + "parameters": [ + "", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsMuted", + "False", + "" + ] + }, + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::SetName" + }, + "parameters": [ + "MuteButton", + "Animation", + "=", + "\"On\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsMuted", + "False", + "" + ] + }, + { + "type": { + "value": "GlobalVolume" + }, + "parameters": [ + "", + "!=", + "MasterVolume" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "MasterVolume", + "=", + "GlobalVolume()" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" + }, + "parameters": [ + "VolumeSlider", + "=", + "MasterVolume", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "CollapsibleVolumeControl::CollapsibleVolumeControl", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Show the volum controls.", + "fullName": "Open volum controls", + "functionType": "Action", + "name": "TweenOpen", + "sentence": "Open _PARAM0_ volum controls", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Show" + }, + "parameters": [ + "Content", + "" + ] + }, + { + "type": { + "value": "TweenIntoView::TweenIntoView::TweenIn" + }, + "parameters": [ + "Content", + "TweenIntoView", + "" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::Activate" + }, + "parameters": [ + "VolumeSlider", + "yes", + "" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" + }, + "parameters": [ + "VolumeSlider", + "=", + "MasterVolume", + "" + ] + }, + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "MuteButton", + "ButtonFSM", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "CollapsibleVolumeControl::CollapsibleVolumeControl", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Hide the volum controls.", + "fullName": "Close volum controls", + "functionType": "Action", + "name": "TweenClose", + "sentence": "Close _PARAM0_ volum controls", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TweenIntoView::TweenIntoView::TweenOut" + }, + "parameters": [ + "Content", + "TweenIntoView", + "" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::Activate" + }, + "parameters": [ + "VolumeSlider", + "", + "" + ] + }, + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "MuteButton", + "ButtonFSM", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "CollapsibleVolumeControl::CollapsibleVolumeControl", + "type": "object" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "IsOpen" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "IsOpen" + } + ] + } + } + ], + "requiredExtensions": [ + { + "extensionName": "ButtonStates", + "extensionVersion": "1.4.1" + }, + { + "extensionName": "PanelSpriteSlider", + "extensionVersion": "2.0.1" + }, + { + "extensionName": "TweenIntoView", + "extensionVersion": "1.0.0" + } + ] +} \ No newline at end of file