Unity fixes

This commit is contained in:
Garry Newman 2018-02-19 10:59:57 +00:00
parent c4617c5884
commit 6982d05042
3 changed files with 8 additions and 4 deletions

View File

@ -237,7 +237,7 @@ public Image GetCachedAvatar( AvatarSize size, ulong steamid )
break; break;
} }
if ( imageid == 0 || imageid == 2 ) if ( imageid >= 0 && imageid <= 10 )
return null; return null;
var img = new Image() var img = new Image()
@ -333,6 +333,7 @@ internal void Cycle()
} }
} }
private void OnPersonaStateChange( PersonaStateChange_t data ) private void OnPersonaStateChange( PersonaStateChange_t data )
{ {
if ( (data.ChangeFlags & 0x0040) != 0x0040 ) return; // wait for k_EPersonaChangeAvatar if ( (data.ChangeFlags & 0x0040) != 0x0040 ) return; // wait for k_EPersonaChangeAvatar

View File

@ -29,7 +29,7 @@ unsafe internal bool TryLoad( SteamNative.SteamUtils utils )
if ( utils.GetImageSize( Id, out width, out height ) == false ) if ( utils.GetImageSize( Id, out width, out height ) == false )
{ {
IsError = true; IsError = true;
return true; return false;
} }
var buffer = new byte[ width * height * 4 ]; var buffer = new byte[ width * height * 4 ];
@ -39,7 +39,7 @@ unsafe internal bool TryLoad( SteamNative.SteamUtils utils )
if ( utils.GetImageRGBA( Id, (IntPtr) ptr, buffer.Length ) == false ) if ( utils.GetImageRGBA( Id, (IntPtr) ptr, buffer.Length ) == false )
{ {
IsError = true; IsError = true;
return true; return false;
} }
} }

View File

@ -32,10 +32,13 @@ public static void ForUnity( string platform )
} }
IsUnity = true; IsUnity = true;
UseThisCall = SteamNative.Platform.Os == OperatingSystem.Windows;
Console.WriteLine( "Facepunch.Steamworks Unity: " + platform ); Console.WriteLine( "Facepunch.Steamworks Unity: " + platform );
Console.WriteLine( "Facepunch.Steamworks Os: " + SteamNative.Platform.Os ); Console.WriteLine( "Facepunch.Steamworks Os: " + SteamNative.Platform.Os );
Console.WriteLine( "Facepunch.Steamworks Arch: " + SteamNative.Platform.Arch ); Console.WriteLine( "Facepunch.Steamworks Arch: " + SteamNative.Platform.Arch );
} }
/// <summary> /// <summary>
@ -47,7 +50,7 @@ public static void ForUnity( string platform )
/// for releasing his shit open source under the MIT license so we can all learn and iterate. /// for releasing his shit open source under the MIT license so we can all learn and iterate.
/// ///
/// </summary> /// </summary>
internal static bool UseThisCall { get { return SteamNative.Platform.Os == OperatingSystem.Windows && !IsUnity; } } public static bool UseThisCall { get; set; } = SteamNative.Platform.Os == OperatingSystem.Windows;
/// <summary> /// <summary>