Skip to content

Commit

Permalink
Updated Example project to ability to work with a new Game Pipe handler
Browse files Browse the repository at this point in the history
  • Loading branch information
GVNCoder committed Jan 24, 2021
1 parent 79358eb commit c059732
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Examples/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -84,7 +85,7 @@ internal static async Task MainAsync(string[] args)
throw new InvalidOperationException("Invalid input!");

// cuz Singleplayer = 0
var gameMode = (ZPlayMode)targetGameMode - 1;
var gameMode = (ZPlayMode) targetGameMode;

#endregion

Expand Down Expand Up @@ -114,17 +115,17 @@ internal static async Task MainAsync(string[] args)
}
}

internal static async Task _RunAndTrack(IZRunGame gameProcess)
internal static async Task _RunAndTrack(IZGameProcess gameProcess)
{
var resetEvent = new ManualResetEvent(false);

// track game pipe
gameProcess.Pipe += (sender, pipeArgs) =>
gameProcess.StateChanged += (sender, pipeArgs) =>
{
Console.WriteLine(pipeArgs.FullMessage);
Console.WriteLine(pipeArgs.RawFullMessage);

// return from _RunAndTrack if game closed
if (pipeArgs.SecondPart.Contains("Closed"))
if (pipeArgs.Event == ZGameEvent.StateChanged && pipeArgs.States.Contains(ZGameState.State_GameClose))
{
resetEvent.Set();
}
Expand Down

0 comments on commit c059732

Please sign in to comment.