GameObject InsertFriend(SteamFriend friend) { GameObject go = Instantiate(friendPrefab); go.transform.SetParent(container.transform, false); Facepunch.Steamworks.Image image = friend.GetAvatar(Friends.AvatarSize.Small); var texture = Utils.ConvertSteamImage(image); var rawImage = go.GetComponentInChildren <RawImage>(); if (rawImage != null) { rawImage.texture = texture; } go.GetComponentInChildren <Text>().text = friend.Name; go.name = "Friend_" + friend.Name; go.GetComponentInChildren <Button>().onClick.AddListener(delegate { InviteFriend(friend.Id); }); return(go); }
void UpdateParty() { Debug.Log("Update Party!"); if (!Client.Instance.Lobby.IsValid) { Debug.Log("derp!?"); Client.Instance.Lobby.Create(Lobby.Type.Invisible, maxPartySize); return; } else { Debug.Log("Herp!?"); ulong[] memberIds = Client.Instance.Lobby.GetMemberIDs(); foreach (ulong memberId in memberIds) { SteamFriend friend = Client.Instance.Friends.Get(memberId); GameObject go = Instantiate(partyPlayerPrefab); go.transform.SetParent(container.transform, false); go.transform.SetSiblingIndex(go.transform.GetSiblingIndex() - 1); go.GetComponent <RawImage>().texture = Utils.ConvertSteamImage(friend.GetAvatar(Friends.AvatarSize.Small)); } } }