diff --git a/assets/font/urbane-rounded-medium.otf b/assets/font/urbane-rounded-medium.otf new file mode 100644 index 0000000..1136f04 Binary files /dev/null and b/assets/font/urbane-rounded-medium.otf differ diff --git a/assets/font/urbane-rounded-medium.otf.import b/assets/font/urbane-rounded-medium.otf.import new file mode 100644 index 0000000..088b5ca --- /dev/null +++ b/assets/font/urbane-rounded-medium.otf.import @@ -0,0 +1,32 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://cx6bvqk0ghmjv" +path="res://.godot/imported/urbane-rounded-medium.otf-b9893bdfac064b3a1273ef625926190e.fontdata" + +[deps] + +source_file="res://assets/font/urbane-rounded-medium.otf" +dest_files=["res://.godot/imported/urbane-rounded-medium.otf-b9893bdfac064b3a1273ef625926190e.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/scenes/gui/dialog_bubble.tscn b/scenes/gui/dialog_bubble.tscn new file mode 100644 index 0000000..4a20546 --- /dev/null +++ b/scenes/gui/dialog_bubble.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=3 format=3 uid="uid://d6ngurhq1r5y"] + +[ext_resource type="Script" path="res://src/scene-scripts/gui/dialog_bubble.cs" id="1_snqhg"] +[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/font/urbane-rounded-medium.otf" id="1_vlvkg"] + +[node name="dialog_bubble" type="CanvasLayer"] +script = ExtResource("1_snqhg") + +[node name="Background" type="ColorRect" parent="."] +anchors_preset = -1 +anchor_left = 0.211 +anchor_top = 0.786 +anchor_right = 0.846 +anchor_bottom = 1.0 +offset_left = 0.139984 +offset_top = -19.92 +offset_right = 0.0400391 +offset_bottom = -20.0 +grow_horizontal = 2 +grow_vertical = 0 +size_flags_horizontal = 4 +size_flags_vertical = 4 +metadata/_edit_use_anchors_ = true + +[node name="TextLabel" type="Label" parent="."] +anchors_preset = -1 +anchor_left = 0.218 +anchor_top = 0.812 +anchor_right = 0.837 +anchor_bottom = 0.972 +offset_left = 0.319977 +offset_top = -19.64 +offset_right = 0.380005 +offset_bottom = -19.84 +grow_horizontal = 2 +grow_vertical = 0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("1_vlvkg") +theme_override_font_sizes/font_size = 32 +text = "This is test text" diff --git a/scenes/gui/dialog_object_area.tscn b/scenes/gui/trigger/dialog_object_area.tscn similarity index 100% rename from scenes/gui/dialog_object_area.tscn rename to scenes/gui/trigger/dialog_object_area.tscn diff --git a/scenes/tiles/dialog_debug_tile.tscn b/scenes/tiles/dialog_debug_tile.tscn new file mode 100644 index 0000000..f3caa59 --- /dev/null +++ b/scenes/tiles/dialog_debug_tile.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=5 format=3 uid="uid://cjqwrkx04evnr"] + +[ext_resource type="Texture2D" uid="uid://p5ubildre2tg" path="res://assets/textures/debug/cupcake.png" id="1_qmvgm"] +[ext_resource type="PackedScene" uid="uid://d14pjtkh0xmrk" path="res://scenes/gui/trigger/dialog_object_area.tscn" id="2_m1t8o"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_2d5dy"] +radius = 30.8058 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_nu5em"] +size = Vector2(68, 65) + +[node name="first_debug_tile" type="StaticBody2D"] + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_qmvgm") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(-1, 4) +shape = SubResource("CircleShape2D_2d5dy") + +[node name="dialog_area" parent="." instance=ExtResource("2_m1t8o")] +dialogKey = "cupcake" + +[node name="CollisionShape2D" parent="dialog_area" index="0"] +position = Vector2(0, 0.5) +shape = SubResource("RectangleShape2D_nu5em") + +[editable path="dialog_area"] diff --git a/scenes/worlds/first_world.tscn b/scenes/worlds/first_world.tscn index 41ac98f..88ed65b 100644 --- a/scenes/worlds/first_world.tscn +++ b/scenes/worlds/first_world.tscn @@ -15,4 +15,4 @@ tile_set = ExtResource("2_kvjhj") cell_quadrant_size = 64 format = 2 layer_0/z_index = 1 -layer_0/tile_data = PackedInt32Array(65535, 0, 0, 0, 0, 0, 1, 0, 0, 65534, 0, 0, 65533, 0, 0, -3, 0, 0, -2, 0, 0, -1, 0, 0, -65536, 0, 0, -65535, 0, 0) +layer_0/tile_data = PackedInt32Array(65535, 0, 0, 0, 0, 0, 1, 0, 0, 65534, 0, 0, 65533, 0, 0, -3, 0, 0, -2, 0, 0, -1, 0, 0, -65536, 0, 0, -65535, 0, 0, 65529, 1, 65536, 65530, 1, 65536, 65541, 1, 65536, -196605, 1, 65536) diff --git a/src/scene-scripts/gui/dialog_bubble.cs b/src/scene-scripts/gui/dialog_bubble.cs new file mode 100644 index 0000000..6213082 --- /dev/null +++ b/src/scene-scripts/gui/dialog_bubble.cs @@ -0,0 +1,42 @@ +using Godot; +using Godot.Collections; +using System; +using System.IO; + +public partial class dialog_bubble : CanvasLayer +{ + [Export(PropertyHint.File, "*.json,")] + public string textfile; + + private Dictionary text; + private string[] selectedText; + private bool inProgress = false; + + //ITS FUCKING GARBAGE I HATE THIS DOCUMENTATION + + public override void _Ready() + { + var background = GetNode("Background"); + var textLabel = GetNode("TextLabel"); + + background.Visible = false; + //text.Add(LoadSceneText(textVariant)); + //signal_bus.Connect("DisplayDialog", this, "onDisplayDialog"); + + } + public string LoadSceneText(string textVariant) + { + if (File.Exists(textfile)) + { + File.Open(textfile, FileMode.Open); + textVariant = JSON.ParseString(File.ReadAllText(textfile)).ToString(); + } + return textVariant; + + } + + // Called every frame. 'delta' is the elapsed time since the previous frame. + public override void _Process(double delta) + { + } +} diff --git a/src/scene-scripts/gui/dialog_object_area.cs b/src/scene-scripts/gui/dialog_object_area.cs index 1cdcb52..b093c5d 100644 --- a/src/scene-scripts/gui/dialog_object_area.cs +++ b/src/scene-scripts/gui/dialog_object_area.cs @@ -1,6 +1,5 @@ using Godot; using System; -using System.Runtime.CompilerServices; public partial class dialog_object_area : Area2D { @@ -12,14 +11,14 @@ public partial class dialog_object_area : Area2D { if(areaActive && @event.IsActionPressed("ui_accept")) { - EmitSignal("DialogDisplayEventHandler", dialogKey); + signal_bus.EmitSignal("DialogDisplay", dialogKey); } } - public void onAreaEntered() + public void onDialogAreaEntered() { areaActive = true; } - public void onAreaExited() + public void onDialogAreaExited() { areaActive = false; } diff --git a/tilesets/main_foreground.tres b/tilesets/main_foreground.tres index 1ef0b41..bf258c5 100644 --- a/tilesets/main_foreground.tres +++ b/tilesets/main_foreground.tres @@ -1,11 +1,17 @@ -[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://txl24cadn8t4"] +[gd_resource type="TileSet" load_steps=5 format=3 uid="uid://txl24cadn8t4"] [ext_resource type="PackedScene" uid="uid://dk7fqaw2b3w1k" path="res://scenes/tiles/first_debug_tile.tscn" id="1_uxmn6"] +[ext_resource type="PackedScene" path="res://scenes/tiles/dialog_debug_tile.tscn" id="2_5mcbp"] [sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_h5u31"] resource_name = "test" scenes/0/scene = ExtResource("1_uxmn6") +[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_tg2xg"] +resource_name = "dialog-test" +scenes/1/scene = ExtResource("2_5mcbp") + [resource] tile_size = Vector2i(64, 64) sources/0 = SubResource("TileSetScenesCollectionSource_h5u31") +sources/1 = SubResource("TileSetScenesCollectionSource_tg2xg")