mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 06:35:49 +03:00
Exposed update functions, so they can be called manually by the host (profiling etc)
This commit is contained in:
parent
c297033ef7
commit
24affc78d8
@ -89,6 +89,14 @@ public virtual void Update()
|
|||||||
|
|
||||||
Networking.Update();
|
Networking.Update();
|
||||||
|
|
||||||
|
RunUpdateCallbacks();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This gets called automatically in Update. Only call it manually if you know why you're doing it.
|
||||||
|
/// </summary>
|
||||||
|
public void RunUpdateCallbacks()
|
||||||
|
{
|
||||||
if ( OnUpdate != null )
|
if ( OnUpdate != null )
|
||||||
OnUpdate();
|
OnUpdate();
|
||||||
}
|
}
|
||||||
|
@ -73,13 +73,20 @@ public override void Update()
|
|||||||
if ( !IsValid )
|
if ( !IsValid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
native.api.SteamAPI_RunCallbacks();
|
RunCallbacks();
|
||||||
|
|
||||||
Voice.Update();
|
Voice.Update();
|
||||||
|
|
||||||
base.Update();
|
base.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This is called in Update() - there's no need to call it manually unless you're running your own Update
|
||||||
|
/// </summary>
|
||||||
|
public void RunCallbacks()
|
||||||
|
{
|
||||||
|
native.api.SteamAPI_RunCallbacks();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call when finished to shut down the Steam client.
|
/// Call when finished to shut down the Steam client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -88,7 +88,10 @@ public void Dispose()
|
|||||||
Marshal.FreeHGlobal( UncompressBuffer );
|
Marshal.FreeHGlobal( UncompressBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Update()
|
/// <summary>
|
||||||
|
/// This gets called inside Update - so there's no need to call this manually if you're calling update
|
||||||
|
/// </summary>
|
||||||
|
public void Update()
|
||||||
{
|
{
|
||||||
if ( OnCompressedData == null && OnUncompressedData == null )
|
if ( OnCompressedData == null && OnUncompressedData == null )
|
||||||
return;
|
return;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -36,6 +37,8 @@ public partial class Inventory : IDisposable
|
|||||||
|
|
||||||
internal SteamNative.SteamInventory inventory;
|
internal SteamNative.SteamInventory inventory;
|
||||||
|
|
||||||
|
private Stopwatch fetchRetryTimer;
|
||||||
|
|
||||||
private bool IsServer { get; set; }
|
private bool IsServer { get; set; }
|
||||||
|
|
||||||
internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server )
|
internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server )
|
||||||
@ -214,12 +217,26 @@ internal void FetchItemDefinitions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called every frame
|
/// No need to call this manually if you're calling Update
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if ( Definitions == null )
|
if ( Definitions == null )
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Don't try every frame, just try every 10 seconds.
|
||||||
|
//
|
||||||
|
{
|
||||||
|
if ( fetchRetryTimer != null && fetchRetryTimer.Elapsed.TotalSeconds < 10.0f )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( fetchRetryTimer == null )
|
||||||
|
fetchRetryTimer = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
fetchRetryTimer.Reset();
|
||||||
|
fetchRetryTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
FetchItemDefinitions();
|
FetchItemDefinitions();
|
||||||
inventory.LoadItemDefinitions();
|
inventory.LoadItemDefinitions();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,10 @@ public void Dispose()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal void Update()
|
/// <summary>
|
||||||
|
/// No need to call this manually if you're calling Update()
|
||||||
|
/// </summary>
|
||||||
|
public void Update()
|
||||||
{
|
{
|
||||||
if ( OnP2PData == null )
|
if ( OnP2PData == null )
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user