mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +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();
|
||||
|
||||
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 )
|
||||
OnUpdate();
|
||||
}
|
||||
|
@ -73,13 +73,20 @@ public override void Update()
|
||||
if ( !IsValid )
|
||||
return;
|
||||
|
||||
native.api.SteamAPI_RunCallbacks();
|
||||
|
||||
RunCallbacks();
|
||||
Voice.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>
|
||||
/// Call when finished to shut down the Steam client.
|
||||
/// </summary>
|
||||
|
@ -88,7 +88,10 @@ public void Dispose()
|
||||
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 )
|
||||
return;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@ -36,6 +37,8 @@ public partial class Inventory : IDisposable
|
||||
|
||||
internal SteamNative.SteamInventory inventory;
|
||||
|
||||
private Stopwatch fetchRetryTimer;
|
||||
|
||||
private bool IsServer { get; set; }
|
||||
|
||||
internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server )
|
||||
@ -214,12 +217,26 @@ internal void FetchItemDefinitions()
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called every frame
|
||||
/// No need to call this manually if you're calling Update
|
||||
/// </summary>
|
||||
internal void Update()
|
||||
public void Update()
|
||||
{
|
||||
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();
|
||||
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 )
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user