diff --git a/extensions/community/ForceWindow.json b/extensions/community/ForceWindow.json new file mode 100644 index 000000000..6ef1ec170 --- /dev/null +++ b/extensions/community/ForceWindow.json @@ -0,0 +1,432 @@ +{ + "author": "", + "category": "User interface", + "extensionNamespace": "", + "fullName": "ForceWindow", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBkPSJNMjcsNEg1QzMuMyw0LDIsNS4zLDIsN3YxOGMwLDEuNywxLjMsMywzLDNoMi45Yy0wLjUsMC0wLjktMC4zLTEtMC44Yy0wLjItMC43LTAuMy0xLjUtMC4zLTIuMmMwLTAuNywwLjEtMS40LDAuMy0yLjINCglDNywyMi4zLDcuNSwyMiw4LDIyLjFjMC42LDAuMSwxLjItMC4yLDEuNi0wLjhjMC4zLTAuNSwwLjMtMS4yLTAuMS0xLjdjLTAuMy0wLjQtMC4zLTEsMC4xLTEuM2MxLjEtMSwyLjQtMS44LDMuOC0yLjINCgljMC41LTAuMSwxLDAuMSwxLjIsMC42YzAuMiwwLjYsMC44LDEsMS40LDFzMS4yLTAuNCwxLjQtMWMw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wLjcsOC43eiBNMTMuOSw4LjRjLTAuMSwwLjEtMC4xLDAuMi0wLjIsMC4zQzEzLjUsOC45LDEzLjMsOSwxMyw5Yy0wLjEsMC0wLjMsMC0wLjQtMC4xDQoJYy0wLjEtMC4xLTAuMi0wLjEtMC4zLTAuMmMtMC4xLTAuMS0wLjItMC4yLTAuMi0wLjNDMTIsOC4zLDEyLDguMSwxMiw4YzAtMC4xLDAtMC4zLDAuMS0wLjRjMC4xLTAuMSwwLjEtMC4yLDAuMi0wLjMNCgljMC40LTAuNCwxLTAuNCwxLjQsMGMwLjEsMC4xLDAuMiwwLjIsMC4yLDAuM0MxNCw3LjcsMTQsNy45LDE0LDhDMTQsOC4xLDE0LDguMywxMy45LDguNHoiLz4NCjxnPg0KCTxwYXRoIGQ9Ik0xNiwyOWMtMi4yLDAtNC0xLjgtNC00czEuOC00LDQtNHM0LDEuOCw0LDRTMTguMiwyOSwxNiwyOXoiLz4NCjwvZz4NCjwvc3ZnPg0K", + "name": "ForceWindow", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Glyphster Pack/Master/SVG/SEO/72e676bbce73e253f6f193af6c7c6907fb5e9b791cfcedc5e90692f63c5ffaad_SEO_website_optimization_window_cog.svg", + "shortDescription": "Window Settings For Both Mobile And Pc. ", + "version": "1.0.0", + "description": "This Extension allows changing Device Orientation, sounds on window, keep awake mobile devices, hide status bar on top of device and exc.", + "tags": [ + "Window", + "Device Orientation" + ], + "authorIds": [ + "LmDPcZ5ey4WWF4VdoEQcmPVTmFu2" + ], + "dependencies": [], + "globalVariables": [ + { + "name": "DeviceOrientation", + "type": "string", + "value": "Both" + } + ], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Change Orientation On Mobile To Landscape Or Portrait.", + "fullName": "Set Device Orientation", + "functionType": "Action", + "group": "All", + "name": "Set_Orientation", + "sentence": "_PARAM1_PARAM2_", + "events": [ + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareArgumentAsString" + }, + "parameters": [ + "\"Orientation\"", + "=", + "\"Landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "DeviceOrientation", + "=", + "\"Landscape\"" + ] + }, + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "no" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "screen.orientation.lock(\"landscape\")", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareArgumentAsString" + }, + "parameters": [ + "\"Orientation\"", + "=", + "\"Portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "DeviceOrientation", + "=", + "\"Portrait\"" + ] + }, + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "no" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "screen.orientation.lock(\"portrait\") ", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareArgumentAsString" + }, + "parameters": [ + "\"Orientation\"", + "=", + "\"Both\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "DeviceOrientation", + "=", + "\"Both\"" + ] + }, + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "no" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "screen.orientation.lock(\"Both\") ", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + } + ], + "parameters": [ + { + "description": "Orientation", + "name": "Orientation", + "supplementaryInformation": "[\"Landscape\",\"Portrait\",\"Both\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "This Sees If Device Orientation Is Landscape Or Portrait. ", + "fullName": " If Device Orientation", + "functionType": "Condition", + "group": "All", + "name": "OrientationIsEqualTo", + "sentence": "_PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "DeviceOrientation", + "=", + "Findout" + ] + } + ], + "actions": [] + } + ], + "parameters": [ + { + "description": "If Device Orientation Is Equal To", + "name": "Findout", + "supplementaryInformation": "[\"Landscape\",\"Portrait\",\"Both\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Gets Device Orientation ( Landscape, Portrait Or Both ). ", + "fullName": "Cheak Device Orientation", + "functionType": "StringExpression", + "group": "All", + "name": "CheakOrientation", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "DeviceOrientation" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"Landscape\",\"Portrait\",\"Both\"]", + "type": "stringWithSelector" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Prevents Sleeping / Phone Turing Off After Being Afk. ", + "fullName": "Keep Screen On", + "functionType": "Action", + "group": "Mobile", + "name": "Keepawake", + "sentence": "_PARAMX_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "let wakeLock = null;", + "", + "async function keepScreenOn() {", + " if ('wakeLock' in navigator) {", + " try {", + " wakeLock = await navigator.wakeLock.request('screen');", + " console.log(\"Screen wake lock enabled.\");", + " } catch (err) {", + " console.error(\"Failed to enable wake lock:\", err);", + " }", + " }", + " }", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Mobile devices have a status bar at the top that displays things like time, battery, and network status. In some cases, you might want to hide it for a more immersive experience, especially in full-screen games.", + "fullName": "ToggleStatusBar", + "functionType": "Action", + "group": "Mobile", + "name": "ToggleStatusBar", + "sentence": "_PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Show\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "window.StatusBar.show()", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Show\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "window.StatusBar.hide()", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] + } + ], + "parameters": [ + { + "description": "Show ( ONLY WORKS WITH Cordova AND PhoneGap ) ", + "name": "Show", + "type": "trueorfalse" + } + ], + "objectGroups": [] + }, + { + "description": "For mobile games, controlling the screen brightness can help create an immersive experience, especially in games with dark themes or environments.", + "fullName": "AdjustBrightness", + "functionType": "Action", + "group": "Mobile", + "name": "ScreenBrigthneess", + "sentence": "_PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const brightnessLevel = parameters[0]; // Brightness level (0 to 1)", + "", + "if (window.screen && window.screen.brightness) {", + " window.screen.brightness(brightnessLevel); // For native apps (e.g., Cordova)", + "} else {", + " console.error(\"Brightness control is not supported on this platform.\");", + "}", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Between 0 And 1 ( Works Only With Cordova ) ", + "name": "BrightnessLevel", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Sometimes you may want to mute or unmute game audio based on specific conditions (like when the game is in the background).", + "fullName": "ToggleAudio Window", + "functionType": "Action", + "group": "All", + "name": "MuteAudio", + "sentence": "_PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (mute) {", + " document.querySelector('audio').muted = true; // Mute all audio elements", + " } else {", + " document.querySelector('audio').muted = false; // Unmute all audio elements", + " }", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Mute", + "name": "Mute", + "type": "trueorfalse" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +} \ No newline at end of file