nice nice nice

This commit is contained in:
2026-08-03 13:15:39 +02:00
parent 0bb8ce47c0
commit 737919f66f
25 changed files with 206 additions and 61 deletions

View File

@@ -65,7 +65,12 @@ public partial class Company : Resource
private void EmitCompanyStatusChanged()
{
EventBus.CompanyChanged.Invoke(new CompanyStats(Hype, Money, Workers, Runway));
EventBus.CompanyChanged.Invoke(ToCompanyStats());
}
public CompanyStats ToCompanyStats()
{
return new CompanyStats(Hype, Money, Workers, Runway);
}
public record CompanyStats(float Hype, float Money, float Workers, int Runway);

View File

@@ -4,9 +4,9 @@ using yourareanaiceo;
public partial class CurrentTimeLine : Panel
{
[Export]
private float _speed = 15f;
public float Speed = 15f;
public bool Running { get; set; }
public bool Running { get; private set; }
public override void _Process(double delta)
{
@@ -14,8 +14,13 @@ public partial class CurrentTimeLine : Panel
return;
var pos = OffsetTransformPosition;
pos.Y += _speed * delta.toFloat();
pos.Y += Speed * delta.toFloat();
OffsetTransformPosition = pos;
}
public void Start()
{
Running = true;
}
}

View File

@@ -1,9 +1,12 @@
using System.Collections.Generic;
using System.Linq;
using Godot;
[SceneTree]
public partial class DaySchedule : PanelContainer
{
private int _currentSlot;
[Export]
private int _hoursInDay = 6;
@@ -17,10 +20,35 @@ public partial class DaySchedule : PanelContainer
TimeSlotContainer.AddChild(timeSlot);
}
ProgressTimer.Timeout += OnNewMeetingStarts;
SetupCurrentTimeLine();
}
private void SetupCurrentTimeLine()
{
var timeSlot = Instantiator.Instantiate<TimeSlot>();
CurrentTimeLine.Speed = (float)(timeSlot.Size.Y / ProgressTimer.WaitTime);
}
private void OnNewMeetingStarts()
{
GetTimeSlots()[_currentSlot].StartMeeting();
_currentSlot += 1;
}
public void StartDay()
{
CurrentTimeLine.Running = true;
ProgressTimer.Start();
CurrentTimeLine.Start();
GetTimeSlots().First().StartMeeting();
_currentSlot += 1;
}
private List<TimeSlot> GetTimeSlots()
{
return [.. TimeSlotContainer.GetChildren().OfType<TimeSlot>()];
}
}

View File

@@ -36,6 +36,10 @@ mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_cm0pq")
script = ExtResource("1_b6clr")
[node name="ProgressTimer" type="Timer" parent="." unique_id=131279089]
unique_name_in_owner = true
wait_time = 2.0
[node name="TimeSlotContainer" type="VBoxContainer" parent="." unique_id=1932322928]
unique_name_in_owner = true
layout_mode = 2

View File

