mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-04-10 11:30:05 +03:00
Client.Overlay: fixed potential null-ref exception in Overlay.Enabled and added documentation
Server.ServerInit: added helper function and additional constructor to help with IP address format Server.Stats: added ClearUserAchievement, SetUserAchievement, GetUserAchievement
This commit is contained in:
parent
e88535ac57
commit
f1c7aa3726
@ -25,9 +25,16 @@ namespace Facepunch.Steamworks
|
|||||||
{
|
{
|
||||||
internal Client client;
|
internal Client client;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the Steam Overlay is actually available, false if it was not injected properly.
|
||||||
|
/// Note that it may take some time after Steam_Init() until the overlay injection is complete.
|
||||||
|
/// Also note that the overlay will only work if the Steam API is initialized before the rendering device is initialized. That means that
|
||||||
|
/// for Unity3D games the overlay is only available if the game was launched directly through Steam. Calling Steam_Init() from Mono
|
||||||
|
/// code is too late.
|
||||||
|
/// </summary>
|
||||||
public bool Enabled
|
public bool Enabled
|
||||||
{
|
{
|
||||||
get { return client.native.utils.IsOverlayEnabled(); }
|
get { return client.native != null ? client.native.utils.IsOverlayEnabled() : false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenUserPage( string name, ulong steamid ) { client.native.friends.ActivateGameOverlayToUser( name, steamid ); }
|
public void OpenUserPage( string name, ulong steamid ) { client.native.friends.ActivateGameOverlayToUser( name, steamid ); }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@ -42,6 +43,31 @@ namespace Facepunch.Steamworks
|
|||||||
GameDescription = gameDesc;
|
GameDescription = gameDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServerInit(IPAddress ip, string modDir, string gameDesc)
|
||||||
|
{
|
||||||
|
IpAddress = ip.IpToInt32();
|
||||||
|
ModDir = modDir;
|
||||||
|
GameDescription = gameDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// set the server ip
|
||||||
|
/// </summary>
|
||||||
|
public ServerInit Ip(string ip)
|
||||||
|
{
|
||||||
|
IpAddress = IPAddress.Parse(ip).IpToInt32();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// set the server ip
|
||||||
|
/// </summary>
|
||||||
|
public ServerInit Ip(IPAddress ip)
|
||||||
|
{
|
||||||
|
IpAddress = ip.IpToInt32();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the Steam quert port
|
/// Set the Steam quert port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -111,5 +111,42 @@ namespace Facepunch.Steamworks
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the unlock state of an achievement for the given user. Useful mainly for testing purposes.
|
||||||
|
/// If the "set by" field says "Official GS", only a registerd server IP may do this.
|
||||||
|
/// You should have called Refresh for this userid - which downloads the stats from the backend.
|
||||||
|
/// If you didn't call it this will always return false.
|
||||||
|
/// </summary>
|
||||||
|
public bool ClearUserAchievement(ulong steamid, string name)
|
||||||
|
{
|
||||||
|
return server.native.gameServerStats.ClearUserAchievement(steamid, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Awards an achievement for the given user. The achievement must have been set up in the steam backand.
|
||||||
|
/// If the "set by" field says "Official GS", only a registerd server IP may do this.
|
||||||
|
/// You should have called Refresh for this userid - which downloads the stats from the backend.
|
||||||
|
/// If you didn't call it this will always return false.
|
||||||
|
/// </summary>
|
||||||
|
public bool SetUserAchievement(ulong steamid, string name)
|
||||||
|
{
|
||||||
|
return server.native.gameServerStats.SetUserAchievement(steamid, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the given user has the given achievement unlocked. The achievement must have been set up in the steam backand.
|
||||||
|
/// You should have called Refresh for this userid - which downloads the stats from the backend.
|
||||||
|
/// If you didn't call it this will always return false.
|
||||||
|
/// </summary>
|
||||||
|
public bool GetUserAchievement(ulong steamid, string name)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if(!server.native.gameServerStats.GetUserAchievement(steamid, name, ref result))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user