Ejemplo n.º 1
0
    /// <summary>
    /// Gets the default avatar for the given user. Will check the cache first, and if none are available it will then download the default from discord.
    /// <para>An alias of <see cref="DiscordUser.CacheDefaultAvatarCoroutine(DiscordAvatarSize, DiscordUser.AvatarDownloadCallback)"/> and will return the new <see cref="DiscordUser"/> instance in the callback.</para>
    /// </summary>
    /// <param name="size">The size of the target avatar</param>
    /// <param name="callback">The callback that will be made when the picture finishes downloading.</param>
    /// <returns></returns>
    public static IEnumerator GetDefaultAvatarCoroutine(this DiscordRPC.User user, DiscordAvatarSize size = DiscordAvatarSize.x128, DiscordUser.AvatarDownloadCallback callback = null)
    {
        var du = new DiscordUser(user);

        return(du.GetDefaultAvatarCoroutine(size, callback));
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Gets the user avatar as a Texture2D and starts it with the supplied monobehaviour. It will first check the cache if the image exists, if it does it will return the image. Otherwise it will download the image from Discord and store it in the cache, calling the callback once done.
    /// <para>An alias of <see cref="DiscordUser.CacheAvatar(MonoBehaviour, DiscordAvatarSize, AvatarDownloadCallback)"/> and will return the new <see cref="DiscordUser"/> instance.</para>
    /// </summary>
    /// <param name="coroutineCaller">The target object that will start the coroutine</param>
    /// <param name="size">The target size of the avatar. Default is 128x128</param>
    /// <param name="callback">The callback for when the texture completes. Default is no-callback, but its highly recommended to use a callback</param>
    /// <returns>Returns the generated <see cref="DiscordUser"/> for this <see cref="DiscordRPC.User"/> object.</returns>
    public static DiscordUser GetAvatar(this DiscordRPC.User user, MonoBehaviour coroutineCaller, DiscordAvatarSize size = DiscordAvatarSize.x128, DiscordUser.AvatarDownloadCallback callback = null)
    {
        var du = new DiscordUser(user);

        du.GetAvatar(coroutineCaller, size, callback);
        return(du);
    }