@@ -1,4 +1,5 @@
using Godot;
using yourareanaiceo;
public partial class DropZone : Control
{
@@ -13,8 +14,8 @@ public partial class DropZone : Control
var meetingControl = ((MeetingControlDragData)data).MeetingControl;
var meetingPhysicsBox = meetingControl.MeetingPhysicsBox;
var main = (Main)FindParent("Main");
main.AddChild(meetingPhysicsBox);
var game = this.GetGame();
game.AddChild(meetingPhysicsBox);
meetingPhysicsBox.Position = GetGlobalMousePosition();
meetingControl.QueueFree();

View File

@@ -0,0 +1,11 @@
using Godot;
namespace yourareanaiceo;
public static class NodeExtensions
{
public static Game GetGame(this Node node)
{
return node.GetTree().CurrentScene as Game;
}
}

View File

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

15
Game.cs Normal file
View File

@@ -0,0 +1,15 @@
using Godot;
using yourareanaiceo;
[SceneTree]
public partial class Game : Node2D
{
public GameState GameState { get; set; } = new();
public override void _Ready()
{
ExecuteButton.Pressed += () => DaySchedule.StartDay();
EventBus.CompanyChanged?.Invoke(GameState.Company.ToCompanyStats());
}
}

View File

@@ -1,13 +1,13 @@
[gd_scene format=3 uid="uid://b2rl7r8oav3hy"]
[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"]
[ext_resource type="Script" uid="uid://d1h0qvskvk1wu" path="res://Game.cs" id="1_joorw"]
[ext_resource type="PackedScene" uid="uid://ckdqrg8c0mq8h" path="res://CompanyStatsContainer.tscn" id="2_2vekm"]
[ext_resource type="PackedScene" uid="uid://covomnw8s7k1n" path="res://DaySchedule.tscn" id="3_yx171"]
[ext_resource type="PackedScene" uid="uid://dciugg77wsy6p" path="res://MeetingPhysicsBox.tscn" id="4_yhmtn"]
[ext_resource type="Resource" uid="uid://mifwco1yj8kc" path="res://resources/meetings/coffee_meeting.tres" id="5_gwjdr"]
[ext_resource type="Resource" uid="uid://du72uxjqr0h4a" path="res://resources/meetings/lockin.tres" id="6_lvtmh"]
[ext_resource type="Resource" uid="uid://bcd4qf4i84pwf" path="res://resources/meetings/work_product_1.tres" id="7_yyih5"]
[ext_resource type="Script" uid="uid://bs531c76ivhtf" path="res://DropZone.cs" id="8_qjyg3"]
[sub_resource type="Gradient" id="Gradient_trn2v"]
offsets = PackedFloat32Array(0, 0.5518293, 1)
@@ -31,12 +31,12 @@ 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]
script = ExtResource("1_3dxm6")
[node name="Game" type="Node2D" unique_id=287617203]
script = ExtResource("1_joorw")
[node name="MeetingSpawn" type="Marker2D" parent="." unique_id=1266113438]
unique_name_in_owner = true
position = Vector2(775, 36)
position = Vector2(167, -412)
gizmo_extents = 40.0
[node name="TextureRect" type="TextureRect" parent="." unique_id=594808349]
@@ -64,12 +64,12 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="CompanyStatsContainer" parent="CanvasLayer/Control" unique_id=317328071 instance=ExtResource("2_trn2v")]
[node name="CompanyStatsContainer" parent="CanvasLayer/Control" unique_id=317328071 instance=ExtResource("2_2vekm")]
layout_mode = 1
offset_left = -249.53503
offset_right = 0.0
[node name="DaySchedule" parent="." unique_id=457829015 instance=ExtResource("1_r0du0")]
[node name="DaySchedule" parent="." unique_id=457829015 instance=ExtResource("3_yx171")]
unique_name_in_owner = true
offset_left = -493.0
offset_top = -277.00006
@@ -105,57 +105,57 @@ shape = SubResource("RectangleShape2D_ig7tw")
position = Vector2(1120, -339)
shape = SubResource("RectangleShape2D_ig7tw")
[node name="Meeting" parent="." unique_id=796440984 instance=ExtResource("1_glv2v")]
[node name="Meeting" parent="." unique_id=796440984 instance=ExtResource("4_yhmtn")]
position = Vector2(35, -776.00006)
MeetingResource = ExtResource("3_r0du0")
MeetingResource = ExtResource("5_gwjdr")
[node name="Meeting4" parent="." unique_id=1960552374 instance=ExtResource("1_glv2v")]
[node name="Meeting4" parent="." unique_id=1960552374 instance=ExtResource("4_yhmtn")]
position = Vector2(108, -662.00006)
rotation = 0.24779713
MeetingResource = ExtResource("4_cm0pq")
MeetingResource = ExtResource("6_lvtmh")
[node name="Meeting5" parent="." unique_id=1692042144 instance=ExtResource("1_glv2v")]
[node name="Meeting5" parent="." unique_id=1692042144 instance=ExtResource("4_yhmtn")]
position = Vector2(252, -822.00006)
rotation = 0.24779713
MeetingResource = ExtResource("5_fos0i")
MeetingResource = ExtResource("7_yyih5")
[node name="Meeting6" parent="." unique_id=2120697586 instance=ExtResource("1_glv2v")]
[node name="Meeting6" parent="." unique_id=2120697586 instance=ExtResource("4_yhmtn")]
position = Vector2(5, -942)
rotation = 0.24779713
MeetingResource = ExtResource("3_r0du0")
MeetingResource = ExtResource("5_gwjdr")
[node name="Meeting7" parent="." unique_id=2144014406 instance=ExtResource("1_glv2v")]
[node name="Meeting7" parent="." unique_id=2144014406 instance=ExtResource("4_yhmtn")]
position = Vector2(258, -983.00006)
rotation = 0.24779713
MeetingResource = ExtResource("3_r0du0")
MeetingResource = ExtResource("5_gwjdr")
[node name="Meeting8" parent="." unique_id=1157887697 instance=ExtResource("1_glv2v")]
[node name="Meeting8" parent="." unique_id=1157887697 instance=ExtResource("4_yhmtn")]
position = Vector2(365, -877.00006)
rotation = 0.24779713
[node name="Meeting9" parent="." unique_id=1055632102 instance=ExtResource("1_glv2v")]
[node name="Meeting9" parent="." unique_id=1055632102 instance=ExtResource("4_yhmtn")]
position = Vector2(15, -1055)
rotation = 0.24779713
MeetingResource = ExtResource("5_fos0i")
MeetingResource = ExtResource("7_yyih5")
[node name="Meeting2" parent="." unique_id=1691479453 instance=ExtResource("1_glv2v")]
[node name="Meeting2" parent="." unique_id=1691479453 instance=ExtResource("4_yhmtn")]
position = Vector2(338, -674.00006)
rotation = -0.5541229
MeetingResource = ExtResource("3_r0du0")
MeetingResource = ExtResource("5_gwjdr")
[node name="Meeting3" parent="." unique_id=673551448 instance=ExtResource("1_glv2v")]
[node name="Meeting3" parent="." unique_id=673551448 instance=ExtResource("4_yhmtn")]
position = Vector2(163.99982, -503.0002)
rotation = -0.18364333
MeetingResource = ExtResource("3_r0du0")
MeetingResource = ExtResource("5_gwjdr")
[node name="DropZone" type="Control" parent="." unique_id=80494692]
layout_mode = 3
anchors_preset = 0
offset_left = 457.0
offset_top = 9.0
offset_right = 1080.0
offset_bottom = 571.0
offset_left = -173.0
offset_top = -323.0
offset_right = 507.0
offset_bottom = 276.0
mouse_filter = 2
script = ExtResource("7_lgr22")
script = ExtResource("8_qjyg3")
[node name="Camera2D" type="Camera2D" parent="." unique_id=1154975713]

