diff --git a/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json b/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json index e6628a400..264461359 100644 --- a/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json +++ b/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json @@ -1268,11 +1268,11 @@ "conditions": [ { "type": { - "value": "MouseButtonReleased" + "value": "MouseButtonFromTextReleased" }, "parameters": [ "", - "Left" + "\"Left\"" ] }, { @@ -1495,11 +1495,11 @@ "conditions": [ { "type": { - "value": "MouseButtonReleased" + "value": "MouseButtonFromTextReleased" }, "parameters": [ "", - "Right" + "\"Right\"" ] } ], @@ -1764,11 +1764,11 @@ "conditions": [ { "type": { - "value": "MouseButtonPressed" + "value": "MouseButtonFromTextPressed" }, "parameters": [ "", - "Left" + "\"Left\"" ] }, { @@ -1778,14 +1778,34 @@ "parameters": [] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "MousePointerLock::RequestPointerLock" - }, - "parameters": [ - "", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SourisSurObjet" + }, + "parameters": [ + "Toolbar", + "", + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MousePointerLock::RequestPointerLock" + }, + "parameters": [ + "", + "" + ] + } ] } ] @@ -1795,11 +1815,11 @@ "conditions": [ { "type": { - "value": "MouseButtonReleased" + "value": "MouseButtonFromTextReleased" }, "parameters": [ "", - "Left" + "\"Left\"" ] } ], @@ -1820,11 +1840,20 @@ "conditions": [ { "type": { - "value": "MouseButtonPressed" + "value": "MouseButtonFromTextPressed" }, "parameters": [ "", - "Left" + "\"Left\"" + ] + }, + { + "type": { + "value": "MousePointerLock::isPointerLocked" + }, + "parameters": [ + "", + "" ] } ], @@ -6056,7 +6085,7 @@ "name": "SpriteToggleSwitch", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Interface Elements/8d0cd8cd0c9318f4f6efde6ee6b4c192bd19306467f80c9970387a259300f895_Interface Elements_interface_ui_toggle_switch_on_off.svg", "shortDescription": "Toggle switch that users can click or touch.", - "version": "2.0.1", + "version": "2.0.2", "description": [ "Toggle switch that users can click or touch. The switch can be customized with sprites.", "", @@ -6456,108 +6485,16 @@ "name": "SetChecked", "sentence": "Check _PARAM0_: _PARAM2_", "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Avoid a started touch to interfere with a state change from events." - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "BuiltinCommonInstructions::And" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "inverted": true, - "value": "GetArgumentAsBoolean" - }, - "parameters": [ - "\"Value\"" - ] - }, - { - "type": { - "value": "SpriteToggleSwitch::SwitchFSM::IsChecked" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::And" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "GetArgumentAsBoolean" - }, - "parameters": [ - "\"Value\"" - ] - }, - { - "type": { - "inverted": true, - "value": "SpriteToggleSwitch::SwitchFSM::IsChecked" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteToggleSwitch::ButtonFSM::ResetState" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, "value": "BooleanVariable" }, "parameters": [ "Value", - "True", + "False", "" ] } @@ -6573,6 +6510,47 @@ "" ] } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Avoid a started touch to interfere with a state change from events." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteToggleSwitch::SwitchFSM::IsChecked" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::ButtonFSM::ResetState" + }, + "parameters": [ + "Object", + "ButtonFSM", + "" + ] + } + ] + } ] }, { @@ -6600,6 +6578,36 @@ "" ] } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteToggleSwitch::SwitchFSM::IsChecked" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::ButtonFSM::ResetState" + }, + "parameters": [ + "Object", + "ButtonFSM", + "" + ] + } + ] + } ] } ], @@ -8137,12 +8145,11 @@ "conditions": [ { "type": { - "inverted": true, "value": "BooleanVariable" }, "parameters": [ "IsChecked", - "True", + "False", "" ] } @@ -8243,12 +8250,11 @@ }, { "type": { - "inverted": true, "value": "BooleanVariable" }, "parameters": [ "PreviousIsChecked", - "True", + "False", "" ] } @@ -8281,12 +8287,11 @@ "conditions": [ { "type": { - "inverted": true, "value": "BooleanVariable" }, "parameters": [ "IsChecked", - "True", + "False", "" ] }, @@ -8835,7 +8840,6 @@ "fullName": "Is pressed", "functionType": "Condition", "name": "IsPressed", - "private": true, "sentence": "_PARAM0_ is pressed", "events": [ { @@ -8874,6 +8878,49 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is currently being pressed outside with mouse or touch.", + "fullName": "Is held outside", + "functionType": "Condition", + "name": "IsPressedOutside", + "sentence": "_PARAM0_ is held outside", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteToggleSwitch::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "State", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "SpriteToggleSwitch::SpriteToggleSwitch", + "type": "object" + } + ], + "objectGroups": [] + }, { "description": "Update the state animation.", "fullName": "Update state animation", @@ -10540,15 +10587,26 @@ "Button", "" ] + }, + { + "type": { + "value": "VarObjetTxt" + }, + "parameters": [ + "Button", + "BuildingName", + "=", + "SelectedTool" + ] } ], "actions": [ { "type": { - "value": "Toolbar::Toolbar::SetPropertySelectedTool" + "value": "SetStringVariable" }, "parameters": [ - "Object", + "SelectedTool", "=", "\"None\"" ] @@ -10565,33 +10623,79 @@ "textG": 0, "textR": 0 }, - "comment": "Make buttons act as radio buttons." + "comment": "Handle dragging" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SpriteToggleSwitch::SpriteToggleSwitch::HasJustBeenChecked" + "value": "SpriteToggleSwitch::SpriteToggleSwitch::IsPressed" }, "parameters": [ "Button", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "AjoutObjConcern" + "value": "SetStringVariable" }, "parameters": [ - "", - "Button" + "SelectedTool", + "=", + "Button.BuildingName" ] - }, + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "AjoutObjConcern" + }, + "parameters": [ + "", + "Button" + ] + }, + { + "type": { + "value": "VarObjetTxt" + }, + "parameters": [ + "Button", + "BuildingName", + "!=", + "SelectedTool" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "Button", + "no", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "inverted": true, - "value": "SpriteToggleSwitch::SpriteToggleSwitch::HasJustBeenChecked" + "value": "SpriteToggleSwitch::SpriteToggleSwitch::IsPressedOutside" }, "parameters": [ "Button", @@ -10606,7 +10710,7 @@ }, "parameters": [ "Button", - "no", + "yes", "" ] } @@ -10622,86 +10726,66 @@ "textG": 0, "textR": 0 }, - "comment": "Handle dragging" + "comment": "Make buttons act as radio buttons." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "MouseButtonPressed" + "value": "SpriteToggleSwitch::SpriteToggleSwitch::HasJustBeenChecked" }, "parameters": [ - "", - "Left" + "Button", + "" ] - }, + } + ], + "actions": [ { "type": { - "value": "BuiltinCommonInstructions::Once" + "value": "SetStringVariable" }, - "parameters": [] + "parameters": [ + "SelectedTool", + "=", + "Button.BuildingName" + ] } ], - "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SourisSurObjet" + "value": "AjoutObjConcern" }, "parameters": [ - "Button", - "", "", + "Button" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteToggleSwitch::SpriteToggleSwitch::HasJustBeenChecked" + }, + "parameters": [ + "Button", "" ] } ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "AjoutObjConcern" - }, - "parameters": [ - "", - "Button" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" - }, - "parameters": [ - "Button", - "no", - "" - ] - } - ] - }, + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" - }, - "parameters": [ - "Button", - "", - "" - ] - } + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "Button", + "no", + "" ] } ] @@ -10718,13 +10802,24 @@ "textG": 0, "textR": 0 }, - "comment": "Select a tool" + "comment": "Hover effect" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { + "inverted": true, + "value": "SpriteToggleSwitch::SpriteToggleSwitch::IsHovered" + }, + "parameters": [ + "Button", + "" + ] + }, + { + "type": { + "inverted": true, "value": "SpriteToggleSwitch::SpriteToggleSwitch::IsChecked" }, "parameters": [ @@ -10736,28 +10831,28 @@ "actions": [ { "type": { - "value": "Toolbar::Toolbar::SetPropertySelectedTool" + "value": "EffectCapability::EffectBehavior::EnableEffect" }, "parameters": [ - "Object", - "=", - "Button.BuildingName" + "Button", + "Effect", + "\"Black\"", + "yes" + ] + }, + { + "type": { + "value": "EffectCapability::EffectBehavior::EnableEffect" + }, + "parameters": [ + "Button", + "Effect", + "\"White\"", + "no" ] } ] }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Hover effect" - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -10784,6 +10879,17 @@ "Button", "" ] + }, + { + "type": { + "value": "VarObjetTxt" + }, + "parameters": [ + "Button", + "BuildingName", + "=", + "SelectedTool" + ] } ] } @@ -10812,55 +10918,6 @@ ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteToggleSwitch::SpriteToggleSwitch::IsHovered" - }, - "parameters": [ - "Button", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "SpriteToggleSwitch::SpriteToggleSwitch::IsChecked" - }, - "parameters": [ - "Button", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "EffectCapability::EffectBehavior::EnableEffect" - }, - "parameters": [ - "Button", - "Effect", - "\"Black\"", - "yes" - ] - }, - { - "type": { - "value": "EffectCapability::EffectBehavior::EnableEffect" - }, - "parameters": [ - "Button", - "Effect", - "\"White\"", - "no" - ] - } - ] } ], "parameters": [ @@ -10923,10 +10980,10 @@ "actions": [ { "type": { - "value": "Toolbar::Toolbar::SetPropertySelectedTool" + "value": "SetStringVariable" }, "parameters": [ - "Object", + "SelectedTool", "=", "Value" ]