bisschen gui bisschen moving timeline

This commit is contained in:
2026-07-29 22:54:19 +02:00
parent 9824b30435
commit 0bb8ce47c0
13 changed files with 240 additions and 119 deletions

View File

@@ -1,19 +1,57 @@
using Godot;
using yourareanaiceo;
[GlobalClass]
public partial class Company : Resource
{
[Export]
public float Hype { get; set; }
private float _averageSalary = 100;
private float _hype;
private float _money = 1_000;
private float _workers = 1;
[Export]
public float Money { get; set; } = 10_000;
public float Hype
{
get => _hype;
set
{
_hype = value;
EmitCompanyStatusChanged();
}
}
[Export]
public float Workers { get; set; } = 1;
public float Money
{
get => _money;
set
{
_money = value;
EmitCompanyStatusChanged();
}
}
[Export]
public float AverageSalary { get; set; } = 100;
public float Workers
{
get => _workers;
set
{
_workers = value;
EmitCompanyStatusChanged();
}
}
[Export]
public float AverageSalary
{
get => _averageSalary;
set
{
_averageSalary = value;
EmitCompanyStatusChanged();
}
}
/// <summary>
/// Cost per Quarter
@@ -24,4 +62,11 @@ public partial class Company : Resource
/// Runway in Quarters
/// </summary>
public int Runway => Mathf.FloorToInt(Money / Cost);
private void EmitCompanyStatusChanged()
{
EventBus.CompanyChanged.Invoke(new CompanyStats(Hype, Money, Workers, Runway));
}
public record CompanyStats(float Hype, float Money, float Workers, int Runway);
}

20
CompanyStatsContainer.cs Normal file
View File

@@ -0,0 +1,20 @@
using System.Globalization;
using Godot;
using yourareanaiceo;
[SceneTree]
public partial class CompanyStatsContainer : FoldableContainer
{
public override void _Ready()
{
EventBus.CompanyChanged += UpdateCompanyStats;
}
private void UpdateCompanyStats(Company.CompanyStats companyStats)
{
HypeValue.Text = companyStats.Hype.ToString();
MoneyValue.Text = $"${companyStats.Money.ToString("N0", CultureInfo.CurrentCulture)}";
WorkersValue.Text = companyStats.Workers.ToString("N0", CultureInfo.CurrentCulture);
RunwayValue.Text = companyStats.Runway.ToString();
}
}

View File

@@ -0,0 +1 @@
uid://27upjp7k8rvl

View File

@@ -0,0 +1,71 @@
[gd_scene format=3 uid="uid://ckdqrg8c0mq8h"]
[ext_resource type="Script" uid="uid://27upjp7k8rvl" path="res://CompanyStatsContainer.cs" id="1_grkqn"]
[node name="CompanyStatsContainer" type="FoldableContainer" unique_id=317328071]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -245.0
offset_right = 4.535034
offset_bottom = 149.0
grow_horizontal = 0
title = "Your Company Inc."
title_alignment = 1
script = ExtResource("1_grkqn")
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=832183396]
layout_mode = 2
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer" unique_id=1164364814]
modulate = Color(1, 0, 0, 1)
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer4" unique_id=2113984350]
layout_mode = 2
size_flags_horizontal = 3
text = "Runway"
[node name="RunwayValue" type="Label" parent="VBoxContainer/HBoxContainer4" unique_id=1672825837]
unique_name_in_owner = true
layout_mode = 2
text = "2"
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer" unique_id=1721269664]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer" unique_id=894714403]
layout_mode = 2
size_flags_horizontal = 3
text = "Hype"
[node name="HypeValue" type="Label" parent="VBoxContainer/HBoxContainer" unique_id=1054913799]
unique_name_in_owner = true
layout_mode = 2
text = "10"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer" unique_id=1217186337]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2" unique_id=52458700]
layout_mode = 2
size_flags_horizontal = 3
text = "Money"
[node name="MoneyValue" type="Label" parent="VBoxContainer/HBoxContainer2" unique_id=2047724511]
unique_name_in_owner = true
layout_mode = 2
text = "10.000"
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer" unique_id=1968323546]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3" unique_id=1079804700]
layout_mode = 2
size_flags_horizontal = 3
text = "Workers"
[node name="WorkersValue" type="Label" parent="VBoxContainer/HBoxContainer3" unique_id=580114513]
unique_name_in_owner = true
layout_mode = 2
text = "1"

