From ae5cc0c5c8f2fc6e55bf6ac4050545d0d6b55bbd Mon Sep 17 00:00:00 2001 From: MAOCI <33422088+themaoci@users.noreply.github.com> Date: Sat, 8 Jun 2019 01:42:03 +0200 Subject: [PATCH] LMAO wtf is this shit ? --- .../Scripts/Core/NetworkControl.cs | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/Assets/SteamMultiplayer/Scripts/Core/NetworkControl.cs b/Assets/SteamMultiplayer/Scripts/Core/NetworkControl.cs index 143bc61..93f50ad 100644 --- a/Assets/SteamMultiplayer/Scripts/Core/NetworkControl.cs +++ b/Assets/SteamMultiplayer/Scripts/Core/NetworkControl.cs @@ -484,31 +484,27 @@ public RPCInfo(int funcIndex, object[] values) private uint width, height; private Texture2D downloadedAvatar; + //fix for your stupid avatar shit code `made by TheMaoci` - same goes to current player ... IEnumerator _FetchAcatar(CSteamID id, RawImage ui) { - var AvatarInt = SteamFriends.GetLargeFriendAvatar(id); + var AvatarInt = -1; while (AvatarInt == -1) { - yield return null; + AvatarInt = SteamFriends.GetLargeFriendAvatar(id); } - if (AvatarInt > 0) + SteamUtils.GetImageSize(AvatarInt, out width, out height); + if (width > 0 && height > 0) { - SteamUtils.GetImageSize(AvatarInt, out width, out height); - - if (width > 0 && height > 0) - { - byte[] avatarStream = new byte[4 * (int) width * (int) height]; - SteamUtils.GetImageRGBA(AvatarInt, avatarStream, 4 * (int) width * (int) height); - - downloadedAvatar = new Texture2D((int) width, (int) height, TextureFormat.RGBA32, false); - downloadedAvatar.LoadRawTextureData(avatarStream); - downloadedAvatar.Apply(); - - ui.texture = downloadedAvatar; - } + byte[] avatarStream = new byte[4 * (int) width * (int) height]; + SteamUtils.GetImageRGBA(AvatarInt, avatarStream, 4 * (int) width * (int) height); + downloadedAvatar = new Texture2D((int) width, (int) height, TextureFormat.RGBA32, false); + downloadedAvatar.LoadRawTextureData(avatarStream); + downloadedAvatar.Apply(); + ui.texture = downloadedAvatar; } + yield return null; } - + //fix end #endregion public void CheckJoinedLobby()