Ejemplo n.º 1
0
 private void onAvatarDataAdded(AvatarDetailsData avatarData)
 {
     onPlayerOutfitChanged(avatarData.Outfit);
     onPlayerColorChanged(avatarData.BodyColor);
     avatarData.PlayerOutfitChanged += onPlayerOutfitChanged;
     avatarData.PlayerColorChanged  += onPlayerColorChanged;
 }
 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 var value) && value != null)
         {
             if (ColorUtility.TryParseHtmlString("#" + value.Color, out var 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 FullScreenChatBlockData(long sessionId, string displayName, string message, AvatarDetailsData avatarDetailsData, bool isChatActivity = false, bool isAwatingModeration = false, bool isChatBlocked = false)
 {
     SessionId           = sessionId;
     DisplayName         = displayName;
     Message             = message;
     AvatarDetailsData   = avatarDetailsData;
     IsChatActivity      = isChatActivity;
     IsAwatingModeration = isAwatingModeration;
     IsChatBlocked       = isChatBlocked;
 }
Ejemplo n.º 4
0
 private bool onAvatarDetailsAdded(DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> evt)
 {
     if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle) && evt.Handle == handle)
     {
         dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> >(onAvatarDetailsAdded);
         avatarDetailsData = evt.Component;
         processAvatarDetails(handle);
     }
     return(false);
 }
Ejemplo n.º 5
0
 public AvatarDetailsHashable(AvatarDetailsData avatarDetails, string displayName, string context = "")
 {
     BodyColor    = avatarDetails.BodyColor;
     DisplayName  = displayName;
     Context      = context;
     EquipmentIds = new long[avatarDetails.Outfit.Length];
     for (int i = 0; i < EquipmentIds.Length; i++)
     {
         EquipmentIds[i] = avatarDetails.Outfit[i].Id;
     }
 }
Ejemplo n.º 6
0
        private void setupAvatarWithCurrentOutfit()
        {
            DataEntityHandle localPlayerHandle = Service.Get <CPDataEntityCollection>().LocalPlayerHandle;

            if (!localPlayerHandle.IsNull)
            {
                AvatarDetailsData component = Service.Get <CPDataEntityCollection>().GetComponent <AvatarDetailsData>(localPlayerHandle);
                if (component != null)
                {
                    Model.BodyColor = component.BodyColor;
                    DCustomOutfit outfit = default(DCustomOutfit);
                    outfit.Equipment = component.Outfit;
                    Model.ClearAllEquipment();
                    Model.ApplyOutfit(outfit);
                }
                else
                {
                    Log.LogError(this, "Unable to find AvatarDetailsData on local player handle. Body color and initial outfit not set.");
                    Model.ClearAllEquipment();
                }
            }
        }