From c1e9cd4293fc34c1e78a049f471640ae8a360bf0 Mon Sep 17 00:00:00 2001 From: Jens Becker Date: Mon, 27 Jul 2026 22:11:29 +0200 Subject: [PATCH] umstyling + meetingresource --- Main.tscn | 69 +++++++++++++--------- MeetingControl.cs | 18 +++--- MeetingControl.tscn | 8 ++- MeetingControlGfx.cs | 11 ++++ MeetingControlGfx.cs.uid | 1 + MeetingControlGfx.tscn | 49 ++++++++++++--- Meeting.cs => MeetingPhysicsBox.cs | 12 +++- Meeting.cs.uid => MeetingPhysicsBox.cs.uid | 0 Meeting.tscn => MeetingPhysicsBox.tscn | 20 +++---- MeetingResource.cs | 20 +++++++ MeetingResource.cs.uid | 1 + MyRes.cs | 6 ++ MyRes.cs.uid | 1 + TimeSlot.tscn | 5 +- meetings/coffee_meeting.tres | 9 +++ project.godot | 1 + 16 files changed, 169 insertions(+), 62 deletions(-) create mode 100644 MeetingControlGfx.cs create mode 100644 MeetingControlGfx.cs.uid rename Meeting.cs => MeetingPhysicsBox.cs (83%) rename Meeting.cs.uid => MeetingPhysicsBox.cs.uid (100%) rename Meeting.tscn => MeetingPhysicsBox.tscn (79%) create mode 100644 MeetingResource.cs create mode 100644 MeetingResource.cs.uid create mode 100644 MyRes.cs create mode 100644 MyRes.cs.uid create mode 100644 meetings/coffee_meeting.tres diff --git a/Main.tscn b/Main.tscn index ac8bc8a..2d20d61 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,72 +1,83 @@ [gd_scene format=3 uid="uid://b2rl7r8oav3hy"] -[ext_resource type="PackedScene" uid="uid://dciugg77wsy6p" path="res://Meeting.tscn" id="1_glv2v"] +[ext_resource type="PackedScene" uid="uid://dciugg77wsy6p" path="res://MeetingPhysicsBox.tscn" id="1_glv2v"] [ext_resource type="PackedScene" uid="uid://nnr6u0igggve" path="res://TimeSlot.tscn" id="1_uu6xs"] +[ext_resource type="Resource" uid="uid://mifwco1yj8kc" path="res://meetings/coffee_meeting.tres" id="3_r0du0"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_50jir"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_sko1m"] -size = Vector2(575, 20) +size = Vector2(727.5, 20) [sub_resource type="RectangleShape2D" id="RectangleShape2D_ig7tw"] size = Vector2(21.5, 1920) [node name="Main" type="Node2D" unique_id=287617203] -[node name="Control" type="Control" parent="." unique_id=1593899] -layout_mode = 3 -anchors_preset = 0 -offset_left = 125.0 -offset_top = 43.0 -offset_right = 455.0 -offset_bottom = 602.0 -mouse_filter = 2 - -[node name="PanelContainer" type="PanelContainer" parent="Control" unique_id=1636973054] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 +[node name="PanelContainer" type="PanelContainer" parent="." unique_id=1636973054] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = 96.0 +offset_top = 93.0 +offset_right = 302.0 +offset_bottom = 553.0 grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_50jir") -[node name="VBoxContainer" type="VBoxContainer" parent="Control/PanelContainer" unique_id=1658498861] +[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer" unique_id=1658498861] layout_mode = 2 mouse_filter = 2 alignment = 1 -[node name="TimeSlot" parent="Control/PanelContainer/VBoxContainer" unique_id=979842204 instance=ExtResource("1_uu6xs")] +[node name="TimeSlot" parent="PanelContainer/VBoxContainer" unique_id=979842204 instance=ExtResource("1_uu6xs")] layout_mode = 2 -[node name="TimeSlot2" parent="Control/PanelContainer/VBoxContainer" unique_id=1532657435 instance=ExtResource("1_uu6xs")] +[node name="TimeSlot2" parent="PanelContainer/VBoxContainer" unique_id=1532657435 instance=ExtResource("1_uu6xs")] layout_mode = 2 -[node name="TimeSlot3" parent="Control/PanelContainer/VBoxContainer" unique_id=1504478834 instance=ExtResource("1_uu6xs")] +[node name="TimeSlot3" parent="PanelContainer/VBoxContainer" unique_id=1504478834 instance=ExtResource("1_uu6xs")] layout_mode = 2 -[node name="TimeSlot4" parent="Control/PanelContainer/VBoxContainer" unique_id=1891572413 instance=ExtResource("1_uu6xs")] +[node name="TimeSlot4" parent="PanelContainer/VBoxContainer" unique_id=1891572413 instance=ExtResource("1_uu6xs")] layout_mode = 2 -[node name="TimeSlot5" parent="Control/PanelContainer/VBoxContainer" unique_id=464659559 instance=ExtResource("1_uu6xs")] +[node name="TimeSlot5" parent="PanelContainer/VBoxContainer" unique_id=464659559 instance=ExtResource("1_uu6xs")] layout_mode = 2 -[node name="TimeSlot6" parent="Control/PanelContainer/VBoxContainer" unique_id=1773919778 instance=ExtResource("1_uu6xs")] +[node name="TimeSlot6" parent="PanelContainer/VBoxContainer" unique_id=1773919778 instance=ExtResource("1_uu6xs")] layout_mode = 2 -[node name="TimeSlot7" parent="Control/PanelContainer/VBoxContainer" unique_id=1476334804 instance=ExtResource("1_uu6xs")] +[node name="TimeSlot7" parent="PanelContainer/VBoxContainer" unique_id=1476334804 instance=ExtResource("1_uu6xs")] +layout_mode = 2 + +[node name="TimeSlot8" parent="PanelContainer/VBoxContainer" unique_id=2116243857 instance=ExtResource("1_uu6xs")] +layout_mode = 2 + +[node name="TimeSlot9" parent="PanelContainer/VBoxContainer" unique_id=1672825401 instance=ExtResource("1_uu6xs")] +visible = false +layout_mode = 2 + +[node name="TimeSlot10" parent="PanelContainer/VBoxContainer" unique_id=488121571 instance=ExtResource("1_uu6xs")] +visible = false layout_mode = 2 [node name="Box" type="StaticBody2D" parent="." unique_id=56956355] [node name="CollisionShape2D" type="CollisionShape2D" parent="Box" unique_id=220723577] -position = Vector2(843, 611) +position = Vector2(766.75, 611) shape = SubResource("RectangleShape2D_sko1m") [node name="CollisionShape2D4" type="CollisionShape2D" parent="Box" unique_id=416813543] -position = Vector2(844, -1289) +position = Vector2(758, -1289) shape = SubResource("RectangleShape2D_sko1m") [node name="CollisionShape2D2" type="CollisionShape2D" parent="Box" unique_id=240246518] -position = Vector2(566.25, -339) +position = Vector2(410, -339) shape = SubResource("RectangleShape2D_ig7tw") [node name="CollisionShape2D3" type="CollisionShape2D" parent="Box" unique_id=297721234] @@ -74,12 +85,14 @@ position = Vector2(1120, -339) shape = SubResource("RectangleShape2D_ig7tw") [node name="Meeting" parent="." unique_id=796440984 instance=ExtResource("1_glv2v")] -position = Vector2(749, 176) +position = Vector2(654, 130) [node name="Meeting2" parent="." unique_id=1691479453 instance=ExtResource("1_glv2v")] position = Vector2(957, 231.99998) rotation = -0.5541229 +MeetingResource = ExtResource("3_r0du0") [node name="Meeting3" parent="." unique_id=673551448 instance=ExtResource("1_glv2v")] position = Vector2(782.9999, 402.99997) rotation = -0.18364333 +MeetingResource = ExtResource("3_r0du0") diff --git a/MeetingControl.cs b/MeetingControl.cs index e88c6f8..43d0cdf 100644 --- a/MeetingControl.cs +++ b/MeetingControl.cs @@ -9,15 +9,20 @@ public sealed partial class MeetingControlDragData(MeetingControl meetingControl public partial class MeetingControl : Control { [Export] - public Meeting Meeting; + public MeetingPhysicsBox MeetingPhysicsBox; public bool InSlot { get; set; } + public override void _Ready() + { + Modulate = MeetingPhysicsBox.MeetingResource.Color; + MeetingControlGfx.MeetingTitle.Text = MeetingPhysicsBox.MeetingResource.Title; + } + public override Variant _GetDragData(Vector2 atPosition) { var preview = CreatePreview(); SetDragPreview(preview); - GD.Print("asdasdasdasd as dasd"); Visible = false; InSlot = false; @@ -37,18 +42,13 @@ public partial class MeetingControl : Control { if (what == NotificationDragEnd) { - GD.Print("Drag End"); - if (InSlot) { - GD.Print("Dropped in Slot"); return; } - GD.Print("Dropped somewhere"); - - FindParent("Main").AddChild(Meeting); - Meeting.Position = GetGlobalMousePosition(); + FindParent("Main").AddChild(MeetingPhysicsBox); + MeetingPhysicsBox.Position = GetGlobalMousePosition(); QueueFree(); } } diff --git a/MeetingControl.tscn b/MeetingControl.tscn index e834745..dcaf095 100644 --- a/MeetingControl.tscn +++ b/MeetingControl.tscn @@ -6,10 +6,12 @@ [node name="MeetingControl" type="Control" unique_id=778678487] layout_mode = 3 anchors_preset = 0 -offset_right = 329.0 -offset_bottom = 80.0 +offset_right = 206.0 +offset_bottom = 54.0 script = ExtResource("1_o5h3n") -[node name="MeetingControlGFX" parent="." unique_id=1923695250 instance=ExtResource("1_o8u20")] +[node name="MeetingControlGfx" parent="." unique_id=1923695250 instance=ExtResource("1_o8u20")] +unique_name_in_owner = true layout_mode = 0 +offset_right = 206.0 mouse_filter = 2 diff --git a/MeetingControlGfx.cs b/MeetingControlGfx.cs new file mode 100644 index 0000000..5361d73 --- /dev/null +++ b/MeetingControlGfx.cs @@ -0,0 +1,11 @@ +using System; +using Godot; + +[SceneTree] +public partial class MeetingControlGfx : PanelContainer +{ + public void SetMeetingTitle(string title) + { + MeetingTitle.Text = title; + } +} diff --git a/MeetingControlGfx.cs.uid b/MeetingControlGfx.cs.uid new file mode 100644 index 0000000..524dffb --- /dev/null +++ b/MeetingControlGfx.cs.uid @@ -0,0 +1 @@ +uid://cxbjuwkso3fro diff --git a/MeetingControlGfx.tscn b/MeetingControlGfx.tscn index 0147d46..ccdc5a9 100644 --- a/MeetingControlGfx.tscn +++ b/MeetingControlGfx.tscn @@ -1,14 +1,47 @@ [gd_scene format=3 uid="uid://b2cpk0ef3rw87"] +[ext_resource type="Script" uid="uid://cxbjuwkso3fro" path="res://MeetingControlGfx.cs" id="1_ad8oc"] [ext_resource type="Texture2D" uid="uid://dyxftkkuf7h7w" path="res://icon.svg" id="1_vkyb6"] -[node name="MeetingControlGFX" type="PanelContainer" unique_id=1923695250] -custom_minimum_size = Vector2(10.74, 9.49) -offset_right = 330.0 -offset_bottom = 80.0 -size_flags_horizontal = 3 +[sub_resource type="LabelSettings" id="LabelSettings_vkyb6"] +line_spacing = -4.0 +font_size = 12 -[node name="Icon" type="Sprite2D" parent="." unique_id=527110079] -position = Vector2(36.999996, 37) -scale = Vector2(0.390625, 0.390625) +[node name="MeetingControlGfx" type="PanelContainer" unique_id=1923695250] +offset_right = 250.0 +offset_bottom = 54.0 +size_flags_horizontal = 3 +script = ExtResource("1_ad8oc") + +[node name="MarginContainer" type="MarginContainer" parent="." unique_id=2076398338] +layout_mode = 2 +theme_override_constants/margin_left = 8 +theme_override_constants/margin_top = 2 +theme_override_constants/margin_right = 8 +theme_override_constants/margin_bottom = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer" unique_id=1802204044] +layout_mode = 2 +theme_override_constants/separation = 8 + +[node name="MeetingIcon" type="TextureRect" parent="MarginContainer/HBoxContainer" unique_id=774812445] +unique_name_in_owner = true +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 4 texture = ExtResource("1_vkyb6") +expand_mode = 1 +stretch_mode = 4 + +[node name="MeetingTitle" type="Label" parent="MarginContainer/HBoxContainer" unique_id=270102306] +unique_name_in_owner = true +custom_minimum_size = Vector2(150, 50) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 20.0 +text = "Das ist ein dummes Meeting mit einem richtig langen Title aber was " +label_settings = SubResource("LabelSettings_vkyb6") +vertical_alignment = 1 +autowrap_mode = 3 +text_overrun_behavior = 4 diff --git a/Meeting.cs b/MeetingPhysicsBox.cs similarity index 83% rename from Meeting.cs rename to MeetingPhysicsBox.cs index 2c23859..2fb9997 100644 --- a/Meeting.cs +++ b/MeetingPhysicsBox.cs @@ -1,8 +1,13 @@ using System; using Godot; +using yourareanaiceo; -public partial class Meeting : RigidBody2D +[SceneTree] +public partial class MeetingPhysicsBox : RigidBody2D { + [Export] + public MeetingResource MeetingResource { get; set; } = new DummyMeetingResource(); + private bool _mouseInside; private bool _isDragging; private Vector2 _dragTarget; @@ -10,6 +15,9 @@ public partial class Meeting : RigidBody2D public override void _Ready() { FreezeMode = FreezeModeEnum.Kinematic; + Modulate = MeetingResource.Color; + + MeetingControlGfx.MeetingTitle.Text = MeetingResource.Title; MouseEntered += () => { @@ -64,7 +72,7 @@ public partial class Meeting : RigidBody2D RotationDegrees = 0; var meetingControl = Instantiator.Instantiate(); - meetingControl.Meeting = this; + meetingControl.MeetingPhysicsBox = this; GetParent().AddChild(meetingControl); meetingControl.StartDrag(); diff --git a/Meeting.cs.uid b/MeetingPhysicsBox.cs.uid similarity index 100% rename from Meeting.cs.uid rename to MeetingPhysicsBox.cs.uid diff --git a/Meeting.tscn b/MeetingPhysicsBox.tscn similarity index 79% rename from Meeting.tscn rename to MeetingPhysicsBox.tscn index 4cde238..7f20f36 100644 --- a/Meeting.tscn +++ b/MeetingPhysicsBox.tscn @@ -1,42 +1,42 @@ [gd_scene format=3 uid="uid://dciugg77wsy6p"] -[ext_resource type="Script" uid="uid://cit20jyhj41rs" path="res://Meeting.cs" id="1_1rolt"] [ext_resource type="Texture2D" uid="uid://dyxftkkuf7h7w" path="res://icon.svg" id="1_2t4nr"] +[ext_resource type="Script" uid="uid://cit20jyhj41rs" path="res://MeetingPhysicsBox.cs" id="1_m6u8j"] [ext_resource type="PackedScene" uid="uid://b2cpk0ef3rw87" path="res://MeetingControlGfx.tscn" id="2_h68fa"] [sub_resource type="PhysicsMaterial" id="PhysicsMaterial_glv2v"] bounce = 0.1 [sub_resource type="RectangleShape2D" id="RectangleShape2D_boq60"] -size = Vector2(329, 80) +size = Vector2(206, 54) [node name="Meeting" type="RigidBody2D" unique_id=796440984] input_pickable = true physics_material_override = SubResource("PhysicsMaterial_glv2v") freeze_mode = 1 continuous_cd = 2 -script = ExtResource("1_1rolt") +script = ExtResource("1_m6u8j") [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=235269066] -position = Vector2(0.5, 0) shape = SubResource("RectangleShape2D_boq60") -[node name="MeetingControlGFX" parent="." unique_id=1923695250 instance=ExtResource("2_h68fa")] +[node name="MeetingControlGfx" parent="." unique_id=1923695250 instance=ExtResource("2_h68fa")] +unique_name_in_owner = true anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -164.5 -offset_top = -40.0 -offset_right = 164.5 -offset_bottom = 40.0 +offset_left = -103.0 +offset_top = -27.0 +offset_right = 103.0 +offset_bottom = 27.0 grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 [node name="Icon" type="Sprite2D" parent="." unique_id=816382870] self_modulate = Color(0.649173, 0, 0.25909996, 1) -position = Vector2(153, -29.000004) +position = Vector2(92, -16) scale = Vector2(0.1171875, 0.1171875) texture = ExtResource("1_2t4nr") diff --git a/MeetingResource.cs b/MeetingResource.cs new file mode 100644 index 0000000..e2d6a27 --- /dev/null +++ b/MeetingResource.cs @@ -0,0 +1,20 @@ +using Godot; + +[GlobalClass] +public partial class MeetingResource : Resource +{ + [Export] + public string Title { get; set; } + + [Export] + public Color Color { get; set; } +} + +public partial class DummyMeetingResource : MeetingResource +{ + public DummyMeetingResource() + { + Title = "Dummy Meeting"; + Color = Colors.Magenta; + } +} diff --git a/MeetingResource.cs.uid b/MeetingResource.cs.uid new file mode 100644 index 0000000..940749b --- /dev/null +++ b/MeetingResource.cs.uid @@ -0,0 +1 @@ +uid://cuq38lbfa2v74 diff --git a/MyRes.cs b/MyRes.cs new file mode 100644 index 0000000..eb916b5 --- /dev/null +++ b/MyRes.cs @@ -0,0 +1,6 @@ +using Godot; + +namespace yourareanaiceo; + +[ResourceTree] +public static partial class MyRes; diff --git a/MyRes.cs.uid b/MyRes.cs.uid new file mode 100644 index 0000000..58d334e --- /dev/null +++ b/MyRes.cs.uid @@ -0,0 +1 @@ +uid://cxl2jve7b1hu0 diff --git a/TimeSlot.tscn b/TimeSlot.tscn index 7db91f5..06282ee 100644 --- a/TimeSlot.tscn +++ b/TimeSlot.tscn @@ -3,7 +3,8 @@ [ext_resource type="Script" uid="uid://dldaxqajhnnva" path="res://TimeSlot.cs" id="1_50jir"] [node name="TimeSlot" type="PanelContainer" unique_id=979842204] -custom_minimum_size = Vector2(0, 74) -offset_bottom = 80.0 +custom_minimum_size = Vector2(206, 54) +offset_right = 206.0 +offset_bottom = 54.0 mouse_filter = 2 script = ExtResource("1_50jir") diff --git a/meetings/coffee_meeting.tres b/meetings/coffee_meeting.tres new file mode 100644 index 0000000..7909e7d --- /dev/null +++ b/meetings/coffee_meeting.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="MeetingResource" format=3 uid="uid://mifwco1yj8kc"] + +[ext_resource type="Script" uid="uid://cuq38lbfa2v74" path="res://MeetingResource.cs" id="1_s1cac"] + +[resource] +script = ExtResource("1_s1cac") +Title = "Coffee Break" +Color = Color(0.2210013, 0.40685424, 0.8183415, 1) +metadata/_custom_type_script = "uid://cuq38lbfa2v74" diff --git a/project.godot b/project.godot index 9904eb0..2fbb64d 100644 --- a/project.godot +++ b/project.godot @@ -28,6 +28,7 @@ project/assembly_name="your are an ai ceo" 2d/run_on_separate_thread=true 3d/physics_engine="Jolt Physics" +2d/default_gravity=400.0 [rendering]