mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +03:00
Added UpdateWhile
This commit is contained in:
parent
65dec9d809
commit
947fc190d2
@ -29,11 +29,8 @@ public void StatsGet()
|
||||
Assert.IsTrue( deathsInCallback > 0 );
|
||||
} );
|
||||
|
||||
while ( !GotStats )
|
||||
{
|
||||
server.Update();
|
||||
Thread.Sleep( 10 );
|
||||
}
|
||||
|
||||
server.UpdateWhile( () => !GotStats );
|
||||
|
||||
var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 );
|
||||
Console.WriteLine( "deathsInCallback: {0}", deaths );
|
||||
|
@ -14,6 +14,13 @@
|
||||
Called with a message from Steam
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Facepunch.Steamworks.BaseSteamworks.UpdateWhile(System.Func{System.Boolean})">
|
||||
<summary>
|
||||
Run Update until func returns false.
|
||||
This will cause your program to lock up until it finishes.
|
||||
This is useful for things like tests or command line utilities etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Facepunch.Steamworks.Inventory.Item">
|
||||
<summary>
|
||||
An item in your inventory.
|
||||
|
@ -94,5 +94,19 @@ public virtual void Update()
|
||||
if ( OnUpdate != null )
|
||||
OnUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run Update until func returns false.
|
||||
/// This will cause your program to lock up until it finishes.
|
||||
/// This is useful for things like tests or command line utilities etc.
|
||||
/// </summary>
|
||||
public void UpdateWhile( Func<bool> func )
|
||||
{
|
||||
while ( func() )
|
||||
{
|
||||
Update();
|
||||
System.Threading.Thread.Sleep( 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user