add more meetings
This commit is contained in:
@@ -7,11 +7,13 @@ namespace Game;
|
||||
[SceneTree]
|
||||
public partial class DaySchedule : PanelContainer
|
||||
{
|
||||
private int _currentSlot;
|
||||
private TimeSlot _currentTimeSlot;
|
||||
|
||||
[Export]
|
||||
private int _hoursInDay = 6;
|
||||
|
||||
private int _newTimeSlot;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
TimeSlotContainer.GetChildren().ToList().ForEach(child => child.QueueFree());
|
||||
@@ -36,15 +38,18 @@ public partial class DaySchedule : PanelContainer
|
||||
|
||||
private void OnNewMeetingStarts()
|
||||
{
|
||||
if (_currentSlot >= GetTimeSlots().Count)
|
||||
_currentTimeSlot?.EndMeeting();
|
||||
|
||||
if (_newTimeSlot >= GetTimeSlots().Count)
|
||||
{
|
||||
EndDay();
|
||||
return;
|
||||
}
|
||||
|
||||
GetTimeSlots()[_currentSlot].StartMeeting();
|
||||
_currentTimeSlot = GetTimeSlots()[_newTimeSlot];
|
||||
_currentTimeSlot.StartMeeting();
|
||||
|
||||
_currentSlot += 1;
|
||||
_newTimeSlot += 1;
|
||||
}
|
||||
|
||||
public void StartDay()
|
||||
@@ -52,8 +57,10 @@ public partial class DaySchedule : PanelContainer
|
||||
ProgressTimer.Start();
|
||||
CurrentTimeLine.Start();
|
||||
|
||||
GetTimeSlots().First().StartMeeting();
|
||||
_currentSlot += 1;
|
||||
_currentTimeSlot = GetTimeSlots().First();
|
||||
|
||||
_currentTimeSlot.StartMeeting();
|
||||
_newTimeSlot += 1;
|
||||
|
||||
EventBus.DayStarted?.Invoke();
|
||||
}
|
||||
@@ -61,6 +68,10 @@ public partial class DaySchedule : PanelContainer
|
||||
public void EndDay()
|
||||
{
|
||||
GD.Print("The DAY was EXECUTED!");
|
||||
|
||||
_currentTimeSlot = null;
|
||||
_newTimeSlot = 0;
|
||||
|
||||
ProgressTimer.Stop();
|
||||
CurrentTimeLine.Stop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user