Initial commit of Escoria-Reloaded. Still a lot of missing stuff.
This commit is contained in:
62
game/ui/ui_9verbs/game.tscn
Normal file
62
game/ui/ui_9verbs/game.tscn
Normal file
@@ -0,0 +1,62 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/template_scenes/label/action_target_tooltip.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/inventory_ui.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/verbs_menu.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/dialogs/dialog_player.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/camera_player/camera.tscn" type="PackedScene" id=6]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.6, 0.6, 0.6, 0.5 )
|
||||
|
||||
[node name="game" type="Node"]
|
||||
|
||||
[node name="ui" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="panel_down" type="PanelContainer" parent="ui"]
|
||||
anchor_top = 0.714
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -0.200012
|
||||
custom_styles/panel = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="verbs_layer" type="CanvasLayer" parent="ui"]
|
||||
layer = 2
|
||||
|
||||
[node name="verbs_menu" parent="ui/verbs_layer" instance=ExtResource( 3 )]
|
||||
margin_left = 21.097
|
||||
margin_top = 615.331
|
||||
margin_right = 21.097
|
||||
margin_bottom = 615.331
|
||||
|
||||
[node name="inventory_layer" type="CanvasLayer" parent="ui"]
|
||||
layer = 2
|
||||
|
||||
[node name="inventory_ui" parent="ui/inventory_layer" instance=ExtResource( 2 )]
|
||||
margin_left = 661.041
|
||||
margin_top = 615.331
|
||||
margin_right = 661.041
|
||||
margin_bottom = 615.331
|
||||
|
||||
[node name="tooltip_layer" type="CanvasLayer" parent="ui"]
|
||||
layer = 2
|
||||
|
||||
[node name="tooltip" parent="ui/tooltip_layer" instance=ExtResource( 1 )]
|
||||
anchor_left = 0.208
|
||||
anchor_top = 0.722
|
||||
anchor_right = 0.734
|
||||
anchor_bottom = 0.77
|
||||
margin_left = 0.383453
|
||||
margin_top = 0.364075
|
||||
margin_right = 0.103394
|
||||
margin_bottom = -0.0359497
|
||||
|
||||
[node name="dialog_layer" type="CanvasLayer" parent="ui"]
|
||||
layer = 3
|
||||
|
||||
[node name="dialog_player" parent="ui/dialog_layer" instance=ExtResource( 4 )]
|
||||
|
||||
[node name="camera" parent="." instance=ExtResource( 6 )]
|
||||
37
game/ui/ui_9verbs/inventory_ui.tscn
Normal file
37
game/ui/ui_9verbs/inventory_ui.tscn
Normal file
@@ -0,0 +1,37 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/scenes/inventory/inventory_ui.gd" type="Script" id=1]
|
||||
[ext_resource path="res://game/items/all_items.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://game/ui/ui_9verbs/inventory_ui_container.gd" type="Script" id=3]
|
||||
|
||||
|
||||
[node name="inventory_ui" type="Control"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
items_container = NodePath("PanelContainer/ScrollContainer/GridContainer")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
margin_right = 600.0
|
||||
margin_bottom = 175.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 593.0
|
||||
margin_bottom = 168.0
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="PanelContainer/ScrollContainer"]
|
||||
margin_right = 586.0
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/vseparation = 16
|
||||
custom_constants/hseparation = 16
|
||||
columns = 4
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="all_items" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 269.391, 275.003 )
|
||||
42
game/ui/ui_9verbs/inventory_ui_container.gd
Normal file
42
game/ui/ui_9verbs/inventory_ui_container.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
extends Control
|
||||
|
||||
"""
|
||||
This script is totally user-defined. It does exactly what the user wants the
|
||||
inventory to look like. It only requires 4 functions to be defined:
|
||||
- is_empty() -> bool
|
||||
- get_items() -> Array
|
||||
- add_item(inventory_item : ESCInventoryItem)
|
||||
- remove_item(inventory_item : ESCInventoryItem)
|
||||
The user is free to implement these methods the way s-he likes.
|
||||
"""
|
||||
|
||||
var current_nodes_in_container = {}
|
||||
|
||||
func is_empty() -> bool:
|
||||
return get_child_count() > 0
|
||||
|
||||
func get_items() -> Array:
|
||||
return current_nodes_in_container.keys()
|
||||
|
||||
func add_item(inventory_item : ESCInventoryItem):
|
||||
var center_container = CenterContainer.new()
|
||||
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||
center_container.connect("mouse_exited", inventory_item, "_on_inventory_item_mouse_exit")
|
||||
center_container.connect("gui_input", self, "_on_gui_input", [inventory_item])
|
||||
center_container.add_child(inventory_item)
|
||||
add_child(center_container)
|
||||
current_nodes_in_container[inventory_item] = center_container
|
||||
|
||||
func remove_item(inventory_item : ESCInventoryItem):
|
||||
var node_to_remove = current_nodes_in_container[inventory_item]
|
||||
current_nodes_in_container.erase(node_to_remove)
|
||||
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||
node_to_remove.disconnect("mouse_exited", inventory_item, "_on_inventory_item_mouse_exit")
|
||||
node_to_remove.disconnect("pressed", self, "_on_gui_input")
|
||||
remove_child(node_to_remove)
|
||||
node_to_remove.queue_free()
|
||||
|
||||
func _on_gui_input(event : InputEvent, inventory_item : ESCInventoryItem):
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
inventory_item._on_inventory_item_pressed()
|
||||
14
game/ui/ui_9verbs/verbs_menu.gd
Normal file
14
game/ui/ui_9verbs/verbs_menu.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
func _ready():
|
||||
for but in $actions.get_children():
|
||||
but.connect("pressed", self, "_on_action_selected", [but.name])
|
||||
but.toggle_mode = true
|
||||
|
||||
func _on_action_selected(action : String):
|
||||
escoria.esc_runner.set_current_action(action)
|
||||
|
||||
for but in $actions.get_children():
|
||||
but.set_pressed(but.get_name() == action)
|
||||
|
||||
131
game/ui/ui_9verbs/verbs_menu.tscn
Normal file
131
game/ui/ui_9verbs/verbs_menu.tscn
Normal file
@@ -0,0 +1,131 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/ui_9verbs/verbs_menu.gd" type="Script" id=1]
|
||||
|
||||
|
||||
[node name="verbs_menu" type="Control"]
|
||||
margin_left = 1.0
|
||||
margin_right = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="actions" type="GridContainer" parent="."]
|
||||
margin_right = 333.0
|
||||
margin_bottom = 175.0
|
||||
columns = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="open" type="Button" parent="actions"]
|
||||
margin_right = 108.0
|
||||
margin_bottom = 55.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Open"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="pickup" type="Button" parent="actions"]
|
||||
margin_left = 112.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 55.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Pick up"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="push" type="Button" parent="actions"]
|
||||
margin_left = 224.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 55.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Push"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="close" type="Button" parent="actions"]
|
||||
margin_top = 59.0
|
||||
margin_right = 108.0
|
||||
margin_bottom = 114.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Close"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="look" type="Button" parent="actions"]
|
||||
margin_left = 112.0
|
||||
margin_top = 59.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 114.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Look at"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="pull" type="Button" parent="actions"]
|
||||
margin_left = 224.0
|
||||
margin_top = 59.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 114.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Pull"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="give" type="Button" parent="actions"]
|
||||
margin_top = 118.0
|
||||
margin_right = 108.0
|
||||
margin_bottom = 173.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Give"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="use" type="Button" parent="actions"]
|
||||
margin_left = 112.0
|
||||
margin_top = 118.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 173.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Use"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="talk" type="Button" parent="actions"]
|
||||
margin_left = 224.0
|
||||
margin_top = 118.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 173.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
text = "Talk"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
Reference in New Issue
Block a user