Example #1
0
 // Token: 0x06005775 RID: 22389 RVA: 0x001E1E20 File Offset: 0x001E0220
 public void SwitchToFallbackAvatar(float scale = 1f, VRCAvatarManager.AvatarCreationCallback onAvatarLoaded = null)
 {
     ApiAvatar.Fetch(this.fallbackAvatarId, delegate(ApiAvatar avatar)
     {
         this.SwitchAvatar(avatar, scale, onAvatarLoaded);
     }, delegate(string message)
     {
         this.SwitchToErrorAvatar(1f);
     });
 }
Example #2
0
 // Token: 0x0600577F RID: 22399 RVA: 0x001E2DEC File Offset: 0x001E11EC
 private void DownloadCustomAvatar(ApiAvatar apiAvatar, float scale, VRCAvatarManager.AvatarCreationCallback onAvatarLoaded)
 {
     this.showProgressBar();
     this.currentScale = scale;
     Downloader.DownloadAssetBundle(apiAvatar, new OnDownloadProgressDelegate(this.OnDownloadProgress), delegate(string assetUrl, AssetBundleDownload download)
     {
         this.LoadAvatarFromAssetBundle(assetUrl, download.asset);
         this.lastAvatar = apiAvatar;
         try
         {
             this.currentAvatarKind = VRCAvatarManager.AvatarKind.Custom;
             if (onAvatarLoaded != null)
             {
                 if (this.currentAvatar != null)
                 {
                     onAvatarLoaded(this.currentAvatar, this.currentAvatar.GetComponent <VRC_AvatarDescriptor>(), true);
                 }
                 else
                 {
                     onAvatarLoaded(null, null, false);
                 }
             }
         }
         catch (Exception exception)
         {
             Debug.LogException(exception);
         }
         this._atLeastOneAvatarWasLoaded = true;
     }, delegate(string url, string message, LoadErrorReason reason)
     {
         try
         {
             this.currentAvatarKind = VRCAvatarManager.AvatarKind.Custom;
             if (onAvatarLoaded != null)
             {
                 if (this.currentAvatar != null)
                 {
                     onAvatarLoaded(this.currentAvatar, this.currentAvatar.GetComponent <VRC_AvatarDescriptor>(), false);
                 }
                 else
                 {
                     onAvatarLoaded(null, null, false);
                 }
             }
         }
         catch (Exception exception)
         {
             Debug.LogException(exception);
         }
         this.OnDownloadError(url, message, reason);
     }, AssetBundleDownloadManager.UnpackType.Async);
 }
Example #3
0
 // Token: 0x0600576E RID: 22382 RVA: 0x001E1B98 File Offset: 0x001DFF98
 public bool SwitchAvatar(ApiAvatar apiAvatar, float scale = 1f, VRCAvatarManager.AvatarCreationCallback onAvatarLoaded = null)
 {
     if (apiAvatar == null)
     {
         return(false);
     }
     VRC.Core.Logger.Log("Switching avatar to " + apiAvatar.assetUrl, DebugLevel.All);
     this.hideProgressBar();
     try
     {
         if (!this._atLeastOneAvatarWasLoaded || VRC.Network.IsOwner(base.gameObject))
         {
             this.SwitchToLoadingAvatar(scale);
         }
     }
     catch (Exception exception)
     {
         Debug.LogException(exception);
     }
     this.DownloadCustomAvatar(apiAvatar, scale, onAvatarLoaded);
     this._fromPrefab = false;
     return(true);
 }