private void setUpAvatarDetails(AvatarDetailsData avatarDetailsData, OtherPlayerData data)
 {
     DCustomEquipment[] outfit = (data.outfit == null) ? new DCustomEquipment[0] : CustomEquipmentResponseAdaptor.ConvertResponseToOutfit(data.outfit);
     if (data.profile != null)
     {
         Dictionary <int, AvatarColorDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, AvatarColorDefinition> >();
         if (dictionary.TryGetValue(data.profile.colour, out AvatarColorDefinition value) && value != null)
         {
             if (ColorUtility.TryParseHtmlString("#" + value.Color, out Color color))
             {
                 avatarDetailsData.Init(outfit, color);
                 return;
             }
             Log.LogErrorFormatted(this, "Could not parse a color from color string {0}", value.Color);
             avatarDetailsData.Init(outfit);
         }
         else
         {
             Log.LogErrorFormatted(this, "Avatar color definitions did not contain a value for color id {0}", data.profile.colour);
             avatarDetailsData.Init(outfit);
         }
     }
     else
     {
         avatarDetailsData.Init(outfit);
     }
 }
        public void EquipSubmittedItem()
        {
            AvatarDetailsData avatarDetailsData = new AvatarDetailsData();

            DCustomEquipment[] outfit = ((submittedItem.Parts.Length != 0) ? new DCustomEquipment[1] {
                submittedItem
            } : new DCustomEquipment[0]);
            avatarDetailsData.Init(outfit);
            if (!Service.Get <CPDataEntityCollection>().LocalPlayerHandle.IsNull&& Service.Get <CPDataEntityCollection>().TryGetComponent <AvatarDetailsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle, out var component))
            {
                avatarDetailsData.BodyColor = component.BodyColor;
            }
            AvatarRenderTextureComponent.RenderAvatar(avatarDetailsData);
        }
        protected void SetEquipment()
        {
            DCustomEquipment  dCustomEquipment  = CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(ItemData.equipment);
            AvatarDetailsData avatarDetailsData = new AvatarDetailsData();

            DCustomEquipment[] outfit = ((dCustomEquipment.Parts.Length != 0) ? new DCustomEquipment[1] {
                dCustomEquipment
            } : new DCustomEquipment[0]);
            avatarDetailsData.Init(outfit);
            if (!Service.Get <CPDataEntityCollection>().LocalPlayerHandle.IsNull&& Service.Get <CPDataEntityCollection>().TryGetComponent <AvatarDetailsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle, out var component))
            {
                avatarDetailsData.BodyColor = component.BodyColor;
            }
            AvatarRenderTextureComponent.RenderAvatar(avatarDetailsData);
        }
示例#4
0
 private bool onStatsResponse(CatalogServiceProxyEvents.StatsReponse evt)
 {
     if (isStatsLoading)
     {
         isStatsLoading = false;
         if (Model.State == CatalogState.StatsView)
         {
             shopScroller.ClearScroller();
             stats = evt.Stats;
             if (TotalSold != null)
             {
                 TotalSold.text = stats.TotalItemsSold.ToString();
             }
             if (BestSellerSold != null)
             {
                 try
                 {
                     BestSellerSold.text = stats.StatsItem.numberSold.ToString();
                     if (stats.TotalItemsSold < stats.StatsItem.numberSold)
                     {
                         BestSellerSold.text = stats.TotalItemsSold.ToString();
                     }
                 }
                 catch (Exception ex)
                 {
                     Log.LogErrorFormatted(this, "An error occured when setting best seller sold text. Message: {0}", ex.Message);
                 }
             }
             if (TotalSubmitted != null)
             {
                 TotalSubmitted.text = stats.TotalItemsPurchased.ToString();
             }
             if (stats.StatsData != null)
             {
                 DCustomEquipment[] outfit;
                 if (stats.StatsItem.equipment.parts == null || stats.StatsItem.equipment.parts.Length == 0)
                 {
                     outfit = new DCustomEquipment[0];
                 }
                 else
                 {
                     DCustomEquipment dCustomEquipment = CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(stats.StatsItem.equipment);
                     outfit = new DCustomEquipment[1] {
                         dCustomEquipment
                     };
                 }
                 AvatarDetailsData avatarDetailsData = new AvatarDetailsData();
                 avatarDetailsData.Init(outfit);
                 if (this.avatarDetailsData != null)
                 {
                     avatarDetailsData.BodyColor = this.avatarDetailsData.BodyColor;
                 }
                 AvatarRenderTextureComponent.RenderAvatar(avatarDetailsData);
                 shopScroller.items         = stats.StatsData;
                 shopScroller.filteredItems = stats.StatsData;
                 shopScroller.GenerateScrollData(stats.StatsData);
                 for (int i = 0; i < shopScroller.numShopRows; i++)
                 {
                     shopScroller.Scroller.AddElement(1);
                 }
                 shopScroller.isShopScrollInitialized = true;
                 shopScroller.lastNumShopRows         = shopScroller.numShopRows;
             }
         }
     }
     return(false);
 }