Code:
AllAvatarInfos[index].avatarTexture = Avatar;
This results in no new 'textures' being created (at least according to the listtextures console command). All the AvatarInfos have a texture reference to the exact same texture (Transient.Avatar_2147483647). Using the new keyword passing in a reference to the original texture, new textures are created but they simply link back to the original. I haven't been able to find a method for deep copying the texture data so I can read and display multiple avatars at the same time.
Here's the code block that creates the AvatarInfo for a player:
Code:
// if we haven't read the avatar for this player
if( FindAvatarInfo( AllOnlineFriends[currentAvatarUpdateIndex].UniqueId ) == None)
{
NewAvatarInfo = new class'GrAvatarInfo';
NewAvatarInfo.netID = AllOnlineFriends[currentAvatarUpdateIndex].UniqueId;
NewAvatarInfo.hasAvatar = false;
NewAvatarInfo.FriendOwner = AllOnlineFriends[currentAvatarUpdateIndex];
NewAvatarInfo.avatarID = GetAvatarID();
AllAvatarInfos[NewAvatarInfo.avatarID] = NewAvatarInfo;
OnlineSubSteam.ReadOnlineAvatar( AllOnlineFriends[currentAvatarUpdateIndex].UniqueId, 64, OnReadOnlineAvatarComplete );
}
Non-scaleform test HUD code that displays the textures:
Code:
foreach AllAvatarInfos(AvatarInfo)
{
Canvas.SetPos(XPos, YPos);
YPos += 64.0f;
Canvas.SetDrawColor(255,255,255,255);
Canvas.DrawTile(AvatarInfo.avatarTexture, 64, 64, 0, 0, 64, 64);
}
Heres the delegate that receives the avatar texture from the Steamworks OnlineSubsystem:
Code:
simulated function OnReadOnlineAvatarComplete(const UniqueNetId PlayerNetId, Texture2D Avatar)
{
local int index;
for(index = 0; index < AllAvatarInfos.Length; index++)
{
if(AllAvatarInfos[index].netID.Uid.A == PlayerNetId.Uid.A && AllAvatarInfos[index].netID.Uid.B == PlayerNetId.Uid.B)
{
AllAvatarInfos[index].avatarTexture = new class'Texture2D' (Avatar);
AllAvatarInfos[index].avatarSource = "img://" $ AllAvatarInfos[index].avatarTexture.GetPackageName() $ "." $ AllAvatarInfos[index].avatarTexture.Name;
AllAvatarInfos[index].hasAvatar = true;
break;
}
}
currentAvatarUpdateIndex++;
bReadyForNextFriendUpdate = true;
}
Bookmarks