public static async Task <LobbyPlayerUI> SetAvatar(this LobbyPlayerUI player, Friend member)
        {
            var avatar = await member.GetSmallAvatarAsync();

            if (avatar.HasValue)
            {
                var image   = avatar.Value;
                var texture = new Texture2D((int)image.Width, (int)image.Height);

                for (int x = 0; x < image.Width; x++)
                {
                    for (int y = 0; y < image.Height; y++)
                    {
                        var pixel = image.GetPixel(x, y);

                        texture.SetPixel(
                            x,
                            (int)image.Height - y,
                            new UnityEngine.Color(pixel.r / 255.0f, pixel.g / 255.0f, pixel.b / 255.0f, pixel.a / 255.0f));
                    }
                }
                texture.Apply();
                player.Avatar.texture = texture;
            }
            return(player);
        }
Exemple #2
0
    public GameObject AddLobbyPlayerUI(string pName)
    {
        GameObject go = Instantiate(lobbyPlayerUIPrefab) as GameObject;

        go.transform.SetParent(lobbyPlayersGrid);
        go.transform.localScale = Vector3.one;

        LobbyPlayerUI lpUI = go.GetComponent <LobbyPlayerUI>();

        lpUI.Init(pName);
        lobbyPlayersIU.Add(go);

        return(go);
    }
Exemple #3
0
 void Awake()
 {
     // Assign variable
     lobbyPlayerUI = GetComponent <LobbyPlayerUI>();
 }
 public static LobbyPlayerUI SetMage(this LobbyPlayerUI player, string mageName)
 {
     player.MageNameText.text = mageName;
     return(player);
 }
 public static LobbyPlayerUI SetReady(this LobbyPlayerUI player, string ready)
 {
     player.ReadyText.text = ready;
     return(player);
 }
 public static LobbyPlayerUI SetLevel(this LobbyPlayerUI player, string level)
 {
     player.LevelText.text = level;
     return(player);
 }
 public static LobbyPlayerUI SetName(this LobbyPlayerUI player, string name)
 {
     player.PlayerNameText.text = name;
     return(player);
 }