private void Start() { avatarRenderTextureComponent = GetComponent <AvatarRenderTextureComponent>(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; if (!localPlayerHandle.IsNull) { if (cPDataEntityCollection.TryGetComponent <DisplayNameData>(localPlayerHandle, out displayNameData)) { DisplayNameText.text = displayNameData.DisplayName; displayNameData.OnDisplayNameChanged += onDisplayNameChanged; } else { Log.LogError(this, "Local player handle did not have display name data"); } if (cPDataEntityCollection.TryGetComponent <AvatarDetailsData>(localPlayerHandle, out var component)) { avatarRenderTextureComponent.RenderAvatar(component); return; } avatarRenderTextureComponent.RenderAvatar(new DCustomEquipment[0]); Log.LogError(this, "Local player handle did not have avatar details data"); } else { Log.LogError(this, "Local player handle was null"); } }
public void Initialize(DataEntityHandle handle) { mapCategoriesStrings(); DataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>(); DisplayNameData component = dataEntityCollection.GetComponent <DisplayNameData>(handle); if (component != null && !string.IsNullOrEmpty(component.DisplayName)) { displayName = component.DisplayName; NameText.text = displayName; } else { Log.LogError(this, "Could not find display name data on this handle"); destroy(); } if (dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component2)) { AvatarRenderTextureComponent.RenderAvatar(component2); } else { Log.LogError(this, "AvatarDetailsData was not found"); } if (dataEntityCollection.TryGetComponent <ProfileData>(handle, out profileData)) { bool flag = profileData != null && profileData.HasPublicIgloo; reportIglooButton.ToggleButton(flag); } else { Log.LogError(this, "Could not find ProfileData for this handle."); reportIglooButton.ToggleButton(enabled: false); } }
public void SetUpPlayerCard(DataEntityHandle handle) { Handle = handle; if (this.OnHandleSet != null) { this.OnHandleSet.InvokeSafe(handle); } string displayName = dataEntityCollection.GetComponent <DisplayNameData>(handle).DisplayName; NameText.text = displayName; DetailsController.SetDisplayName(displayName); ActionListController.SetName(displayName); PassportCodeController.SetDisplayNameText(displayName); MembershipSpriteSelector.gameObject.SetActive(value: false); OnlineSpriteSelector.gameObject.SetActive(value: false); StatusText.gameObject.SetActive(value: false); FriendStatus = updateFriendStatus(); PassportCodeController.gameObject.SetActive(value: false); LocalXpPanel.SetActive(value: true); if (FriendStatus == FriendStatus.Self) { if (dataEntityCollection.TryGetComponent <PresenceData>(handle, out presenceData)) { setUpPresenceData(presenceData); } else { Log.LogError(this, "Couldn't find presence data on the local player"); } if (dataEntityCollection.TryGetComponent <ProfileData>(handle, out profileData)) { setUpProfileData(profileData); } else { Log.LogError(this, "Couldn't find profile data on the local player"); } if (dataEntityCollection.TryGetComponent <MembershipData>(handle, out membershipData)) { setUpMembershipData(membershipData); } else { Log.LogError(this, "Couldn't find membership data on the local player"); } coinsData = dataEntityCollection.GetComponent <CoinsData>(handle); setCoins(coinsData.Coins); coinsData.OnCoinsChanged += setCoins; } else { if (dataEntityCollection.TryGetComponent <PresenceData>(handle, out presenceData)) { presenceData.PresenceDataUpdated += onPresenceDataUpdated; setUpPresenceData(presenceData); } else { dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <PresenceData> >(onPresenceDataAdded); } if (dataEntityCollection.TryGetComponent <ProfileData>(handle, out profileData)) { profileData.ProfileDataUpdated += onProfileDataUpdated; setUpProfileData(profileData); } else { dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ProfileData> >(onProfileDataAdded); } if (dataEntityCollection.TryGetComponent <MembershipData>(handle, out membershipData)) { membershipData.MembershipDataUpdated += onMembershipDataUpdated; setUpMembershipData(membershipData); } else { dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <MembershipData> >(onMembershipDataAdded); } if (dataEntityCollection.TryGetComponent <SwidData>(handle, out var component)) { Service.Get <INetworkServicesManager>().PlayerStateService.GetOtherPlayerDataBySwid(component.Swid); } else { Service.Get <INetworkServicesManager>().PlayerStateService.GetOtherPlayerDataByDisplayName(displayName); } } if (dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component2)) { AvatarRenderTextureComponent.RenderAvatar(component2); } else { dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> >(onAvatarDetailsDataAdded); } }