diff --git a/extensions/community/ScreenOrientationLock.json b/extensions/community/ScreenOrientationLock.json new file mode 100644 index 000000000..0431e872e --- /dev/null +++ b/extensions/community/ScreenOrientationLock.json @@ -0,0 +1,1130 @@ +{ + "author": "", + "category": "Camera", + "extensionNamespace": "", + "fullName": "Screen Orientation Lock", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggZD0iTTI3LDE0SDVjLTAuNCwwLTAuNywwLjEtMSwwLjJWOGgxMnY0YzAsMC42LDAuNCwxLDEsMXMxLTAuNCwxLTFWNWMwLTEuNy0xLjMtMy0zLTNINUMzLjMsMiwyLDMuMywyLDV2MTJ2MTANCgljMCwxLjcsMS4zLDMsMywzaDIyYzEuNywwLDMtMS4zLDMtM1YxN0MzMCwxNS4zLDI4LjcsMTQsMjcsMTR6IE03LDIzYzAsMC42LTAuNCwxLTEsMXMtMS0wLjQtMS0xdi0yYzAtMC42LDAuNC0xLDEtMXMxLDAuNCwxLDFWMjN6DQoJIE0yNCwyOEgxMFYxNmgxNFYyOHoiLz4NCjxwYXRoIGQ9Ik0xOS45LDUuMUMyMi44LDUuNSwyNSw4LDI1LDExYzAsMC40LDAuMywwLjgsMC43LDAuOWMwLjEsMCwwLjIsMC4xLDAuMywwLjFjMC4zLDAsMC42LTAuMSwwLjgtMC40bDMtNA0KCWMwLjMtMC40LDAuMi0xLjEtMC4yLTEuNGMtMC40LTAuMy0xLjEtMC4yLTEuNCwwLjJsLTEuNiwyLjFjLTAuOS0yLjgtMy40LTUtNi40LTUuNEMxOS42LDMsMTkuMSwzLjQsMTksMy45QzE5LDQuNSwxOS4zLDUsMTkuOSw1LjENCgl6Ii8+DQo8L3N2Zz4NCg==", + "name": "ScreenOrientationLock", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Glyphster Pack/Master/SVG/Computers and Hardware/3b0c6e05075b0db18a2931d72d18e8aff2c613106b66af9d60717a308c0122ad_Computers and Hardware_phone_rotate_rotation_arrow.svg", + "shortDescription": "Adds events for changing the screen settings (\"Orientation\"), recommended for published games on Android or iOS.", + "version": "1.1.2", + "description": [ + "Recommendations:", + "- This extension works on both published on browser, it's recommended on published games because of limitations you need to make a touch before using the events.", + "Actions", + "- Lock the Orientation (\"Changes the orientation to a selected option\")", + "Conditions:", + "- If orientation (\"Checks the current orientation, true if they match with the selected one\")" + ], + "tags": [ + "Orientation" + ], + "authorIds": [ + "mu1pKMrGmTTX98LMxHYJ62GzFyJ2" + ], + "dependencies": [], + "globalVariables": [ + { + "name": "CurrentOrientation", + "type": "string", + "value": "0" + }, + { + "name": "OrientationReversed", + "type": "string", + "value": "0" + }, + { + "name": "OrientationHistory", + "type": "string", + "value": "- Both" + } + ], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Change the screen Orientation For Exports.", + "fullName": "Change Orientation For Exports", + "functionType": "Action", + "group": "Exported Game", + "name": "ScreenOrientation", + "sentence": "Change Orientation to _PARAM1_ For Exports, _PARAM2_", + "events": [ + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "yes" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Portrait\"" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": " screen.orientation.lock('portrait');", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "yes" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Landscape\"" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": " screen.orientation.lock('landscape');", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Both\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "yes" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Both\"" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": " screen.orientation.unlock()", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ReverseOrientation", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "-180", + "\"\"", + "" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationReversed", + "=", + "\"Yes\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ReverseOrientation", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "0", + "\"\"", + "" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationReversed", + "=", + "\"No\"" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "History", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Portrait\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationHistory", + "+", + "\"\n- \"+CurrentOrientation" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Landscape\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationHistory", + "+", + "\"\n- \"+CurrentOrientation" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Both\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationHistory", + "+", + "\"\n- \"+CurrentOrientation" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Orientation", + "name": "ScreenOrientation", + "supplementaryInformation": "[\"Portrait\",\"Landscape\",\"Both\"]", + "type": "stringWithSelector" + }, + { + "description": "Flipped Orientation (\"Recommend: No\")", + "name": "ReverseOrientation", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Change the screen Orientation For Browser.", + "fullName": "Change Orientation For Browser", + "functionType": "Action", + "group": "Browser Game", + "name": "ScreenOrientationBrowser", + "sentence": "Change Orientation to _PARAM1_ For Browsers, _PARAM2_", + "events": [ + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Portrait\"" + ] + }, + { + "type": { + "value": "MouseButtonFromTextReleased" + }, + "parameters": [ + "", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "yes" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Portrait\"" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": " screen.orientation.lock('portrait');", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Landscape\"" + ] + }, + { + "type": { + "value": "MouseButtonFromTextReleased" + }, + "parameters": [ + "", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "yes" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Landscape\"" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": " screen.orientation.lock('landscape');", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Both\"" + ] + }, + { + "type": { + "value": "MouseButtonFromTextReleased" + }, + "parameters": [ + "", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "yes" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Both\"" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": " screen.orientation.unlock()", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ReverseOrientation", + "True", + "" + ] + }, + { + "type": { + "value": "MouseButtonFromTextReleased" + }, + "parameters": [ + "", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "-180", + "\"\"", + "" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationReversed", + "=", + "\"Yes\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ReverseOrientation", + "False", + "" + ] + }, + { + "type": { + "value": "MouseButtonFromTextReleased" + }, + "parameters": [ + "", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "0", + "\"\"", + "" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationReversed", + "=", + "\"No\"" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "folded": true, + "name": "History", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Portrait\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationHistory", + "+", + "\"\n- \"+CurrentOrientation" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Landscape\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationHistory", + "+", + "\"\n- \"+CurrentOrientation" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "ScreenOrientation", + "=", + "\"Both\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "OrientationHistory", + "+", + "\"\n- \"+CurrentOrientation" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Orientation", + "name": "ScreenOrientation", + "supplementaryInformation": "[\"Portrait\",\"Landscape\",\"Both\"]", + "type": "stringWithSelector" + }, + { + "description": "Flipped Orientation (\"Recommend: No\")", + "name": "ReverseOrientation", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "True if current orientation matches the selected one.", + "fullName": "If Orientation", + "functionType": "Condition", + "name": "ConditionOrientaion", + "sentence": "If Orientation is _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Orientation", + "=", + "\"Portrait\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Orientation", + "=", + "CurrentOrientation" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Orientation", + "=", + "\"Landscape\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Orientation", + "=", + "CurrentOrientation" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Orientation", + "=", + "\"Both\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Orientation", + "=", + "CurrentOrientation" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Orientation", + "!=", + "CurrentOrientation" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "False" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Orientation", + "name": "Orientation", + "supplementaryInformation": "[\"Landscape\",\"Portrait\",\"Both\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "True if current orientation is reversed.", + "fullName": "Is Orientation Reversed", + "functionType": "Condition", + "name": "ConditionOrientationReversed", + "sentence": "Is Orientation Reversed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "OrientationReversed", + "=", + "\"Yes\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "OrientationReversed", + "=", + "\"No\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "False" + ] + } + ] + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Current Orientation.", + "fullName": "Get Orientation", + "functionType": "StringExpression", + "name": "ExpressionOrientaion", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "\"Portrait\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "\"Landscape\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "CurrentOrientation", + "=", + "\"Both\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "\"Both\"" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Every Changes Are Saved In Orientation History.", + "fullName": "Orientation History", + "functionType": "StringExpression", + "name": "ExpressionOrientaionHistory", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "OrientationHistory" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +} \ No newline at end of file