public RenderRequest(DataEntityHandle handle) { Handle = handle; AvatarDetailsData = null; Context = null; AvatarAnimationFrame = null; }
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); } }
private void onAvatarDataAdded(AvatarDetailsData avatarData) { onPlayerOutfitChanged(avatarData.Outfit); onPlayerColorChanged(avatarData.BodyColor); avatarData.PlayerOutfitChanged += onPlayerOutfitChanged; avatarData.PlayerColorChanged += onPlayerColorChanged; }
private bool onAvatarDetailsAdded(DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> evt) { if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out DataEntityHandle handle) && evt.Handle == handle) { dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> >(onAvatarDetailsAdded); avatarDetailsData = evt.Component; processAvatarDetails(handle); } return(false); }
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; } }
private void getLocalPlayerData() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; avatarDetailsData = cPDataEntityCollection.GetComponent <AvatarDetailsData>(localPlayerHandle); if (avatarDetailsData == null) { Log.LogError(this, "Local player handle did not have avatar details data."); } }
private void onAvatarDetailsInitialized(AvatarDetailsData avatarDetailsData) { avatarDetailsData.OnInitialized -= onAvatarDetailsInitialized; DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(avatarDetailsData); string displayName = dataEntityCollection.GetComponent <DisplayNameData>(entityByComponent).DisplayName; if (pendingRenderRequests.ContainsKey(displayName)) { RenderRequest renderRequest = pendingRenderRequests[displayName]; renderRequest.AvatarDetailsData = avatarDetailsData; getImage(displayName, renderRequest); } }
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); }
private void Start() { Content.LoadAsync(onColorSwatchLoaded, colorSwatchContentKey); DataEntityHandle localPlayerHandle = Service.Get <CPDataEntityCollection>().LocalPlayerHandle; if (!localPlayerHandle.IsNull) { avatarDetailsData = Service.Get <CPDataEntityCollection>().GetComponent <AvatarDetailsData>(localPlayerHandle); if (avatarDetailsData != null) { initialColor = avatarDetailsData.BodyColor; } } avatarColors = new Dictionary <int, AvatarColorDefinition>(); }
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); }
private void OnDisable() { AvatarDetailsData component = default(AvatarDetailsData); if (model != null && !model.LocalPlayerInfo.IsNull && Service.Get <CPDataEntityCollection>().TryGetComponent(model.LocalPlayerInfo, out component)) { DCustomEquipment[] currentAvatarEquipment = model.GetCurrentAvatarEquipment(); if (component.Outfit != currentAvatarEquipment) { new SaveOutfitToWearCMD(model.InventoryData.CurrentAvatarEquipment.ToArray(), currentAvatarEquipment).Execute(); } } if (IsInitialized) { mainEventChannel.RemoveAllListeners(); } }
private void Awake() { eventChannel = new EventChannel(Service.Get <EventDispatcher>()); eventChannel.AddListener <CatalogServiceProxyEvents.StatsReponse>(onStatsResponse); eventChannel.AddListener <CatalogServiceEvents.UserStatsErrorEvent>(onUserStatsErrorEvent); catalogEventChannel = new EventChannel(CatalogContext.EventBus); catalogEventChannel.AddListener <CatalogUIEvents.ShowStatsPage>(onShowStatsPage); catalogEventChannel.AddListener <CatalogUIEvents.HideCatalog>(onHideCatalog); catalogEventChannel.AddListener <CatalogUIEvents.BackButtonClicked>(onBackButtonClicked); if (!Service.Get <CPDataEntityCollection>().LocalPlayerHandle.IsNull&& Service.Get <CPDataEntityCollection>().TryGetComponent <AvatarDetailsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle, out var component)) { avatarDetailsData = component; } else { Log.LogError(this, "Unable to get local player avatar details data."); } }
private void Start() { Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "05", "display_name"); createController = GetComponentInParent <AbstractCreateController>(); createController.OnUpdateDisplayNameError += OnUpdateDisplayNameError; referAFriendEnabled = true; if (Service.Get <SessionManager>().LocalUser != null && (Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayNameProposedStatus == DisplayNameProposedStatus.Rejected || (Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayNameProposedStatus == DisplayNameProposedStatus.Pending && Service.Get <SessionManager>().LocalUser.RegistrationProfile.ProposedDisplayName.StartsWith("DNAME-REJ-")))) { Instructions.text = Service.Get <Localizer>().GetTokenTranslation("Account.DisplayName.DisplayNameRejected"); referAFriendEnabled = false; } if (ReferAFriendSection != null) { ReferAFriendSection.SetActive(referAFriendEnabled); } else { referAFriendEnabled = false; } setDisplayNameValid = false; AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); SessionManager sessionManager = Service.Get <SessionManager>(); if (!string.IsNullOrEmpty(sessionManager.LocalUser.RegistrationProfile.Username) && accountFlowData.PreValidatedDisplayNames.Contains(sessionManager.LocalUser.RegistrationProfile.Username)) { DisplayNameInputField.TextInput.text = sessionManager.LocalUser.RegistrationProfile.Username; DisplayNameInputField.HasError = false; DisplayNameInputField.IsValidationComplete = true; setDisplayNameValid = true; } AvatarRenderTextureComponent componentInChildren = GetComponentInChildren <AvatarRenderTextureComponent>(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; AvatarDetailsData component = default(AvatarDetailsData); if (!localPlayerHandle.IsNull && cPDataEntityCollection.TryGetComponent(localPlayerHandle, out component)) { componentInChildren.RenderAvatar(component); } else { componentInChildren.RenderAvatar(new DCustomEquipment[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(); } } }
public override void OnEnter() { Color color = Color.black; bool flag = false; bool flag2 = false; DataEntityHandle localPlayerHandle = Service.Get <CPDataEntityCollection>().LocalPlayerHandle; if (!localPlayerHandle.IsNull) { AvatarDetailsData component = Service.Get <CPDataEntityCollection>().GetComponent <AvatarDetailsData>(localPlayerHandle); if (component != null) { color = component.BodyColor; flag = true; } } if (flag && ColorsToCheck != null) { for (int i = 0; i < ColorsToCheck.Length; i++) { if (ColorUtility.TryParseHtmlString("#" + ColorsToCheck[i].Color, out var color2) && color == color2) { flag2 = true; break; } } } if (flag2) { base.Fsm.Event(MatchEvent); } else { base.Fsm.Event(FailEvent); } }
private void getAvatarDetailsData() { avatarDetailsData = Service.Get <CPDataEntityCollection>().GetComponent <AvatarDetailsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle); }
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); }
public void RenderAvatar(AvatarDetailsData avatarDetails, AvatarAnimationFrame avatarFrame = null) { RenderAvatar(avatarDetails.Outfit, avatarDetails.BodyColor, avatarFrame); }
private void onAvatarDetailsDataInitialized(AvatarDetailsData avatarDetailsData) { avatarDetailsData.OnInitialized -= onAvatarDetailsDataInitialized; AvatarRenderTextureComponent.RenderAvatar(avatarDetailsData); }
public override void OnEnter() { avatarDetailsData = Service.Get <CPDataEntityCollection>().GetComponent <AvatarDetailsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle); avatarDetailsData.PlayerColorChanged += onColorChanged; }