diff options
Diffstat (limited to 'client/menu')
19 files changed, 257 insertions, 17 deletions
diff --git a/client/menu/chat/chat_message.gd b/client/menu/communicate/chat/chat_message.gd index 1cc57102..1cc57102 100644 --- a/client/menu/chat/chat_message.gd +++ b/client/menu/communicate/chat/chat_message.gd diff --git a/client/menu/chat/chat_message.tscn b/client/menu/communicate/chat/chat_message.tscn index c72deb7b..a095c42e 100644 --- a/client/menu/chat/chat_message.tscn +++ b/client/menu/communicate/chat/chat_message.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://bpc2qgsvcafhe"] -[ext_resource type="Script" path="res://menu/chat/chat_message.gd" id="1_ey0qp"] +[ext_resource type="Script" path="res://menu/communicate/chat/chat_message.gd" id="1_ey0qp"] [ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_rx6vg"] [sub_resource type="FontVariation" id="FontVariation_jfhbh"] diff --git a/client/menu/chat/chat_open.gd b/client/menu/communicate/chat/chat_open.gd index 576568ee..c67a1b1c 100644 --- a/client/menu/chat/chat_open.gd +++ b/client/menu/communicate/chat/chat_open.gd @@ -16,7 +16,7 @@ extends Menu class_name ChatOpen -const CHAT_MESSAGE_SCENE = preload("res://menu/chat/chat_message.tscn") +const CHAT_MESSAGE_SCENE = preload("res://menu/communicate/chat/chat_message.tscn") @onready var messages_container: VBoxContainer = $PanelContainer/MarginContainer/VBoxContainer/ScrollContainerCustom/Messages @onready var line: LineEdit = $PanelContainer/MarginContainer/VBoxContainer/LineEdit diff --git a/client/menu/chat/chat_open.tscn b/client/menu/communicate/chat/chat_open.tscn index 6d03b391..0247a1ca 100644 --- a/client/menu/chat/chat_open.tscn +++ b/client/menu/communicate/chat/chat_open.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=3 uid="uid://dbd6k56l4p0ls"] -[ext_resource type="Script" path="res://menu/chat/chat_open.gd" id="1_dsl4a"] +[ext_resource type="Script" path="res://menu/communicate/chat/chat_open.gd" id="1_dsl4a"] [ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="1_isqmk"] [ext_resource type="Script" path="res://menu/blur_setup.gd" id="2_urbd2"] [ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="3_v7xmg"] diff --git a/client/menu/chat/chat_preview.gd b/client/menu/communicate/chat/chat_preview.gd index 7f8212b5..14713f7e 100644 --- a/client/menu/chat/chat_preview.gd +++ b/client/menu/communicate/chat/chat_preview.gd @@ -16,7 +16,7 @@ extends Control class_name ChatPreview -const CHAT_MESSAGE_SCENE = preload("res://menu/chat/chat_message.tscn") +const CHAT_MESSAGE_SCENE = preload("res://menu/communicate/chat/chat_message.tscn") @onready var game: Game = $"../Game" @onready var messages_container: VBoxContainer = $MarginContainer/ScrollContainer/PanelContainer/Messages diff --git a/client/menu/chat/chat_preview.tscn b/client/menu/communicate/chat/chat_preview.tscn index a50b138a..4cc39e00 100644 --- a/client/menu/chat/chat_preview.tscn +++ b/client/menu/communicate/chat/chat_preview.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=3 uid="uid://xcxbmynn8mhi"] [ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_x8ock"] -[ext_resource type="Script" path="res://menu/chat/chat_preview.gd" id="2_72x70"] +[ext_resource type="Script" path="res://menu/communicate/chat/chat_preview.gd" id="2_72x70"] [ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="4_jo1xn"] [ext_resource type="Script" path="res://menu/blur_setup.gd" id="5_1l77s"] diff --git a/client/menu/communicate/item/item_message.gd b/client/menu/communicate/item/item_message.gd new file mode 100644 index 00000000..53e6ff22 --- /dev/null +++ b/client/menu/communicate/item/item_message.gd @@ -0,0 +1,65 @@ +# Hurry Curry! - a game about cooking +# Copyright 2024 nokoe +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +class_name ItemMessage +extends Control + +var timeout_remaining := 0. +var timeout_initial := 0. + +@onready var item_render: ItemRender = $VBoxContainer/SubViewportContainer/SubViewport/ItemRender +@onready var progress: ProgressBar = $VBoxContainer/ProgressBar +@onready var sub_viewport: SubViewport = $VBoxContainer/SubViewportContainer/SubViewport +@onready var v_box_container: VBoxContainer = $VBoxContainer + +#func _init(): +# progress_style = progress_style.duplicate() + +func set_subviewport_size(sub_viewport_size: Vector2): + sub_viewport.size = sub_viewport_size + progress.custom_minimum_size.y = sub_viewport_size.x - sub_viewport_size.y + v_box_container.size.y = 0 + +func set_round_corner_radius_progress(radius: int): + var style_bg: StyleBoxFlat = progress.get_theme_stylebox("background") + var style_fill: StyleBoxFlat = progress.get_theme_stylebox("fill") + + style_bg.corner_radius_bottom_left = radius + style_bg.corner_radius_bottom_right = radius + style_fill.corner_radius_bottom_left = radius + style_fill.corner_radius_bottom_right = radius + +func set_item(item_name: String, timeout_initial_: float, timeout_remaining_: float): + item_render.set_item(item_name) + + timeout_remaining = timeout_remaining_ + timeout_initial = timeout_initial_ + progress.max_value = timeout_initial + progress.value = timeout_remaining + +func remove_item(): + item_render.remove_item() + +func _process(delta): + if item_render.item != null: + timeout_remaining -= delta + progress.value = timeout_remaining + var x: float = timeout_remaining / timeout_initial + var progress_style: StyleBoxFlat = progress.get_theme_stylebox("fill") + progress_style.bg_color = Color(min((1-x) * 2, 1), min(x * 2, 1), 0.) + if progress_style.corner_radius_bottom_right != 0: + progress_style.corner_radius_bottom_right = max(32.-(1.-x)*320, 0) + progress.add_theme_stylebox_override("fill", progress_style) diff --git a/client/menu/communicate/item/item_message.tscn b/client/menu/communicate/item/item_message.tscn new file mode 100644 index 00000000..c0b0ea95 --- /dev/null +++ b/client/menu/communicate/item/item_message.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=6 format=3 uid="uid://fkqh36s4vl3p"] + +[ext_resource type="Script" path="res://menu/communicate/item/item_message.gd" id="1_76lg0"] +[ext_resource type="PackedScene" uid="uid://cem5xcld6vn51" path="res://menu/communicate/item/item_render.tscn" id="1_sju7l"] +[ext_resource type="StyleBox" uid="uid://brw8uogdgx2gf" path="res://menu/theme/style/item_bubble_progress_style.tres" id="3_ipe76"] +[ext_resource type="StyleBox" uid="uid://cu0his4018e7h" path="res://menu/theme/style/item_bubble_progress_style_background.tres" id="3_t61n3"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dpele"] +bg_color = Color(1, 1, 1, 1) +corner_radius_top_left = 30 +corner_radius_top_right = 30 +corner_radius_bottom_right = 30 +corner_radius_bottom_left = 30 + +[node name="ItemMessage" type="PanelContainer"] +auto_translate_mode = 2 +offset_right = 256.0 +offset_bottom = 256.0 +size_flags_vertical = 0 +theme_override_styles/panel = SubResource("StyleBoxFlat_dpele") +script = ExtResource("1_76lg0") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 +size_flags_vertical = 0 +theme_override_constants/separation = 0 + +[node name="SubViewportContainer" type="SubViewportContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="SubViewport" type="SubViewport" parent="VBoxContainer/SubViewportContainer"] +own_world_3d = true +transparent_bg = true +handle_input_locally = false +size = Vector2i(256, 224) +render_target_update_mode = 4 + +[node name="ItemRender" parent="VBoxContainer/SubViewportContainer/SubViewport" instance=ExtResource("1_sju7l")] + +[node name="ProgressBar" type="ProgressBar" parent="VBoxContainer"] +custom_minimum_size = Vector2(0, 32) +layout_mode = 2 +theme_override_styles/background = ExtResource("3_t61n3") +theme_override_styles/fill = ExtResource("3_ipe76") +step = 0.0 +value = 100.0 +show_percentage = false diff --git a/client/menu/communicate/item/item_render.gd b/client/menu/communicate/item/item_render.gd new file mode 100644 index 00000000..cd7d726a --- /dev/null +++ b/client/menu/communicate/item/item_render.gd @@ -0,0 +1,35 @@ +# Hurry Curry! - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +extends Node3D +class_name ItemRender + +var item: Item + +@onready var base = $ItemBase + +func set_item(item_name: String): + if item != null: + remove_item() + + item = ItemFactory.produce(item_name, base) + base.add_child(item) + +func remove_item(): + if item != null: + item.queue_free() + +func _process(delta: float): + base.rotation.y += delta * TAU * .025 diff --git a/client/menu/communicate/item/item_render.tscn b/client/menu/communicate/item/item_render.tscn new file mode 100644 index 00000000..1309509e --- /dev/null +++ b/client/menu/communicate/item/item_render.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=3 format=3 uid="uid://cem5xcld6vn51"] + +[ext_resource type="Script" path="res://menu/communicate/item/item_render.gd" id="1_jfi7o"] + +[sub_resource type="Environment" id="Environment_iyxrx"] +ambient_light_source = 2 +ambient_light_color = Color(1, 1, 1, 1) +ambient_light_energy = 0.5 + +[node name="ItemRender" type="Node3D"] +script = ExtResource("1_jfi7o") + +[node name="Camera3D" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 0.5, 1) +projection = 1 +size = 0.6 + +[node name="ItemBase" type="Node3D" parent="."] + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.173648, 0.984808, 0, -0.984808, 0.173648, 0, 0, 0) +light_energy = 0.5 + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_iyxrx") diff --git a/client/menu/communicate/popup_message/pinned_item_messages.gd b/client/menu/communicate/popup_message/pinned_item_messages.gd new file mode 100644 index 00000000..7343865c --- /dev/null +++ b/client/menu/communicate/popup_message/pinned_item_messages.gd @@ -0,0 +1,32 @@ +# Hurry Curry! - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +extends Control +class_name PinnedItemMessages + +const ITEM_MESSAGE_SCENE := preload("res://menu/communicate/item/item_message.tscn") +const PAPER_PANEL_STYLE := preload("res://menu/theme/paper_panel_style.tres") + +@onready var pinned_items_container: HBoxContainer = $HBoxContainer + +func pin_item(item_name: String, timeout_initial_: float, timeout_remaining_: float): + var item_message: ItemMessage = ITEM_MESSAGE_SCENE.instantiate() + item_message.remove_theme_stylebox_override("panel") + item_message.add_theme_stylebox_override("panel", PAPER_PANEL_STYLE) + pinned_items_container.add_child(item_message) + item_message.set_subviewport_size(Vector2(96, 84)) + item_message.set_round_corner_radius_progress(0) + + item_message.set_item(item_name, timeout_initial_, timeout_remaining_) diff --git a/client/menu/communicate/popup_message/pinned_item_messages.tscn b/client/menu/communicate/popup_message/pinned_item_messages.tscn new file mode 100644 index 00000000..e53b27c3 --- /dev/null +++ b/client/menu/communicate/popup_message/pinned_item_messages.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=2 format=3 uid="uid://dcrr1rwdwbkq8"] + +[ext_resource type="Script" path="res://menu/communicate/popup_message/pinned_item_messages.gd" id="1_q0jkk"] + +[node name="PinnedItemMessages" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("1_q0jkk") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 256.0 +grow_horizontal = 2 +mouse_filter = 2 diff --git a/client/menu/popup_message/popup_message.gd b/client/menu/communicate/popup_message/popup_message.gd index 6c2c2c0e..6c2c2c0e 100644 --- a/client/menu/popup_message/popup_message.gd +++ b/client/menu/communicate/popup_message/popup_message.gd diff --git a/client/menu/popup_message/popup_message.tscn b/client/menu/communicate/popup_message/popup_message.tscn index 659a5b7e..799712e1 100644 --- a/client/menu/popup_message/popup_message.tscn +++ b/client/menu/communicate/popup_message/popup_message.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=12 format=3 uid="uid://b21nrnkygiyjt"] [ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_a1566"] -[ext_resource type="Script" path="res://menu/popup_message/popup_message.gd" id="2_sbew6"] +[ext_resource type="Script" path="res://menu/communicate/popup_message/popup_message.gd" id="2_sbew6"] [ext_resource type="Shader" path="res://menu/blur_mix.gdshader" id="3_2vnom"] -[ext_resource type="PackedScene" uid="uid://dq61p3a8og2b6" path="res://menu/popup_message/server_message.tscn" id="3_m3rok"] +[ext_resource type="PackedScene" uid="uid://dq61p3a8og2b6" path="res://menu/communicate/popup_message/server_message.tscn" id="3_m3rok"] [ext_resource type="Script" path="res://menu/blur_setup.gd" id="4_pvwmw"] [ext_resource type="FontFile" uid="uid://bk704sc5gkrb3" path="res://menu/theme/font-azaret-mono.woff2" id="4_wsrnf"] [ext_resource type="Texture2D" uid="uid://b2uv5rf0enikf" path="res://menu/hint.svg" id="5_2dxsd"] diff --git a/client/menu/popup_message/server_message.tscn b/client/menu/communicate/popup_message/server_message.tscn index b7ad98f4..63160942 100644 --- a/client/menu/popup_message/server_message.tscn +++ b/client/menu/communicate/popup_message/server_message.tscn @@ -1,11 +1,11 @@ [gd_scene load_steps=8 format=3 uid="uid://dq61p3a8og2b6"] -[ext_resource type="Shader" path="res://menu/blur_mix.gdshader" id="1_la056"] -[ext_resource type="Script" path="res://menu/blur_setup.gd" id="2_uinkj"] -[ext_resource type="FontFile" uid="uid://bk704sc5gkrb3" path="res://menu/theme/font-azaret-mono.woff2" id="3_7fupk"] +[ext_resource type="Shader" path="res://menu/blur_mix.gdshader" id="1_qv8ew"] +[ext_resource type="Script" path="res://menu/blur_setup.gd" id="2_80a6b"] +[ext_resource type="FontFile" uid="uid://bk704sc5gkrb3" path="res://menu/theme/font-azaret-mono.woff2" id="3_dw20j"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_q3bbd"] -shader = ExtResource("1_la056") +shader = ExtResource("1_qv8ew") shader_parameter/blur_amount = 3.5 shader_parameter/mix_amount = 0.85 shader_parameter/mix_amount_no_blur = 0.85 @@ -20,7 +20,7 @@ corner_radius_bottom_right = 16 corner_radius_bottom_left = 16 [sub_resource type="FontVariation" id="FontVariation_qfltj"] -base_font = ExtResource("3_7fupk") +base_font = ExtResource("3_dw20j") variation_embolden = 0.75 [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3rgop"] @@ -35,7 +35,7 @@ size_flags_horizontal = 4 size_flags_vertical = 0 mouse_filter = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_vq4dg") -script = ExtResource("2_uinkj") +script = ExtResource("2_80a6b") [node name="CenterContainer" type="CenterContainer" parent="."] layout_mode = 2 diff --git a/client/menu/game.gd b/client/menu/game.gd index fb0d2fa9..70f28636 100644 --- a/client/menu/game.gd +++ b/client/menu/game.gd @@ -34,7 +34,7 @@ func _input(_event): if Input.is_action_just_pressed("chat"): Sound.play_click() chat_preview.visible = false - await submenu("res://menu/chat/chat_open.tscn") + await submenu("res://menu/communicate/chat/chat_open.tscn") chat_preview.visible = true func _menu_cover(state): diff --git a/client/menu/game.tscn b/client/menu/game.tscn index 23929591..d3a3b446 100644 --- a/client/menu/game.tscn +++ b/client/menu/game.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=7 format=3 uid="uid://bbjwoxs71fnsk"] +[gd_scene load_steps=8 format=3 uid="uid://bbjwoxs71fnsk"] [ext_resource type="Script" path="res://menu/game.gd" id="1_cdpsh"] [ext_resource type="PackedScene" uid="uid://c6krh36hoqfg8" path="res://game.tscn" id="2_uojcy"] [ext_resource type="PackedScene" uid="uid://bpikve6wlsjfl" path="res://menu/overlay.tscn" id="3_i0ytb"] [ext_resource type="PackedScene" uid="uid://bc50la65ntifb" path="res://menu/lobby.tscn" id="3_udxby"] -[ext_resource type="PackedScene" uid="uid://b21nrnkygiyjt" path="res://menu/popup_message/popup_message.tscn" id="5_n1wy0"] -[ext_resource type="PackedScene" uid="uid://xcxbmynn8mhi" path="res://menu/chat/chat_preview.tscn" id="6_dh5lr"] +[ext_resource type="PackedScene" uid="uid://b21nrnkygiyjt" path="res://menu/communicate/popup_message/popup_message.tscn" id="5_n1wy0"] +[ext_resource type="PackedScene" uid="uid://xcxbmynn8mhi" path="res://menu/communicate/chat/chat_preview.tscn" id="6_dh5lr"] +[ext_resource type="PackedScene" uid="uid://dcrr1rwdwbkq8" path="res://menu/communicate/popup_message/pinned_item_messages.tscn" id="7_lf2li"] [node name="GameMenu" type="Control"] layout_mode = 3 @@ -40,3 +41,6 @@ layout_mode = 1 [node name="ChatPreview" parent="." instance=ExtResource("6_dh5lr")] layout_mode = 1 + +[node name="PinnedItemMessages" parent="." instance=ExtResource("7_lf2li")] +layout_mode = 1 diff --git a/client/menu/theme/paper_panel_style.tres b/client/menu/theme/paper_panel_style.tres new file mode 100644 index 00000000..5a8a4a78 --- /dev/null +++ b/client/menu/theme/paper_panel_style.tres @@ -0,0 +1,6 @@ +[gd_resource type="StyleBoxTexture" load_steps=2 format=3 uid="uid://bqhs5wtdp2oax"] + +[ext_resource type="Texture2D" uid="uid://chxkwohi56cxx" path="res://menu/theme/paper_texture.tres" id="1_u1kqj"] + +[resource] +texture = ExtResource("1_u1kqj") diff --git a/client/menu/theme/style/item_bubble_progress_style_background.tres b/client/menu/theme/style/item_bubble_progress_style_background.tres new file mode 100644 index 00000000..02362554 --- /dev/null +++ b/client/menu/theme/style/item_bubble_progress_style_background.tres @@ -0,0 +1,5 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://cu0his4018e7h"] + +[resource] +corner_radius_bottom_right = 32 +corner_radius_bottom_left = 32 |