Files
zeling_v2/Assets/Scripts/Core/Events/GameStateId.cs
2026-05-08 11:04:00 +08:00

22 lines
828 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace BaseGames.Core.Events
{
/// <summary>
/// 游戏状态 ID值类型替代旧版 GameState 枚举)。
/// 具体实例由 GameStates 静态工厂创建。
/// </summary>
public readonly struct GameStateId : System.IEquatable<GameStateId>
{
public readonly string Id;
public GameStateId(string id) => Id = id;
public bool Equals(GameStateId other) => Id == other.Id;
public override bool Equals(object obj) => obj is GameStateId g && Equals(g);
public override int GetHashCode() => Id?.GetHashCode() ?? 0;
public override string ToString() => Id ?? "<null>";
public static bool operator ==(GameStateId a, GameStateId b) => a.Equals(b);
public static bool operator !=(GameStateId a, GameStateId b) => !a.Equals(b);
}
}