mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 06:35:49 +03:00
Added UpdateWhile
This commit is contained in:
parent
65dec9d809
commit
947fc190d2
@ -29,11 +29,8 @@ public void StatsGet()
|
|||||||
Assert.IsTrue( deathsInCallback > 0 );
|
Assert.IsTrue( deathsInCallback > 0 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
while ( !GotStats )
|
|
||||||
{
|
server.UpdateWhile( () => !GotStats );
|
||||||
server.Update();
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 );
|
var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 );
|
||||||
Console.WriteLine( "deathsInCallback: {0}", deaths );
|
Console.WriteLine( "deathsInCallback: {0}", deaths );
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
Called with a message from Steam
|
Called with a message from Steam
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</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">
|
<member name="T:Facepunch.Steamworks.Inventory.Item">
|
||||||
<summary>
|
<summary>
|
||||||
An item in your inventory.
|
An item in your inventory.
|
||||||
|
@ -94,5 +94,19 @@ public virtual void Update()
|
|||||||
if ( OnUpdate != null )
|
if ( OnUpdate != null )
|
||||||
OnUpdate();
|
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