View File

@@ -4,12 +4,17 @@ using yourareanaiceo;
public partial class CurrentTimeLine : Panel
{
[Export]
float speed = 2f;
private float _speed = 15f;
public bool Running { get; set; }
public override void _Process(double delta)
{
if (!Running)
return;
var pos = OffsetTransformPosition;
pos.Y += speed * delta.toFloat();
pos.Y += _speed * delta.toFloat();
OffsetTransformPosition = pos;
}

View File

@@ -4,9 +4,6 @@ using Godot;
[SceneTree]
public partial class DaySchedule : PanelContainer
{
[Export]
private Company _company;
[Export]
private int _hoursInDay = 6;
@@ -21,4 +18,9 @@ public partial class DaySchedule : PanelContainer
TimeSlotContainer.AddChild(timeSlot);
}
}
public void StartDay()
{
CurrentTimeLine.Running = true;
}
}

View File

@@ -2,7 +2,6 @@
[ext_resource type="Script" uid="uid://xv51uvc4koyc" path="res://DaySchedule.cs" id="1_b6clr"]
[ext_resource type="PackedScene" uid="uid://nnr6u0igggve" path="res://TimeSlot.tscn" id="2_ascl5"]
[ext_resource type="Script" uid="uid://cxr0qf8ut8t4p" path="res://Company.cs" id="2_dtij7"]
[ext_resource type="Script" uid="uid://cbbrups0mkp17" path="res://CurrentTimeLine.cs" id="3_dtij7"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cm0pq"]
@@ -17,10 +16,6 @@ corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[sub_resource type="Resource" id="Resource_b6clr"]
script = ExtResource("2_dtij7")
metadata/_custom_type_script = "uid://cxr0qf8ut8t4p"
[sub_resource type="StyleBoxLine" id="StyleBoxLine_r0du0"]
color = Color(1, 0, 0, 1)
thickness = 5
@@ -40,7 +35,6 @@ grow_vertical = 2
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_cm0pq")
script = ExtResource("1_b6clr")
_company = SubResource("Resource_b6clr")
[node name="TimeSlotContainer" type="VBoxContainer" parent="." unique_id=1932322928]
unique_name_in_owner = true
@@ -83,6 +77,7 @@ visible = false
layout_mode = 2
[node name="CurrentTimeLine" type="Panel" parent="." unique_id=961292687]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 5)
clip_contents = true
layout_mode = 2

8
EventBus.cs Normal file
View File

@@ -0,0 +1,8 @@
using System;
namespace yourareanaiceo;
public static class EventBus
{
public static Action<Company.CompanyStats> CompanyChanged;
}

1
EventBus.cs.uid Normal file
View File

@@ -0,0 +1 @@
uid://dc2a1pri8vkds

14
Main.cs
View File

@@ -1,4 +1,16 @@
using Godot;
[SceneTree]
public partial class Main : Node2D { }
public partial class Main : Node2D
{
[Export]
public Company Company;
public override void _Ready()
{
Company = new Company();
Company.Hype = 0;
ExecuteButton.Pressed += () => DaySchedule.StartDay();
}
}

162
Main.tscn
View File

