2016-10-04 01:09:11 +03:00
|
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2019-04-15 22:54:50 +03:00
|
|
|
|
/*
|
2016-10-04 01:09:11 +03:00
|
|
|
|
namespace Facepunch.Steamworks.Test
|
|
|
|
|
{
|
|
|
|
|
public partial class Server
|
|
|
|
|
{
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void StatsGet()
|
|
|
|
|
{
|
2017-06-25 22:23:34 +03:00
|
|
|
|
using ( var server = new Facepunch.Steamworks.Server( 252490, new ServerInit( "rust", "Rust" ) ) )
|
2016-10-04 01:09:11 +03:00
|
|
|
|
{
|
2016-10-05 14:44:01 +03:00
|
|
|
|
Assert.IsTrue( server.IsValid );
|
2016-10-04 01:09:11 +03:00
|
|
|
|
server.LogOnAnonymous();
|
|
|
|
|
|
|
|
|
|
ulong MySteamId = 76561197960279927;
|
|
|
|
|
|
2016-11-03 13:52:52 +03:00
|
|
|
|
bool GotStats = false;
|
2016-10-04 01:09:11 +03:00
|
|
|
|
|
2017-07-31 14:56:15 +03:00
|
|
|
|
server.Stats.Refresh( MySteamId, (steamid, success) =>
|
2016-11-03 13:52:52 +03:00
|
|
|
|
{
|
|
|
|
|
GotStats = true;
|
|
|
|
|
Assert.IsTrue( success );
|
2016-10-04 01:09:11 +03:00
|
|
|
|
|
2016-11-03 13:52:52 +03:00
|
|
|
|
var deathsInCallback = server.Stats.GetInt( MySteamId, "deaths", -1 );
|
|
|
|
|
Console.WriteLine( "deathsInCallback: {0}", deathsInCallback );
|
|
|
|
|
Assert.IsTrue( deathsInCallback > 0 );
|
|
|
|
|
} );
|
2016-10-04 01:09:11 +03:00
|
|
|
|
|
2016-11-03 13:57:52 +03:00
|
|
|
|
|
|
|
|
|
server.UpdateWhile( () => !GotStats );
|
2016-10-04 01:09:11 +03:00
|
|
|
|
|
2016-11-03 13:52:52 +03:00
|
|
|
|
var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 );
|
|
|
|
|
Console.WriteLine( "deathsInCallback: {0}", deaths );
|
2016-10-04 01:09:11 +03:00
|
|
|
|
Assert.IsTrue( deaths > 0 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-15 22:54:50 +03:00
|
|
|
|
*/
|