Moved escoria-ui-return-monkey-island to gymkhana
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 96 KiB |
@@ -1,7 +0,0 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 21
|
||||
font_data = ExtResource( 1 )
|
||||
@@ -1,406 +0,0 @@
|
||||
extends ESCGame
|
||||
|
||||
|
||||
const VERB_USE = "use"
|
||||
const VERB_WALK = "walk"
|
||||
|
||||
|
||||
"""
|
||||
Implement methods to react to inputs.
|
||||
|
||||
- left_click_on_bg(position: Vector2)
|
||||
- right_click_on_bg(position: Vector2)
|
||||
- left_double_click_on_bg(position: Vector2)
|
||||
|
||||
- element_focused(element_id: String)
|
||||
- element_unfocused()
|
||||
|
||||
- left_click_on_item(item_global_id: String, event: InputEvent)
|
||||
- right_click_on_item(item_global_id: String, event: InputEvent)
|
||||
- left_double_click_on_item(item_global_id: String, event: InputEvent)
|
||||
|
||||
- left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- inventory_item_focused(inventory_item_global_id: String)
|
||||
- inventory_item_unfocused()
|
||||
- open_inventory()
|
||||
- close_inventory()
|
||||
|
||||
- mousewheel_action(direction: int)
|
||||
|
||||
- hide_ui()
|
||||
- show_ui()
|
||||
|
||||
- pause_game()
|
||||
- unpause_game()
|
||||
- show_main_menu()
|
||||
- hide_main_menu()
|
||||
|
||||
- apply_custom_settings()
|
||||
|
||||
- _on_event_done(event_name: String)
|
||||
"""
|
||||
|
||||
# Value to use for `device` argument to various `Input.get_joy` methods.
|
||||
const JOY_DEVICE = 0
|
||||
|
||||
# See https://docs.godotengine.org/en/stable/tutorials/inputs/controllers_gamepads_joysticks.html?#dead-zone
|
||||
const DEADZONE = 0.2
|
||||
|
||||
# Multiplier to apply to axis when it exceeds DEADZONE.
|
||||
const AXIS_WEIGHT = 50.0
|
||||
|
||||
# JOY_BUTTON_2 corresponds to the "X" button on an XBox controller
|
||||
# or the Square button on a Playstation controller. These appear to
|
||||
# map to the "primary action," in practice, so we treat it like a left click.
|
||||
const PRIMARY_ACTION_BUTTON = JOY_BUTTON_2
|
||||
|
||||
# JOY_BUTTON_3 corresponds to the "Y" button on an XBox controller
|
||||
# or the Triangle button on a Playstation controller. These appear to
|
||||
# map to the "secondary action," in practice, so we treat it like a right click.
|
||||
const CHANGE_VERB_BUTTON = JOY_BUTTON_3
|
||||
|
||||
# Input action for use by InputMap
|
||||
const ESC_UI_CHANGE_VERB_ACTION = "esc_change_verb"
|
||||
|
||||
# true when a gamepad is connected.
|
||||
var _is_gamepad_connected = false
|
||||
|
||||
# Tracks the mouse's current position onscreen.
|
||||
var _current_mouse_pos = Vector2.ZERO
|
||||
|
||||
|
||||
func _ready():
|
||||
$tooltip_layer/tooltip.connect("tooltip_size_updated", self, "update_tooltip_following_mouse_position")
|
||||
|
||||
|
||||
func _enter_tree():
|
||||
var room_selector_parent = $CanvasLayer/ui/HBoxContainer/VBoxContainer
|
||||
|
||||
if ESCProjectSettingsManager.get_setting(ESCProjectSettingsManager.ENABLE_ROOM_SELECTOR) \
|
||||
and room_selector_parent.get_node_or_null("room_select") == null:
|
||||
|
||||
room_selector_parent.add_child(
|
||||
preload(
|
||||
"res://addons/escoria-core/ui_library/tools/room_select" +\
|
||||
"/room_select.tscn"
|
||||
).instance()
|
||||
)
|
||||
|
||||
var input_handler = funcref(self, "_process_input")
|
||||
escoria.inputs_manager.register_custom_input_handler(input_handler)
|
||||
|
||||
_is_gamepad_connected = Input.is_joy_known(JOY_DEVICE)
|
||||
if _is_gamepad_connected:
|
||||
_on_gamepad_connected()
|
||||
|
||||
Input.connect("joy_connection_changed", self, "_on_joy_connection_changed")
|
||||
|
||||
|
||||
func _exit_tree():
|
||||
escoria.inputs_manager.register_custom_input_handler(null)
|
||||
Input.disconnect("joy_connection_changed", self, "_on_joy_connection_changed")
|
||||
if _is_gamepad_connected:
|
||||
_on_gamepad_disconnected()
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if escoria.get_escoria().is_ready_for_inputs():
|
||||
if event is InputEventMouseMotion:
|
||||
_current_mouse_pos = get_global_mouse_position()
|
||||
update_tooltip_following_mouse_position()
|
||||
|
||||
|
||||
# https://github.com/godotengine/godot-demo-projects/blob/3.4-585455e/misc/joypads/joypads.gd
|
||||
# was informative in wiring up the gamepad properly.
|
||||
|
||||
func _on_gamepad_connected():
|
||||
set_physics_process(true)
|
||||
|
||||
var primary_event = InputEventJoypadButton.new()
|
||||
primary_event.button_index = PRIMARY_ACTION_BUTTON
|
||||
InputMap.add_action(escoria.inputs_manager.ESC_UI_PRIMARY_ACTION)
|
||||
InputMap.action_add_event(escoria.inputs_manager.ESC_UI_PRIMARY_ACTION, primary_event)
|
||||
|
||||
var verb_event = InputEventJoypadButton.new()
|
||||
verb_event.button_index = CHANGE_VERB_BUTTON
|
||||
InputMap.add_action(ESC_UI_CHANGE_VERB_ACTION)
|
||||
InputMap.action_add_event(ESC_UI_CHANGE_VERB_ACTION, verb_event)
|
||||
|
||||
|
||||
func _on_gamepad_disconnected():
|
||||
InputMap.action_erase_events(escoria.inputs_manager.ESC_UI_PRIMARY_ACTION)
|
||||
InputMap.erase_action(escoria.inputs_manager.ESC_UI_PRIMARY_ACTION)
|
||||
|
||||
InputMap.action_erase_events(ESC_UI_CHANGE_VERB_ACTION)
|
||||
InputMap.erase_action(ESC_UI_CHANGE_VERB_ACTION)
|
||||
|
||||
set_physics_process(false)
|
||||
_is_gamepad_connected = false
|
||||
|
||||
|
||||
func _on_joy_connection_changed(device: int, connected: bool) -> void:
|
||||
if device != JOY_DEVICE:
|
||||
return
|
||||
elif connected:
|
||||
_on_gamepad_connected()
|
||||
else:
|
||||
_on_gamepad_disconnected()
|
||||
|
||||
|
||||
func _process(_delta) -> void:
|
||||
if !_is_gamepad_connected:
|
||||
return
|
||||
|
||||
var x = Input.get_joy_axis(JOY_DEVICE, JOY_AXIS_0)
|
||||
var y = Input.get_joy_axis(JOY_DEVICE, JOY_AXIS_1)
|
||||
var delta_x = int(x * AXIS_WEIGHT) if abs(x) > DEADZONE else 0
|
||||
var delta_y = int(y * AXIS_WEIGHT) if abs(y) > DEADZONE else 0
|
||||
if delta_x or delta_y:
|
||||
var direction: Vector2
|
||||
direction.x = delta_x
|
||||
direction.y = delta_y
|
||||
escoria.logger.trace("gamepad direction:", [direction])
|
||||
var viewport = get_viewport()
|
||||
viewport.warp_mouse(viewport.get_mouse_position() + direction)
|
||||
|
||||
|
||||
func _process_input(event: InputEvent, is_default_state: bool) -> bool:
|
||||
if not is_default_state:
|
||||
# ESCBackground is not guaranteed to be set, as we may be on
|
||||
# the "New Game" screen.
|
||||
return false
|
||||
elif _is_gamepad_connected and event is InputEventJoypadButton:
|
||||
escoria.logger.trace("InputEventJoypadButton:", [event.as_text()])
|
||||
if event.is_action_pressed(escoria.inputs_manager.ESC_UI_PRIMARY_ACTION):
|
||||
# Admittedly, this breaks abstraction barriers and is completely
|
||||
# inappropriate, but it's what works right now.
|
||||
escoria.inputs_manager._on_left_click_on_bg(get_global_mouse_position())
|
||||
return true
|
||||
elif event.is_action_pressed(ESC_UI_CHANGE_VERB_ACTION):
|
||||
mousewheel_action(1)
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
## BACKGROUND ##
|
||||
|
||||
func left_click_on_bg(position: Vector2) -> void:
|
||||
if escoria.main.current_scene.player:
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.BACKGROUND_CLICK,
|
||||
[escoria.main.current_scene.player.global_id, position],
|
||||
true
|
||||
)
|
||||
$mouse_layer/verbs_menu.set_by_name(VERB_WALK)
|
||||
$mouse_layer/verbs_menu.clear_tool_texture()
|
||||
|
||||
func right_click_on_bg(position: Vector2) -> void:
|
||||
mousewheel_action(1)
|
||||
|
||||
func left_double_click_on_bg(position: Vector2) -> void:
|
||||
if escoria.main.current_scene.player:
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.BACKGROUND_CLICK,
|
||||
[escoria.main.current_scene.player.global_id, position, true],
|
||||
true
|
||||
)
|
||||
$mouse_layer/verbs_menu.set_by_name(VERB_WALK)
|
||||
$mouse_layer/verbs_menu.clear_tool_texture()
|
||||
|
||||
## ITEM/HOTSPOT FOCUS ##
|
||||
|
||||
func element_focused(element_id: String) -> void:
|
||||
var target_obj = escoria.object_manager.get_object(element_id).node
|
||||
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||
|
||||
if escoria.action_manager.current_action != VERB_USE \
|
||||
and escoria.action_manager.current_tool == null \
|
||||
and target_obj is ESCItem:
|
||||
|
||||
$mouse_layer/verbs_menu.set_by_name(
|
||||
target_obj.default_action
|
||||
)
|
||||
|
||||
func element_unfocused() -> void:
|
||||
$tooltip_layer/tooltip.set_target("")
|
||||
|
||||
|
||||
## ITEMS ##
|
||||
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
var target_obj = escoria.object_manager.get_object(item_global_id).node
|
||||
|
||||
# current_action will be empty if an event completes between when you stop
|
||||
# moving the mouse and when you click.
|
||||
if escoria.action_manager.current_action == "":
|
||||
if target_obj is ESCItem:
|
||||
$mouse_layer/verbs_menu.set_by_name(
|
||||
target_obj.default_action
|
||||
)
|
||||
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||
[item_global_id, event],
|
||||
true
|
||||
)
|
||||
func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
mousewheel_action(1)
|
||||
|
||||
func left_double_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||
[item_global_id, event],
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
## INVENTORY ##
|
||||
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||
[inventory_item_global_id, event]
|
||||
)
|
||||
|
||||
if escoria.action_manager.current_action == VERB_USE:
|
||||
var item = escoria.object_manager.get_object(
|
||||
inventory_item_global_id
|
||||
).node
|
||||
if item.has_method("get_sprite") and item.get_sprite().texture:
|
||||
$mouse_layer/verbs_menu.set_tool_texture(
|
||||
item.get_sprite().texture
|
||||
)
|
||||
elif item.inventory_item.texture_normal:
|
||||
$mouse_layer/verbs_menu.set_tool_texture(
|
||||
item.inventory_item.texture_normal
|
||||
)
|
||||
|
||||
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
mousewheel_action(1)
|
||||
|
||||
|
||||
func left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
||||
$tooltip_layer/tooltip.set_target(
|
||||
escoria.object_manager.get_object(
|
||||
inventory_item_global_id
|
||||
).node.tooltip_name
|
||||
)
|
||||
|
||||
|
||||
func inventory_item_unfocused() -> void:
|
||||
$tooltip_layer/tooltip.set_target("")
|
||||
|
||||
|
||||
func open_inventory():
|
||||
$CanvasLayer/ui/HBoxContainer/inventory_ui.show_inventory()
|
||||
|
||||
|
||||
func close_inventory():
|
||||
$CanvasLayer/ui/HBoxContainer/inventory_ui.hide_inventory()
|
||||
|
||||
|
||||
func mousewheel_action(direction: int):
|
||||
$mouse_layer/verbs_menu.iterate_actions_cursor(direction)
|
||||
|
||||
|
||||
func hide_ui():
|
||||
$CanvasLayer/ui/HBoxContainer/inventory_ui.hide()
|
||||
$CanvasLayer/ui.hide()
|
||||
|
||||
|
||||
func show_ui():
|
||||
$CanvasLayer/ui/HBoxContainer/inventory_ui.show()
|
||||
$CanvasLayer/ui.show()
|
||||
|
||||
|
||||
func hide_main_menu():
|
||||
if get_node(main_menu).visible:
|
||||
get_node(main_menu).hide()
|
||||
|
||||
func show_main_menu():
|
||||
if not get_node(main_menu).visible:
|
||||
get_node(main_menu).reset()
|
||||
get_node(main_menu).show()
|
||||
|
||||
func unpause_game():
|
||||
if get_node(pause_menu).visible:
|
||||
get_node(pause_menu).hide()
|
||||
escoria.object_manager.get_object(ESCObjectManager.CAMERA).node.current = true
|
||||
escoria.object_manager.get_object(ESCObjectManager.SPEECH).node.resume()
|
||||
escoria.main.current_scene.game.show_ui()
|
||||
escoria.main.current_scene.show()
|
||||
|
||||
func pause_game():
|
||||
if not get_node(pause_menu).visible:
|
||||
get_node(main_menu).reset()
|
||||
get_node(pause_menu).reset()
|
||||
get_node(pause_menu).set_save_enabled(
|
||||
escoria.save_manager.save_enabled
|
||||
)
|
||||
get_node(pause_menu).show()
|
||||
escoria.object_manager.get_object(ESCObjectManager.CAMERA).node.current = false
|
||||
escoria.object_manager.get_object(ESCObjectManager.SPEECH).node.pause()
|
||||
escoria.main.current_scene.game.hide_ui()
|
||||
escoria.main.current_scene.hide()
|
||||
|
||||
|
||||
func apply_custom_settings(custom_settings: Dictionary):
|
||||
if custom_settings.has("a_custom_setting"):
|
||||
escoria.logger.info(
|
||||
self,
|
||||
"custom setting value loaded: %s."
|
||||
% str(custom_settings["a_custom_setting"])
|
||||
)
|
||||
|
||||
|
||||
func get_custom_data() -> Dictionary:
|
||||
return {
|
||||
"ui_type": "simplemouse"
|
||||
}
|
||||
|
||||
|
||||
# Update the tooltip
|
||||
func update_tooltip_following_mouse_position():
|
||||
var corrected_position = _current_mouse_pos \
|
||||
- Vector2(
|
||||
tooltip_node.rect_size.x / 2,
|
||||
tooltip_node.rect_size.y / 2
|
||||
)
|
||||
|
||||
# clamp TOP
|
||||
if tooltip_node.tooltip_distance_to_edge_top(_current_mouse_pos) <= mouse_tooltip_margin:
|
||||
corrected_position.y = mouse_tooltip_margin
|
||||
|
||||
# clamp BOTTOM
|
||||
if tooltip_node.tooltip_distance_to_edge_bottom(_current_mouse_pos + tooltip_node.rect_size) <= mouse_tooltip_margin:
|
||||
corrected_position.y = escoria.game_size.y - mouse_tooltip_margin - tooltip_node.rect_size.y
|
||||
|
||||
# clamp LEFT
|
||||
if tooltip_node.tooltip_distance_to_edge_left(_current_mouse_pos - tooltip_node.rect_size/2) <= mouse_tooltip_margin:
|
||||
corrected_position.x = mouse_tooltip_margin
|
||||
|
||||
# clamp RIGHT
|
||||
if tooltip_node.tooltip_distance_to_edge_right(_current_mouse_pos + tooltip_node.rect_size/2) <= mouse_tooltip_margin:
|
||||
corrected_position.x = escoria.game_size.x - mouse_tooltip_margin - tooltip_node.rect_size.x
|
||||
|
||||
tooltip_node.rect_position = corrected_position + tooltip_node.offset_from_cursor
|
||||
|
||||
|
||||
func _on_action_finished():
|
||||
$mouse_layer/verbs_menu.clear_tool_texture()
|
||||
$mouse_layer/verbs_menu.iterate_actions_cursor(0)
|
||||
|
||||
|
||||
func _on_event_done(_return_code: int, _event_name: String):
|
||||
if _return_code == ESCExecution.RC_OK:
|
||||
escoria.action_manager.clear_current_action()
|
||||
$mouse_layer/verbs_menu.clear_tool_texture()
|
||||
$tooltip_layer/tooltip.set_target("")
|
||||
|
||||
|
||||
func _on_MenuButton_pressed() -> void:
|
||||
pause_game()
|
||||
@@ -1,108 +0,0 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/inventory/inventory_ui.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/verbs_mouseicons.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/game.gd" type="Script" id=5]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/tooltip/target_tooltip.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/main_menu/main_menu.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/menus/pause_menu/pause_menu.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=9]
|
||||
|
||||
[node name="game" type="Node2D"]
|
||||
script = ExtResource( 5 )
|
||||
main_menu = NodePath("CanvasLayer/main_menu")
|
||||
pause_menu = NodePath("CanvasLayer/pause_menu")
|
||||
editor_debug_mode = 1
|
||||
ui_parent_control_node = NodePath("CanvasLayer/ui")
|
||||
|
||||
[node name="camera" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="dialog_layer" type="CanvasLayer" parent="."]
|
||||
layer = 3
|
||||
|
||||
[node name="ESCDialogsPlayer" type="Control" parent="dialog_layer"]
|
||||
theme = ExtResource( 9 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="ui" type="Control" parent="CanvasLayer"]
|
||||
anchor_top = 0.9
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource( 9 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/ui"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/ui/HBoxContainer"]
|
||||
margin_right = 58.0
|
||||
margin_bottom = 90.0
|
||||
|
||||
[node name="MenuButton" type="Button" parent="CanvasLayer/ui/HBoxContainer/VBoxContainer"]
|
||||
margin_right = 58.0
|
||||
margin_bottom = 27.0
|
||||
text = "Menu"
|
||||
|
||||
[node name="Spacer" type="Control" parent="CanvasLayer/ui/HBoxContainer"]
|
||||
margin_left = 62.0
|
||||
margin_right = 1186.0
|
||||
margin_bottom = 90.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="inventory_ui" parent="CanvasLayer/ui/HBoxContainer" instance=ExtResource( 1 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 1190.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 90.0
|
||||
rect_scale = Vector2( 1, 1 )
|
||||
|
||||
[node name="pause_menu" parent="CanvasLayer" instance=ExtResource( 8 )]
|
||||
visible = false
|
||||
theme = ExtResource( 9 )
|
||||
|
||||
[node name="main_menu" parent="CanvasLayer" instance=ExtResource( 7 )]
|
||||
visible = false
|
||||
|
||||
[node name="tooltip_layer" type="CanvasLayer" parent="."]
|
||||
layer = 2
|
||||
|
||||
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 6 )]
|
||||
mouse_filter = 2
|
||||
theme = ExtResource( 9 )
|
||||
bbcode_text = "[center][color=#000000][/color][/center]"
|
||||
fit_content_height = true
|
||||
|
||||
[node name="mouse_layer" type="CanvasLayer" parent="."]
|
||||
layer = 2
|
||||
|
||||
[node name="verbs_menu" parent="mouse_layer" instance=ExtResource( 4 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 156.0
|
||||
margin_top = 810.0
|
||||
margin_right = 156.0
|
||||
margin_bottom = 900.0
|
||||
grow_horizontal = 0
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 3.0
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
||||
|
Before Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 67 KiB |
@@ -1,55 +0,0 @@
|
||||
extends ESCInventory
|
||||
|
||||
|
||||
# Whether the inventory is visible currently
|
||||
var inventory_visible: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Hide inventory by default
|
||||
$FloatingInventory/panel.rect_position.x = \
|
||||
ProjectSettings.get_setting("display/window/size/width")
|
||||
|
||||
func _on_inventory_button_pressed():
|
||||
if $FloatingInventory/InventoryTween.is_active():
|
||||
return
|
||||
if inventory_visible:
|
||||
hide_inventory()
|
||||
else:
|
||||
show_inventory()
|
||||
|
||||
|
||||
func show_inventory():
|
||||
$FloatingInventory/InventoryTween.stop_all()
|
||||
$FloatingInventory/InventoryTween.remove_all()
|
||||
$FloatingInventory/InventoryTween.interpolate_property(
|
||||
$FloatingInventory/panel,
|
||||
"rect_position:x",
|
||||
$FloatingInventory/panel.rect_position.x,
|
||||
$FloatingInventory/panel.rect_position.x - \
|
||||
$FloatingInventory/panel.rect_size.x - \
|
||||
$HBoxContainer/inventory_button.rect_size.x,
|
||||
0.6
|
||||
)
|
||||
$FloatingInventory/InventoryTween.start()
|
||||
yield($FloatingInventory/InventoryTween,"tween_all_completed")
|
||||
$FloatingInventory/InventoryTween.stop_all()
|
||||
inventory_visible = true
|
||||
|
||||
|
||||
func hide_inventory():
|
||||
$FloatingInventory/InventoryTween.stop_all()
|
||||
$FloatingInventory/InventoryTween.remove_all()
|
||||
$FloatingInventory/InventoryTween.interpolate_property(
|
||||
$FloatingInventory/panel,
|
||||
"rect_position:x",
|
||||
$FloatingInventory/panel.rect_position.x,
|
||||
$FloatingInventory/panel.rect_position.x + \
|
||||
$FloatingInventory/panel.rect_size.x + \
|
||||
$HBoxContainer/inventory_button.rect_size.x,
|
||||
0.6
|
||||
)
|
||||
$FloatingInventory/InventoryTween.start()
|
||||
yield($FloatingInventory/InventoryTween,"tween_all_completed")
|
||||
$FloatingInventory/InventoryTween.stop_all()
|
||||
inventory_visible = false
|
||||
@@ -1,103 +0,0 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/inventory/inventory_ui.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/images/inventory_bg.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/escoria-core/ui_library/inventory/esc_inventory_container.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/images/frame.png" type="Texture" id=5]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/images/inventory_icon.png" type="Texture" id=6]
|
||||
|
||||
[node name="inventory_ui" type="Control"]
|
||||
anchor_right = 0.4
|
||||
anchor_bottom = 0.4
|
||||
margin_right = 768.0
|
||||
margin_bottom = 540.0
|
||||
rect_min_size = Vector2( 90, 90 )
|
||||
rect_scale = Vector2( 0.4, 0.4 )
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
inventory_ui_container = NodePath("FloatingInventory/panel/MarginContainer/ScrollContainer/container")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="inventory_button" type="TextureButton" parent="HBoxContainer"]
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 900.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture_normal = ExtResource( 6 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="frame" type="TextureRect" parent="HBoxContainer/inventory_button"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource( 5 )
|
||||
expand = true
|
||||
stretch_mode = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="FloatingInventory" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="panel" type="TextureRect" parent="FloatingInventory"]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -516.0
|
||||
margin_top = -160.0
|
||||
rect_min_size = Vector2( 0, 160 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource( 2 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="FloatingInventory/panel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 20
|
||||
custom_constants/margin_left = 20
|
||||
custom_constants/margin_bottom = 20
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="FloatingInventory/panel/MarginContainer"]
|
||||
margin_left = 20.0
|
||||
margin_top = 80.0
|
||||
margin_right = 496.0
|
||||
margin_bottom = 80.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
scroll_vertical_enabled = false
|
||||
|
||||
[node name="container" type="HBoxContainer" parent="FloatingInventory/panel/MarginContainer/ScrollContainer"]
|
||||
margin_right = 476.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/separation = 20
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="InventoryTween" type="Tween" parent="FloatingInventory"]
|
||||
|
||||
[connection signal="pressed" from="HBoxContainer/inventory_button" to="." method="_on_inventory_button_pressed"]
|
||||
@@ -1,7 +0,0 @@
|
||||
[plugin]
|
||||
|
||||
name="Escoria Return to Monkey Island UI"
|
||||
description="Return to Monkey Island like UI for the Escoria Framework"
|
||||
author="Arkitekt"
|
||||
version="0.1.0"
|
||||
script="plugin.gd"
|
||||
@@ -1,24 +0,0 @@
|
||||
# Plugin script to initialize Escoria simple mouse UI
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
# Override function to return the plugin name.
|
||||
func get_plugin_name():
|
||||
return "escoria-ui-return-monkey-island"
|
||||
|
||||
|
||||
# Deregister UI
|
||||
func disable_plugin():
|
||||
print("Disabling plugin Escoria UI Simple Mouse.")
|
||||
EscoriaPlugin.deregister_ui("res://addons/escoria-ui-return-monkey-island/game.tscn")
|
||||
|
||||
|
||||
# Register UI with Escoria
|
||||
func enable_plugin():
|
||||
print("Enabling plugin Escoria UI Simple Mouse.")
|
||||
if not EscoriaPlugin.register_ui(self, "res://addons/escoria-ui-return-monkey-island/game.tscn"):
|
||||
get_editor_interface().set_plugin_enabled(
|
||||
get_plugin_name(),
|
||||
false
|
||||
)
|
||||
@@ -1,6 +0,0 @@
|
||||
[gd_resource type="Theme" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource( 1 )
|
||||
@@ -1,11 +0,0 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/tooltip/tooltip_target.gd" type="Script" id=2]
|
||||
|
||||
[node name="tooltip" type="RichTextLabel"]
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[center][color=#ffffff][/color][/center]"
|
||||
scroll_active = false
|
||||
script = ExtResource( 2 )
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
offset_from_cursor = Vector2( 0, 0 )
|
||||
@@ -1,28 +0,0 @@
|
||||
extends ESCTooltip
|
||||
|
||||
|
||||
signal tooltip_size_updated
|
||||
|
||||
|
||||
func update_tooltip_text():
|
||||
# Need to update size of bbcode rect before updating the text itself otherwise on the
|
||||
# first frame the text is wider than the default of 0 and ends up being really tall
|
||||
# and setting the wrong vertical margin for the tooltip
|
||||
update_size()
|
||||
|
||||
# We signal this here since the processing in this class happens AFTER input
|
||||
# processing. We signal here to avoid "lagging" behind a frame since
|
||||
# tooltips are presently dependent on the size of the bounding box around
|
||||
# the rendered string.
|
||||
emit_signal("tooltip_size_updated")
|
||||
|
||||
bbcode_text = "[center]"
|
||||
bbcode_text += "[color=#" + color.to_html(false) + "]"
|
||||
bbcode_text += current_target
|
||||
bbcode_text += "[/color]"
|
||||
bbcode_text += "[/center]"
|
||||
# push_align(RichTextLabel.ALIGN_CENTER)
|
||||
# push_color(color)
|
||||
# append_bbcode(current_target)
|
||||
# pop()
|
||||
# pop()
|
||||
@@ -1,53 +0,0 @@
|
||||
extends Control
|
||||
|
||||
|
||||
var current_cursor_id: int = 0
|
||||
onready var cursors: Array = $actions.get_children()
|
||||
|
||||
|
||||
"""
|
||||
This script is out of Escoria's scope. It controls the UI reaction to an
|
||||
UI event (eg right click) to change the cursor accordingly.
|
||||
"""
|
||||
enum UI_ACTIONS_DIRECTION {
|
||||
UP = 1,
|
||||
DOWN = -1
|
||||
}
|
||||
|
||||
func _ready():
|
||||
if !Engine.is_editor_hint():
|
||||
current_cursor_id = cursors.size()
|
||||
iterate_actions_cursor(UI_ACTIONS_DIRECTION.UP)
|
||||
|
||||
func _process(delta):
|
||||
$mouse_position.rect_global_position = get_global_mouse_position()
|
||||
|
||||
|
||||
func iterate_actions_cursor(direction: int):
|
||||
current_cursor_id += direction
|
||||
if current_cursor_id > cursors.size() - 1:
|
||||
current_cursor_id = 0
|
||||
elif current_cursor_id < 0:
|
||||
current_cursor_id = cursors.size() - 1
|
||||
|
||||
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
|
||||
escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
|
||||
if $mouse_position/tool.texture != null:
|
||||
clear_tool_texture()
|
||||
|
||||
func set_by_name(name: String) -> void:
|
||||
for i in cursors.size():
|
||||
if cursors[i].name == name:
|
||||
current_cursor_id = i
|
||||
break
|
||||
|
||||
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
|
||||
escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
|
||||
|
||||
func set_tool_texture(texture: Texture):
|
||||
set_process(true)
|
||||
$mouse_position/tool.texture = texture
|
||||
|
||||
func clear_tool_texture():
|
||||
$mouse_position/tool.texture = null
|
||||
set_process(false)
|
||||
@@ -1,91 +0,0 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/verbs_mouseicons.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/cursor_examine.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/cursor_tool.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/cursor_dialog.png" type="Texture" id=4]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/cursor_foot.png" type="Texture" id=5]
|
||||
[ext_resource path="res://addons/escoria-ui-return-monkey-island/cursors/cursor_hand.png" type="Texture" id=6]
|
||||
|
||||
[node name="verbs_menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="actions" type="HBoxContainer" parent="."]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="walk" type="TextureRect" parent="actions"]
|
||||
margin_left = 94.0
|
||||
margin_top = 418.0
|
||||
margin_right = 158.0
|
||||
margin_bottom = 482.0
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource( 5 )
|
||||
|
||||
[node name="look" type="TextureRect" parent="actions"]
|
||||
margin_left = 350.0
|
||||
margin_top = 418.0
|
||||
margin_right = 414.0
|
||||
margin_bottom = 482.0
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="pickup" type="TextureRect" parent="actions"]
|
||||
margin_left = 607.0
|
||||
margin_top = 418.0
|
||||
margin_right = 671.0
|
||||
margin_bottom = 482.0
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
[node name="use" type="TextureRect" parent="actions"]
|
||||
margin_left = 864.0
|
||||
margin_top = 418.0
|
||||
margin_right = 928.0
|
||||
margin_bottom = 482.0
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="talk" type="TextureRect" parent="actions"]
|
||||
margin_left = 1121.0
|
||||
margin_top = 418.0
|
||||
margin_right = 1185.0
|
||||
margin_bottom = 482.0
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource( 4 )
|
||||
|
||||
[node name="mouse_position" type="Control" parent="."]
|
||||
margin_left = 546.519
|
||||
margin_top = 524.76
|
||||
margin_right = 546.519
|
||||
margin_bottom = 524.76
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="tool" type="TextureRect" parent="mouse_position"]
|
||||
margin_left = 46.4475
|
||||
margin_top = 45.6984
|
||||
margin_right = 86.4475
|
||||
margin_bottom = 85.6984
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||