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); } }
protected override IEnumerator runTest() { while (dataEntityCollection.GetEntityByType <IncomingFriendInvitationData>().IsNull) { yield return(null); } string bobNewDisplayName = BaseFriendsIntegrationTest.CreateRandomName(); IUpdateDisplayNameResult updateDisplayNameResult = null; bobSession.LocalUser.UpdateDisplayName(bobNewDisplayName, delegate(IUpdateDisplayNameResult r) { updateDisplayNameResult = r; }); while (updateDisplayNameResult == null) { yield return(null); } IntegrationTestEx.FailIf(!updateDisplayNameResult.Success, "Failed to change Bob's display name to " + bobNewDisplayName); friendsService.AcceptFriendInvitation(aliceSession.LocalUser.IncomingFriendInvitations.First(), aliceSession.LocalUser); while (dataEntityCollection.GetEntityByType <FriendData>().IsNull) { yield return(null); } DataEntityHandle aliceFriendHandle = dataEntityCollection.GetEntityByType <FriendData>(); FriendData aliceFriendData = dataEntityCollection.GetComponent <FriendData>(aliceFriendHandle); DisplayNameData aliceDisplayNameData = dataEntityCollection.GetComponent <DisplayNameData>(aliceFriendHandle); IntegrationTestEx.FailIf(aliceFriendData.Friend.DisplayName.Text != bobNewDisplayName, $"The invitee friend data display name did not match changed display name 1. Actual: {aliceFriendData.Friend.DisplayName.Text}. Expected: {bobNewDisplayName}"); IntegrationTestEx.FailIf(aliceDisplayNameData.DisplayName != bobNewDisplayName, $"The invitee display name data display name did not match changed display name 1. Actual: {aliceDisplayNameData.DisplayName}. Expected: {bobNewDisplayName}"); }
private string getDisplayName(DataEntityHandle handle) { DisplayNameData component = Service.Get <CPDataEntityCollection>().GetComponent <DisplayNameData>(handle); if (component != null && !string.IsNullOrEmpty(component.DisplayName)) { return(component.DisplayName); } return(null); }
private static bool isLocalUser(DataEntityHandle handle, CPDataEntityCollection dataEntityCollection) { DisplayNameData component2 = default(DisplayNameData); if (dataEntityCollection.TryGetComponent(handle, out DisplayNameData component) && dataEntityCollection.TryGetComponent(dataEntityCollection.LocalPlayerHandle, out component2) && component.DisplayName == component2.DisplayName) { return(true); } return(false); }
public IEnumerator <TaskContract> Execute() { DBC.Check.Require(_displayName != null, "You forgot to inject the name"); var displayNameData = new DisplayNameData { DisplayName = _displayName, }; yield return(_webRequest.Execute(displayNameData).Continue()); response = ((JsonResponseHandler <VerifyDisplayNameResponse>)_webRequest.responseHandler).response; }
private DataEntityHandle addFriendStatusAndSwid(DataEntityHandle handle, IFriend friend) { if (!handle.IsNull) { FriendData friendData = dataEntityCollection.AddComponent <FriendData>(handle); friendData.Friend = friend; SwidData swidData = dataEntityCollection.AddComponent <SwidData>(handle); swidData.Swid = friend.Id; DisplayNameData component = dataEntityCollection.GetComponent <DisplayNameData>(handle); component.DisplayName = friend.DisplayName.Text; Service.Get <OtherPlayerDetailsRequestBatcher>().RequestOtherPlayerDetails(handle); } return(handle); }
public void SetData(PartyGameSessionMessages.TubeRacePlayerResult data, PartyGameDefinition partyGameDefinition) { skinForDefinition(partyGameDefinition); ScoreText.text = data.OverallScore.ToString(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle dataEntityHandle = cPDataEntityCollection.FindEntity <SessionIdData, long>(data.PlayerId); DisplayNameData component = default(DisplayNameData); if (!dataEntityHandle.IsNull && cPDataEntityCollection.TryGetComponent(dataEntityHandle, out component)) { NameText.text = component.DisplayName; } if (data.PlayerId == cPDataEntityCollection.LocalPlayerSessionId) { setLocalPlayerData(data); } }
private void onDisplayNameDataAdded(DisplayNameData displayNameData) { onDisplayNameChanged(displayNameData.DisplayName); displayNameData.OnDisplayNameChanged += onDisplayNameChanged; }