6
GameState.cs Normal file
View File

@@ -0,0 +1,6 @@
namespace yourareanaiceo;
public class GameState
{
public Company Company { get; set; } = new();
}

1
GameState.cs.uid Normal file
View File

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

16
Main.cs
View File

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

View File

@@ -1,4 +1,5 @@
using Godot;
using yourareanaiceo;
public sealed partial class MeetingControlDragData(MeetingControl meetingControl) : GodotObject
{
@@ -86,9 +87,9 @@ public partial class MeetingControl : Control
private void RespawnPhysicsBoxFromSpawn()
{
var main = (Main)FindParent("Main");
main.AddChild(MeetingPhysicsBox);
MeetingPhysicsBox.Position = main.MeetingSpawn.GlobalPosition;
var game = this.GetGame();
game.AddChild(MeetingPhysicsBox);
MeetingPhysicsBox.Position = game.MeetingSpawn.GlobalPosition;
QueueFree();
}
@@ -101,4 +102,17 @@ public partial class MeetingControl : Control
return preview;
}
public void Animate()
{
var tween = CreateTween();
tween.TweenProperty(
this,
new NodePath(Control.PropertyName.Scale),
new Vector2(1.2f, 1.2f),
0.4f
);
tween.TweenProperty(this, new NodePath(Control.PropertyName.Scale), Vector2.One, 0.4f);
}
}

