diff --git a/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs b/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs index da884fb3a..dff8b3c0c 100644 --- a/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs +++ b/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs @@ -16,6 +16,7 @@ public static class GameEvents public static HideInteractionUiEvent HideInteractionUiEvent = new(); public static InventoryChangedEvent InventoryChangedEvent = new(); + public static SmartVariablesDirtyEvent SmartVariablesDirtyEvent = new(); } public static class RestaurantEvents @@ -100,6 +101,11 @@ public class ShowInteractionUiEvent : IEvent public class HideInteractionUiEvent : IEvent { } + public class SmartVariablesDirtyEvent : IEvent + { + public SmartVariablesDomain DomainFlags; + } + #region RestaurantInteractionEvents public class ItemSlotSelectedEvent : IEvent diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantGlobalMessageController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantGlobalMessageController.cs new file mode 100644 index 000000000..e43fa0310 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantGlobalMessageController.cs @@ -0,0 +1,44 @@ +using System.Threading.Tasks; +using UnityEngine; + +namespace DDD +{ + public class RestaurantGlobalMessageController : FlowController + { + private const string ReadyForRestaurantMessageKey = "ready_for_restaurant_message"; + private const string RunRestaurantMessageKey = "run_restaurnat_message"; + + public override Task InitializeController() + { + return Task.CompletedTask; + } + + public override Task InitializeState() + { + return Task.CompletedTask; + } + + public override Task OnExitCurrentFlow(GameFlowState exitingFlowState) + { + return Task.CompletedTask; + } + + public override Task OnReadyNewFlow(GameFlowState newFlowState) + { + var evt = GameEvents.ShowGlobalMessageEvent; + + if (newFlowState == GameFlowState.ReadyForRestaurant) + { + evt.Set(ReadyForRestaurantMessageKey, 3f, newTextColor:Color.yellow, fontSize:60); + } + else if (newFlowState == GameFlowState.RunRestaurant) + { + evt.Set(RunRestaurantMessageKey, 3f, newTextColor:Color.yellow, fontSize:60); + } + + EventBus.Broadcast(evt); + + return Task.CompletedTask; + } + } +} \ No newline at end of file