Activity Change Event

This commit is contained in:
glax 2024-11-02 23:51:59 +01:00
parent eda66a2334
commit 386c211de5
3 changed files with 7 additions and 1 deletions

View File

@ -28,4 +28,5 @@ public enum CS2Event : byte {
OnBombExploded = 24, OnBombExploded = 24,
AnyEvent = 25, AnyEvent = 25,
AnyMessage = 26, AnyMessage = 26,
OnActivityChange = 27
} }

View File

@ -15,6 +15,9 @@ internal static class CS2EventGenerator
if(events.Count > 0) if(events.Count > 0)
events.Add(new ValueTuple<CS2Event, CS2EventArgs>(CS2Event.AnyEvent, new CS2EventArgs(events.Count))); events.Add(new ValueTuple<CS2Event, CS2EventArgs>(CS2Event.AnyEvent, new CS2EventArgs(events.Count)));
if (lastGameState.Player?.Activity != newGameState.Player?.Activity)
events.Add(new(CS2Event.OnActivityChange, new CS2EventArgs(newGameState.Player?.Activity)));
events.Add(new ValueTuple<CS2Event, CS2EventArgs>(CS2Event.AnyMessage, new CS2EventArgs())); events.Add(new ValueTuple<CS2Event, CS2EventArgs>(CS2Event.AnyMessage, new CS2EventArgs()));
return events; return events;

View File

@ -99,6 +99,7 @@ public class CS2GSI
CS2Event.OnBombExploded => this.OnBombExploded, CS2Event.OnBombExploded => this.OnBombExploded,
CS2Event.AnyEvent => this.AnyEvent, CS2Event.AnyEvent => this.AnyEvent,
CS2Event.AnyMessage => this.AnyMessage, CS2Event.AnyMessage => this.AnyMessage,
CS2Event.OnActivityChange => this.OnActivityChange,
_ => throw new ArgumentException(Resources.Unknown_Event, nameof(cs2Event)) _ => throw new ArgumentException(Resources.Unknown_Event, nameof(cs2Event))
}; };
} }
@ -133,6 +134,7 @@ public class CS2GSI
OnBombDefused, OnBombDefused,
OnBombExploded, OnBombExploded,
AnyEvent, AnyEvent,
AnyMessage; AnyMessage,
OnActivityChange;
} }