@@ -3,18 +3,27 @@
[ext_resource type="Script" uid="uid://d1h0qvskvk1wu" path="res://Main.cs" id="1_3dxm6"]
[ext_resource type="PackedScene" uid="uid://dciugg77wsy6p" path="res://MeetingPhysicsBox.tscn" id="1_glv2v"]
[ext_resource type="PackedScene" uid="uid://covomnw8s7k1n" path="res://DaySchedule.tscn" id="1_r0du0"]
[ext_resource type="PackedScene" uid="uid://ckdqrg8c0mq8h" path="res://CompanyStatsContainer.tscn" id="2_trn2v"]
[ext_resource type="Resource" uid="uid://mifwco1yj8kc" path="res://resources/meetings/coffee_meeting.tres" id="3_r0du0"]
[ext_resource type="Resource" uid="uid://du72uxjqr0h4a" path="res://resources/meetings/lockin.tres" id="4_cm0pq"]
[ext_resource type="Resource" uid="uid://bcd4qf4i84pwf" path="res://resources/meetings/work_product_1.tres" id="5_fos0i"]
[ext_resource type="Script" uid="uid://bs531c76ivhtf" path="res://DropZone.cs" id="7_lgr22"]
[sub_resource type="LabelSettings" id="LabelSettings_sko1m"]
font_size = 64
stacked_outline_count = 1
stacked_shadow_count = 1
stacked_outline_0/size = 9
stacked_shadow_0/offset = Vector2(4, 4)
stacked_shadow_0/outline_size = 2
[sub_resource type="Gradient" id="Gradient_trn2v"]
offsets = PackedFloat32Array(0, 0.5518293, 1)
colors = PackedColorArray(0.19215687, 0, 0.24313726, 1, 0.25238776, 0.18853581, 0.16752905, 1, 0.1764706, 0, 0.3529412, 1)
[sub_resource type="FastNoiseLite" id="FastNoiseLite_trn2v"]
noise_type = 3
fractal_type = 2
domain_warp_enabled = true
domain_warp_type = 1
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_trn2v"]
width = 1980
height = 1020
noise = SubResource("FastNoiseLite_trn2v")
color_ramp = SubResource("Gradient_trn2v")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sko1m"]
size = Vector2(727.5, 20)
@@ -30,6 +39,20 @@ unique_name_in_owner = true
position = Vector2(775, 36)
gizmo_extents = 40.0
[node name="TextureRect" type="TextureRect" parent="." unique_id=594808349]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -990.0
offset_top = -510.0
offset_right = 990.0
offset_bottom = 510.0
grow_horizontal = 2
grow_vertical = 2
texture = SubResource("NoiseTexture2D_trn2v")
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1328071901]
[node name="Control" type="Control" parent="CanvasLayer" unique_id=947212855]
@@ -41,97 +64,30 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="Day" type="Label" parent="CanvasLayer/Control" unique_id=1593831007]
[node name="CompanyStatsContainer" parent="CanvasLayer/Control" unique_id=317328071 instance=ExtResource("2_trn2v")]
layout_mode = 1
offset_left = 142.0
offset_right = 260.0
offset_bottom = 88.0
text = "Day"
label_settings = SubResource("LabelSettings_sko1m")
[node name="Inbox" type="Label" parent="CanvasLayer/Control" unique_id=163179205]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -464.0
offset_right = -290.0
offset_bottom = 88.0
grow_horizontal = 0
text = "Inbox"
label_settings = SubResource("LabelSettings_sko1m")
[node name="PanelContainer" type="FoldableContainer" parent="CanvasLayer/Control" unique_id=1121461524]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -245.0
offset_right = 4.535034
offset_bottom = 149.0
grow_horizontal = 0
title = "Your Company Inc."
title_alignment = 1
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control/PanelContainer" unique_id=1331001176]
layout_mode = 2
[node name="HBoxContainer4" type="HBoxContainer" parent="CanvasLayer/Control/PanelContainer/VBoxContainer" unique_id=879116080]
modulate = Color(1, 0, 0, 1)
layout_mode = 2
[node name="Label" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer4" unique_id=54936711]
layout_mode = 2
size_flags_horizontal = 3
text = "Runway"
[node name="Label2" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer4" unique_id=111473790]
layout_mode = 2
text = "2"
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/Control/PanelContainer/VBoxContainer" unique_id=500602395]
layout_mode = 2
[node name="Label" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer" unique_id=1599952499]
layout_mode = 2
size_flags_horizontal = 3
text = "Hype"
[node name="Label2" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer" unique_id=780587971]
layout_mode = 2
text = "10"
[node name="HBoxContainer2" type="HBoxContainer" parent="CanvasLayer/Control/PanelContainer/VBoxContainer" unique_id=981225226]
layout_mode = 2
[node name="Label" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer2" unique_id=1687312201]
layout_mode = 2
size_flags_horizontal = 3
text = "Money"
[node name="Label2" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer2" unique_id=172841693]
layout_mode = 2
text = "10.000"
[node name="HBoxContainer3" type="HBoxContainer" parent="CanvasLayer/Control/PanelContainer/VBoxContainer" unique_id=2146415473]
layout_mode = 2
[node name="Label" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer3" unique_id=1336632204]
layout_mode = 2
size_flags_horizontal = 3
text = "Workers"
[node name="Label2" type="Label" parent="CanvasLayer/Control/PanelContainer/VBoxContainer/HBoxContainer3" unique_id=617177241]
layout_mode = 2
text = "1"
offset_left = -249.53503
offset_right = 0.0
[node name="DaySchedule" parent="." unique_id=457829015 instance=ExtResource("1_r0du0")]
offset_left = 106.0
offset_top = 117.0
offset_right = 320.0
offset_bottom = 571.0
unique_name_in_owner = true
offset_left = -493.0
offset_top = -277.00006
offset_right = -279.0
offset_bottom = 176.99994
[node name="ExecuteButton" type="Button" parent="." unique_id=312490567]
unique_name_in_owner = true
offset_left = -513.0
offset_top = 214.99994
offset_right = -264.0
offset_bottom = 281.99994
theme_override_constants/outline_size = 12
theme_override_font_sizes/font_size = 36
text = "Execute Day"
[node name="Box" type="StaticBody2D" parent="." unique_id=56956355]
position = Vector2(-599, -322.00006)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Box" unique_id=220723577]
position = Vector2(766.75, 611)
@@ -150,45 +106,45 @@ position = Vector2(1120, -339)
shape = SubResource("RectangleShape2D_ig7tw")
[node name="Meeting" parent="." unique_id=796440984 instance=ExtResource("1_glv2v")]
position = Vector2(634, -454)
position = Vector2(35, -776.00006)
MeetingResource = ExtResource("3_r0du0")
[node name="Meeting4" parent="." unique_id=1960552374 instance=ExtResource("1_glv2v")]
position = Vector2(707, -340)
position = Vector2(108, -662.00006)
rotation = 0.24779713
MeetingResource = ExtResource("4_cm0pq")
[node name="Meeting5" parent="." unique_id=1692042144 instance=ExtResource("1_glv2v")]
position = Vector2(851, -500)
position = Vector2(252, -822.00006)
rotation = 0.24779713
MeetingResource = ExtResource("5_fos0i")
[node name="Meeting6" parent="." unique_id=2120697586 instance=ExtResource("1_glv2v")]
position = Vector2(604, -619.99994)
position = Vector2(5, -942)
rotation = 0.24779713
MeetingResource = ExtResource("3_r0du0")
[node name="Meeting7" parent="." unique_id=2144014406 instance=ExtResource("1_glv2v")]
position = Vector2(857, -661)
position = Vector2(258, -983.00006)
rotation = 0.24779713
MeetingResource = ExtResource("3_r0du0")
[node name="Meeting8" parent="." unique_id=1157887697 instance=ExtResource("1_glv2v")]
position = Vector2(964, -555)
position = Vector2(365, -877.00006)
rotation = 0.24779713
[node name="Meeting9" parent="." unique_id=1055632102 instance=ExtResource("1_glv2v")]
position = Vector2(614, -732.99994)
position = Vector2(15, -1055)
rotation = 0.24779713
MeetingResource = ExtResource("5_fos0i")
[node name="Meeting2" parent="." unique_id=1691479453 instance=ExtResource("1_glv2v")]
position = Vector2(937, -352)
position = Vector2(338, -674.00006)
rotation = -0.5541229
MeetingResource = ExtResource("3_r0du0")
[node name="Meeting3" parent="." unique_id=673551448 instance=ExtResource("1_glv2v")]
position = Vector2(762.9999, -181.00012)
position = Vector2(163.99982, -503.0002)
rotation = -0.18364333
MeetingResource = ExtResource("3_r0du0")
@@ -201,3 +157,5 @@ offset_right = 1080.0
offset_bottom = 571.0
mouse_filter = 2
script = ExtResource("7_lgr22")
[node name="Camera2D" type="Camera2D" parent="." unique_id=1154975713]

View File

@@ -8,4 +8,7 @@
<ItemGroup>
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.7.0" />
</ItemGroup>
<ItemGroup>
<Folder Include=".godot\" />
</ItemGroup>
</Project>