From d1ed0e0e4497e91ea3ad18abd4325cf7fa5b42b3 Mon Sep 17 00:00:00 2001 From: jwapobie Date: Sat, 4 Jan 2025 14:32:18 -0500 Subject: [PATCH] neuro integration toggle and overlay input blocker --- default_theme.tres | 23 ++- fonts/Nebulous Content.otf | 3 + fonts/Nebulous Content.otf.import | 39 +++++ objects/neuro_integration_option_button.gd | 9 ++ objects/neuro_ui/neuro_control_overlay.gd | 22 +++ objects/tooltip/item_selection.tscn | 4 +- .../upgrade_screen}/upgrade_screen.gd | 9 +- .../upgrade_screen}/upgrade_screen.tscn | 2 +- scenes/gameplay.tscn | 135 ++++++++++++------ scenes/main_menu.tscn | 37 ++++- scripts/game_state.gd | 2 + 11 files changed, 236 insertions(+), 49 deletions(-) create mode 100644 fonts/Nebulous Content.otf create mode 100644 fonts/Nebulous Content.otf.import create mode 100644 objects/neuro_integration_option_button.gd create mode 100644 objects/neuro_ui/neuro_control_overlay.gd rename {scenes => objects/upgrade_screen}/upgrade_screen.gd (94%) rename {scenes => objects/upgrade_screen}/upgrade_screen.tscn (95%) diff --git a/default_theme.tres b/default_theme.tres index 6dc8dd0..0229b82 100644 --- a/default_theme.tres +++ b/default_theme.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=5 format=3 uid="uid://5c0tm6smuwr6"] +[gd_resource type="Theme" load_steps=7 format=3 uid="uid://5c0tm6smuwr6"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_n0lpc"] content_margin_left = 10.0 @@ -44,9 +44,30 @@ corner_radius_top_right = 4 corner_radius_bottom_right = 4 corner_radius_bottom_left = 4 +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m3wfb"] +bg_color = Color(0.699879, 0.453051, 0.323543, 1) +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_anxdp"] +content_margin_left = 3.0 +content_margin_top = 3.0 +content_margin_right = 3.0 +content_margin_bottom = 3.0 +bg_color = Color(0.270125, 0.184323, 0.24791, 1) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.31568, 0.19885, 0.267815, 1) + [resource] Button/font_sizes/font_size = 24 Button/styles/focus = SubResource("StyleBoxEmpty_n0lpc") Button/styles/hover = SubResource("StyleBoxFlat_2g5uo") Button/styles/normal = SubResource("StyleBoxFlat_smswd") Button/styles/pressed = SubResource("StyleBoxFlat_xmtrs") +PopupMenu/styles/hover = SubResource("StyleBoxFlat_m3wfb") +PopupMenu/styles/panel = SubResource("StyleBoxFlat_anxdp") diff --git a/fonts/Nebulous Content.otf b/fonts/Nebulous Content.otf new file mode 100644 index 0000000..f1fd7d5 --- /dev/null +++ b/fonts/Nebulous Content.otf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9fe63c486bea23b239ac7b600cb740e8a251aff83a9f3846d8e4c951f63c4f8 +size 20572 diff --git a/fonts/Nebulous Content.otf.import b/fonts/Nebulous Content.otf.import new file mode 100644 index 0000000..d2d4099 --- /dev/null +++ b/fonts/Nebulous Content.otf.import @@ -0,0 +1,39 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bjv5hli5b22x2" +path="res://.godot/imported/Nebulous Content.otf-0b22f1d23cdb2d0a282336d59332910b.fontdata" + +[deps] + +source_file="res://fonts/Nebulous Content.otf" +dest_files=["res://.godot/imported/Nebulous Content.otf-0b22f1d23cdb2d0a282336d59332910b.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=true +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] +language_support={} +script_support={} +opentype_features={} diff --git a/objects/neuro_integration_option_button.gd b/objects/neuro_integration_option_button.gd new file mode 100644 index 0000000..b62691b --- /dev/null +++ b/objects/neuro_integration_option_button.gd @@ -0,0 +1,9 @@ +extends OptionButton + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + item_selected.connect(select_option) + +func select_option(option: int) -> void: + GameState.neuro_integration_mode = option diff --git a/objects/neuro_ui/neuro_control_overlay.gd b/objects/neuro_ui/neuro_control_overlay.gd new file mode 100644 index 0000000..acefb30 --- /dev/null +++ b/objects/neuro_ui/neuro_control_overlay.gd @@ -0,0 +1,22 @@ +extends Control +@onready var texture_rect: TextureRect = $TextureRect + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + visible = false + GameState.neuro_wait_started.connect(show_overlay) + GameState.neuro_wait_ended.connect(hide_overlay) + + +func show_overlay() -> void: + visible = true + texture_rect.modulate = Color.TRANSPARENT + var tween := create_tween() + tween.tween_property(texture_rect, 'modulate', Color.WHITE, 0.25) + +func hide_overlay() -> void: + var tween := create_tween() + tween.tween_property(texture_rect, 'modulate', Color.TRANSPARENT, 0.25) + await tween.finished + visible = false diff --git a/objects/tooltip/item_selection.tscn b/objects/tooltip/item_selection.tscn index 02aee81..66e8ccd 100644 --- a/objects/tooltip/item_selection.tscn +++ b/objects/tooltip/item_selection.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=7 format=3 uid="uid://db0q2oseq1tiw"] +[gd_scene load_steps=8 format=3 uid="uid://db0q2oseq1tiw"] [ext_resource type="Texture2D" uid="uid://ec4ody0rmgd0" path="res://icon.svg" id="1_hxeww"] [ext_resource type="Script" path="res://objects/tooltip/item_selection.gd" id="1_q738r"] [ext_resource type="Script" path="res://scripts/utility/sound_button.gd" id="2_27dig"] [ext_resource type="PackedScene" uid="uid://d3urw8d4uyseg" path="res://objects/tooltip/item_description.tscn" id="2_oco1m"] +[ext_resource type="AudioStream" uid="uid://bds1n7s2v17ni" path="res://audio/UIClick_Hand Pop UI Diminished 1_RogueWaves_KawaiiUI.wav" id="3_bolpl"] [ext_resource type="FontFile" uid="uid://byc1ouwicguue" path="res://fonts/OpenSans-Bold.ttf" id="3_y6osn"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pywe8"] @@ -32,6 +33,7 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 1 script = ExtResource("2_27dig") +sound_on_press = ExtResource("3_bolpl") [node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 1 diff --git a/scenes/upgrade_screen.gd b/objects/upgrade_screen/upgrade_screen.gd similarity index 94% rename from scenes/upgrade_screen.gd rename to objects/upgrade_screen/upgrade_screen.gd index bc23fc7..d55fb6e 100644 --- a/scenes/upgrade_screen.gd +++ b/objects/upgrade_screen/upgrade_screen.gd @@ -41,7 +41,6 @@ var items_have_changed: bool = false func _ready() -> void: if OS.has_feature("no_particles"): gpu_particles_2d.visible = false - #show_upgrades() func _process(_delta: float) -> void: if items_have_changed: @@ -59,6 +58,8 @@ func animate_screen_appear() -> void: func show_upgrades() -> void: animate_screen_appear() + if GameState.neuro_integration_mode != GameState.NEURO_INTEGRATION_MODE.Off: + GameState.neuro_wait_started.emit() var upgrade_choices :Array[PackedScene] = upgrade_prefabs.duplicate() for i in range(upgrade_choices.size() - 1, -1, -1): if GameState.upgrades_block.has(i): @@ -93,7 +94,7 @@ func show_upgrades() -> void: item_select_callback.select_callback = on_select item_select_callbacks.append(item_select_callback) - await get_tree().create_timer(5).timeout + await get_tree().create_timer(0.5).timeout create_actions(item_select_callbacks) func on_upgrade_selected(item: PackedScene, is_unique :bool) -> void: @@ -101,11 +102,15 @@ func on_upgrade_selected(item: PackedScene, is_unique :bool) -> void: var button := child as Button if button: button.disabled = true + + var event := EventUpgradeSelected.new() event.upgrade_item = item EventBus.queue_event(event) if is_unique: GameState.upgrades_block.append(upgrade_prefabs.find(item)) + if GameState.neuro_integration_mode != GameState.NEURO_INTEGRATION_MODE.Off: + GameState.neuro_wait_ended.emit() func on_button_hover(item: Item) -> void: diff --git a/scenes/upgrade_screen.tscn b/objects/upgrade_screen/upgrade_screen.tscn similarity index 95% rename from scenes/upgrade_screen.tscn rename to objects/upgrade_screen/upgrade_screen.tscn index 04d9e0d..a044508 100644 --- a/scenes/upgrade_screen.tscn +++ b/objects/upgrade_screen/upgrade_screen.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://cbm78yibra6u3"] -[ext_resource type="Script" path="res://scenes/upgrade_screen.gd" id="1_rythi"] +[ext_resource type="Script" path="res://objects/upgrade_screen/upgrade_screen.gd" id="1_rythi"] [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_k11sl"] particle_flag_disable_z = true diff --git a/scenes/gameplay.tscn b/scenes/gameplay.tscn index 4dc28bb..83b156f 100644 --- a/scenes/gameplay.tscn +++ b/scenes/gameplay.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://cuwq5a1ylpiw0"] +[gd_scene load_steps=24 format=3 uid="uid://cuwq5a1ylpiw0"] [ext_resource type="Script" path="res://scenes/gameplay.gd" id="1_cgi25"] [ext_resource type="Script" path="res://objects/card_player/card_hand.gd" id="2_jcadc"] @@ -8,13 +8,15 @@ [ext_resource type="Script" path="res://scripts/utility/sound_button.gd" id="4_ullpb"] [ext_resource type="AudioStream" uid="uid://bxeun3p5fmv8b" path="res://audio/UIClick_Operating System UI Cursor_RogueWaves_KawaiiUI.wav" id="5_bqihu"] [ext_resource type="Script" path="res://objects/score_counter/score_display.gd" id="5_f3pnb"] -[ext_resource type="PackedScene" uid="uid://cbm78yibra6u3" path="res://scenes/upgrade_screen.tscn" id="6_6v1j0"] +[ext_resource type="PackedScene" uid="uid://cbm78yibra6u3" path="res://objects/upgrade_screen/upgrade_screen.tscn" id="6_6v1j0"] [ext_resource type="Script" path="res://scenes/items_container.gd" id="6_bg8mw"] [ext_resource type="Script" path="res://objects/score_counter/add_display.gd" id="6_yy4x3"] [ext_resource type="Script" path="res://objects/health_display/health_display.gd" id="7_6u6od"] [ext_resource type="Script" path="res://objects/health_display/add_display.gd" id="8_lp0fn"] [ext_resource type="Script" path="res://scenes/past_hands.gd" id="10_oblqp"] [ext_resource type="Script" path="res://scripts/utility/tooltipped.gd" id="10_xu2qm"] +[ext_resource type="FontFile" uid="uid://bjv5hli5b22x2" path="res://fonts/Nebulous Content.otf" id="14_5g5dt"] +[ext_resource type="Script" path="res://objects/neuro_ui/neuro_control_overlay.gd" id="14_qe8ue"] [ext_resource type="Script" path="res://scenes/quit_run_button.gd" id="16_3gbey"] [ext_resource type="Script" path="res://objects/volume_slider.gd" id="17_pimmb"] @@ -22,6 +24,16 @@ _data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] point_count = 2 +[sub_resource type="Gradient" id="Gradient_heoua"] +offsets = PackedFloat32Array(0.442786, 0.895522, 1) +colors = PackedColorArray(0.506929, 0.322586, 0.492271, 0, 0.828305, 0.764115, 0.823202, 0.651786, 1, 1, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_d4tdq"] +gradient = SubResource("Gradient_heoua") +fill = 1 +fill_from = Vector2(0.5, 0.5) +fill_to = Vector2(1.5, 0) + [sub_resource type="GDScript" id="GDScript_jtk48"] script/source = "extends Label @@ -89,47 +101,6 @@ mouse_filter = 1 text = "Sort Value" script = ExtResource("4_ullpb") -[node name="SpeedControl" type="HBoxContainer" parent="."] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -279.0 -offset_top = 14.0 -offset_right = -11.0 -offset_bottom = 41.0 -grow_horizontal = 0 -alignment = 2 -script = ExtResource("2_w836i") - -[node name="Label" type="Label" parent="SpeedControl"] -layout_mode = 2 -text = "Speed:" - -[node name="SpeedSlowButton" type="Button" parent="SpeedControl"] -custom_minimum_size = Vector2(40, 0) -layout_mode = 2 -theme_override_font_sizes/font_size = 16 -toggle_mode = true -text = "0.5x" -script = ExtResource("4_ullpb") - -[node name="SpeedNormalButton" type="Button" parent="SpeedControl"] -custom_minimum_size = Vector2(40, 0) -layout_mode = 2 -theme_override_font_sizes/font_size = 16 -toggle_mode = true -text = "1x" -script = ExtResource("4_ullpb") - -[node name="SpeedFastButton" type="Button" parent="SpeedControl"] -custom_minimum_size = Vector2(40, 0) -layout_mode = 2 -theme_override_font_sizes/font_size = 16 -toggle_mode = true -text = "3x" -script = ExtResource("4_ullpb") - [node name="Button" type="Button" parent="."] visible = false layout_mode = 1 @@ -496,6 +467,84 @@ layout_mode = 1 [node name="EventHandler" type="Node" parent="."] script = ExtResource("4_c7t3g") +[node name="NeuroControlOverlay" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("14_qe8ue") + +[node name="Label" type="Label" parent="NeuroControlOverlay"] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -113.5 +offset_top = 21.0 +offset_right = 113.5 +offset_bottom = 44.0 +grow_horizontal = 2 +theme_override_colors/font_shadow_color = Color(0.748738, 0.0115674, 0.751088, 1) +theme_override_constants/shadow_offset_x = 0 +theme_override_constants/shadow_offset_y = 3 +theme_override_fonts/font = ExtResource("14_5g5dt") +theme_override_font_sizes/font_size = 24 +text = "Neuro is choosing an action..." +horizontal_alignment = 1 + +[node name="TextureRect" type="TextureRect" parent="NeuroControlOverlay"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 0 +texture = SubResource("GradientTexture2D_d4tdq") + +[node name="SpeedControl" type="HBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -279.0 +offset_top = 14.0 +offset_right = -11.0 +offset_bottom = 41.0 +grow_horizontal = 0 +alignment = 2 +script = ExtResource("2_w836i") + +[node name="Label" type="Label" parent="SpeedControl"] +layout_mode = 2 +text = "Speed:" + +[node name="SpeedSlowButton" type="Button" parent="SpeedControl"] +custom_minimum_size = Vector2(40, 0) +layout_mode = 2 +theme_override_font_sizes/font_size = 16 +toggle_mode = true +text = "0.5x" +script = ExtResource("4_ullpb") + +[node name="SpeedNormalButton" type="Button" parent="SpeedControl"] +custom_minimum_size = Vector2(40, 0) +layout_mode = 2 +theme_override_font_sizes/font_size = 16 +toggle_mode = true +text = "1x" +script = ExtResource("4_ullpb") + +[node name="SpeedFastButton" type="Button" parent="SpeedControl"] +custom_minimum_size = Vector2(40, 0) +layout_mode = 2 +theme_override_font_sizes/font_size = 16 +toggle_mode = true +text = "3x" +script = ExtResource("4_ullpb") + [node name="PastHands" type="Control" parent="."] layout_mode = 1 anchors_preset = 11 diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn index 4191e9a..91aa67e 100644 --- a/scenes/main_menu.tscn +++ b/scenes/main_menu.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=5 format=3 uid="uid://bt087mwc204t2"] +[gd_scene load_steps=7 format=3 uid="uid://bt087mwc204t2"] [ext_resource type="Texture2D" uid="uid://b6gppx3mdxwik" path="res://icons/pocky.png" id="2_kunl1"] [ext_resource type="Script" path="res://objects/quit_button.gd" id="2_lwwgd"] [ext_resource type="FontFile" uid="uid://clkjryi7d3f4q" path="res://fonts/Cthulhu's Calling.otf" id="2_ytlxq"] [ext_resource type="Script" path="res://objects/review_screen/restart_button.gd" id="3_2c2ra"] +[ext_resource type="Script" path="res://objects/neuro_integration_option_button.gd" id="5_duq54"] +[ext_resource type="Script" path="res://scripts/utility/tooltipped.gd" id="5_mvqme"] [node name="MainMenu" type="Control"] layout_mode = 3 @@ -82,3 +84,36 @@ offset_right = 492.0 offset_bottom = 2.0 grow_vertical = 0 texture = ExtResource("2_kunl1") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -273.0 +offset_top = -56.0 +offset_right = -17.0 +offset_bottom = -16.0 +grow_horizontal = 0 +grow_vertical = 0 + +[node name="Label" type="Label" parent="HBoxContainer"] +layout_mode = 2 +text = "Neuro Integration:" +script = ExtResource("5_mvqme") +tooltip_content = "Enables Neuro-sama SDK integration. +<*Off:> No integration. +<*Co-Op:> Neuro will choose your upgrades. You will need to play with her item choices. +<*Autonomous:> Neuro will play the game herself. (Not implemented)" + +[node name="OptionButton" type="OptionButton" parent="HBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 18 +selected = 0 +item_count = 2 +popup/item_0/text = "Off" +popup/item_1/text = "Co-Op" +popup/item_1/id = 1 +script = ExtResource("5_duq54") diff --git a/scripts/game_state.gd b/scripts/game_state.gd index 73b4664..751a5bb 100644 --- a/scripts/game_state.gd +++ b/scripts/game_state.gd @@ -18,6 +18,8 @@ enum NEURO_INTEGRATION_MODE { Coop } var neuro_integration_mode := NEURO_INTEGRATION_MODE.Off +signal neuro_wait_started +signal neuro_wait_ended var health: int = STARTING_HEALTH var played_hand :Array[CardObject] = []: