ProjectDDD/Assets/_DDD/_Scripts/GameEvent/GameEvents.cs

76 lines
1.9 KiB
C#
Raw Normal View History

2025-07-21 07:56:12 +00:00
using System;
using System.Threading.Tasks;
using UnityEngine;
2025-07-17 08:15:40 +00:00
namespace DDD
{
2025-07-22 03:55:04 +00:00
public static class GameEvents
{
public static TimeScaleChangeEvent RequestTimeScaleChangeEvent = new();
public static FadeInEvent FadeInEvent = new();
public static FadeOutEvent FadeOutEvent = new();
public static OpenPopupUiEvent OpenPopupUiEvent = new();
public static ClosePopupUiEvent ClosePopupUiEvent = new();
public static ShowGlobalMessageEvent RequestShowGlobalMessageEvent = new();
public static InteractionEvent Interaction = new();
public static InventoryChangedEvent InventoryChangedEvent = new();
}
2025-07-21 07:56:12 +00:00
// public static class RestaurantEvents
// {
// // Some events...
// }
2025-07-22 03:55:04 +00:00
2025-07-21 07:56:12 +00:00
// public static class VoyageEvents
// {
// // Some events...
// }
public class TimeScaleChangeEvent : IEvent
2025-07-17 08:15:40 +00:00
{
2025-07-22 03:55:04 +00:00
public object Requester;
public float NewTimeScale;
2025-07-21 07:56:12 +00:00
}
public class FadeInEvent : IEvent
{
2025-07-22 03:55:04 +00:00
public float Duration;
public TaskCompletionSource<bool> CompletionSource;
2025-07-21 07:56:12 +00:00
public Task WaitAsync() => CompletionSource.Task;
}
public class FadeOutEvent : IEvent
{
2025-07-22 03:55:04 +00:00
public float Duration;
public TaskCompletionSource<bool> CompletionSource;
2025-07-21 07:56:12 +00:00
public Task WaitAsync() => CompletionSource.Task;
}
public class ShowGlobalMessageEvent : IEvent
{
2025-07-22 03:55:04 +00:00
public string NewMessageKey;
public float ShowDuration;
public float FadeDuration;
2025-07-17 08:15:40 +00:00
}
2025-07-21 07:56:12 +00:00
public class OpenPopupUiEvent : IEvent
{
2025-07-22 03:55:04 +00:00
public Type UiType;
2025-07-21 07:56:12 +00:00
}
public class ClosePopupUiEvent : IEvent
2025-07-17 08:15:40 +00:00
{
2025-07-22 03:55:04 +00:00
public Type UiType;
2025-07-17 08:15:40 +00:00
}
public class InteractionEvent : IEvent
{
public GameObject Causer;
public GameObject Target;
}
public class InventoryChangedEvent : IEvent { }
}