View File

@@ -1,4 +1,5 @@
using Godot;
using yourareanaiceo;
[SceneTree]
public partial class TimeSlot : PanelContainer
@@ -30,4 +31,14 @@ public partial class TimeSlot : PanelContainer
if (what == NotificationDragEnd)
MouseFilter = MouseFilterEnum.Ignore;
}
public void StartMeeting()
{
GD.Print("New Meeting starts!");
var gameState = this.GetGame().GameState;
// TODO: TimeSlot hat bekommt die MeetingResource on Drop?? oder zumindest nicht über Gfx gehen
MeetingControl?.MeetingControlGfx.MeetingResource.StartMeeting(gameState);
MeetingControl?.Animate();
}
}

View File

@@ -0,0 +1,14 @@
using Godot;
using yourareanaiceo;
[GlobalClass]
public partial class GainHypeAction : MeetingActionResource
{
[Export]
public int Amount;
public override void Execute(GameState gameState)
{
gameState.Company.Hype += Amount;
}
}

View File

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

View File

@@ -0,0 +1,8 @@
using Godot;
using yourareanaiceo;
[GlobalClass]
public abstract partial class MeetingActionResource : Resource
{
public abstract void Execute(GameState gameState);
}

View File

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

View File

@@ -1,13 +1,32 @@
using System.Linq;
using Godot;
using Godot.Collections;
using yourareanaiceo;
[GlobalClass]
public partial class MeetingResource : Resource
{
[Export]
public Array<MeetingActionResource> OnMeetingStartActions { get; set; } = [];
[Export]
public Array<MeetingActionResource> OnMeetingEndActions { get; set; } = [];
[Export]
public string Title { get; set; }
[Export]
public Color Color { get; set; }
public void StartMeeting(GameState gameState)
{
OnMeetingStartActions.ToList().ForEach(m => m.Execute(gameState));
}
public void EndMeeting(GameState gameState)
{
OnMeetingEndActions.ToList().ForEach(m => m.Execute(gameState));
}
}
public partial class DummyMeetingResource : MeetingResource

View File

@@ -1,9 +1,17 @@
[gd_resource type="Resource" script_class="MeetingResource" format=3 uid="uid://du72uxjqr0h4a"]
[ext_resource type="Script" uid="uid://cuq38lbfa2v74" path="res://resources/MeetingResource.cs" id="1_4yd4m"]
[ext_resource type="Script" uid="uid://cduoflv3vjfmg" path="res://resources/GainHypeAction.cs" id="1_qpv0b"]
[sub_resource type="Resource" id="Resource_7t1gw"]
script = ExtResource("1_qpv0b")
Amount = 20
metadata/_custom_type_script = "uid://cduoflv3vjfmg"
[resource]
script = ExtResource("1_4yd4m")
OnMeetingStartActions = Array[Object]([SubResource("Resource_7t1gw")])
OnMeetingEndActions = null
Title = "LOCK IN"
Color = Color(0.73206806, 0.22440341, 0.33911285, 1)
metadata/_custom_type_script = "uid://cuq38lbfa2v74"

View File

@@ -1,9 +1,17 @@
[gd_resource type="Resource" script_class="MeetingResource" format=3 uid="uid://bcd4qf4i84pwf"]
[ext_resource type="Script" uid="uid://cduoflv3vjfmg" path="res://resources/GainHypeAction.cs" id="1_7t1gw"]
[ext_resource type="Script" uid="uid://cuq38lbfa2v74" path="res://resources/MeetingResource.cs" id="1_qndny"]
[sub_resource type="Resource" id="Resource_b6clr"]
script = ExtResource("1_7t1gw")
Amount = 10
metadata/_custom_type_script = "uid://cduoflv3vjfmg"
[resource]
script = ExtResource("1_qndny")
OnMeetingStartActions = Array[Object]([SubResource("Resource_b6clr")])
OnMeetingEndActions = null
Title = "Work on your Product"
Color = Color(0.4354798, 0.3262509, 0.83488727, 1)
metadata/_custom_type_script = "uid://cuq38lbfa2v74"