45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Jovian.InGameLogging {
|
|
[Serializable]
|
|
public readonly struct LogChannel : IEquatable<LogChannel> {
|
|
private readonly string id;
|
|
|
|
public string Id => id;
|
|
|
|
public LogChannel(string id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public static readonly LogChannel Combat = new("Combat");
|
|
public static readonly LogChannel CharacterCreation = new("CharacterCreation");
|
|
public static readonly LogChannel World = new("World");
|
|
public static readonly LogChannel General = new("General");
|
|
|
|
public bool Equals(LogChannel other) {
|
|
return string.Equals(id, other.id, StringComparison.Ordinal);
|
|
}
|
|
|
|
public override bool Equals(object obj) {
|
|
return obj is LogChannel other && Equals(other);
|
|
}
|
|
|
|
public override int GetHashCode() {
|
|
return id != null ? id.GetHashCode() : 0;
|
|
}
|
|
|
|
public override string ToString() {
|
|
return id ?? string.Empty;
|
|
}
|
|
|
|
public static bool operator ==(LogChannel left, LogChannel right) {
|
|
return left.Equals(right);
|
|
}
|
|
|
|
public static bool operator !=(LogChannel left, LogChannel right) {
|
|
return !left.Equals(right);
|
|
}
|
|
}
|
|
}
|