private void onPlayerMoved(PositionData positionData, Vector3 newPosition) { if (positionData == null) { return; } positionData.PlayerMoved -= onPlayerMoved; if (base.gameObject.IsDestroyed()) { return; } DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(positionData); if (DataEntityHandle.IsNullValue(entityByComponent)) { return; } GameObjectReferenceData component = dataEntityCollection.GetComponent <GameObjectReferenceData>(entityByComponent); if (component != null) { GameObject gameObject = component.GameObject; if (!gameObject.IsDestroyed()) { placeRemotePlayer(gameObject, entityByComponent, newPosition); } } }
public bool IsLocalPlayerMember() { if (!DataEntityHandle.IsNullValue(LocalPlayerHandle) && TryGetComponent <MembershipData>(LocalPlayerHandle, out var component)) { return(component.IsMember); } return(false); }
private void onIglooListingDataUpdated(IglooListingData iglooListingData) { DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(iglooListingData); if (!DataEntityHandle.IsNullValue(entityByComponent) && !allPlayersList.Contains(entityByComponent)) { allPlayersList.Add(entityByComponent); } }
private void onItemRemoved(long sessionId) { DataEntityHandle handle = ((!dataEntityCollection.IsLocalPlayer(sessionId)) ? dataEntityCollection.FindEntity <SessionIdData, long>(sessionId) : dataEntityCollection.LocalPlayerHandle); if (!DataEntityHandle.IsNullValue(handle)) { dataEntityCollection.GetComponent <HeldObjectsData>(handle).HeldObject = null; } }
private bool onIglooListingDataAdded(DataEntityEvents.ComponentAddedEvent <IglooListingData> evt) { evt.Component.IglooListingDataUpdated += onIglooListingDataUpdated; DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(evt.Component); if (!DataEntityHandle.IsNullValue(entityByComponent) && !allPlayersList.Contains(entityByComponent)) { allPlayersList.Add(entityByComponent); } return(false); }
public void OnDestroy() { HeldObjectsData component; if (DataEntityHandle.IsNullValue(localPlayerHandle)) { if (eventDispatcher != null) { eventDispatcher.RemoveListener <NetworkControllerEvents.LocalPlayerJoinedRoomEvent>(onLocalPlayerAdded); } } else if (dataEntityCollection.TryGetComponent <HeldObjectsData>(localPlayerHandle, out component) && component != null) { component.PlayerHeldObjectChanged -= onHeldObjectChanged; } }
private bool onPlayerMembershipStatusChanged(PlayerStateServiceEvents.PlayerMembershipStatusChanged evt) { if (!DataEntityHandle.IsNullValue(dataEntityCollection.LocalPlayerHandle)) { if (dataEntityCollection.TryGetComponent <MembershipData>(dataEntityCollection.LocalPlayerHandle, out var component)) { component.IsMember = evt.IsMember; component.MembershipType = (evt.IsMember ? MembershipType.Member : MembershipType.None); if (!component.IsMember && Service.Get <AllAccessService>().IsAllAccessActive()) { component.IsMember = true; component.MembershipType = MembershipType.AllAccessEventMember; } } else { Log.LogError(this, "No membership data found on local player"); } } return(false); }
public void OnStateChanged(string state) { if (!base.gameObject.IsDestroyed() && state == HandledState && rootStateMachine != null) { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection == null || DataEntityHandle.IsNullValue(cPDataEntityCollection.LocalPlayerHandle)) { Log.LogError(this, "Unable to resolve data entity collection"); } if (cPDataEntityCollection.TryGetComponent <ProfileData>(cPDataEntityCollection.LocalPlayerHandle, out var component)) { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); string text = ((component.PenguinAgeInDays >= 1 || accountFlowData.SkipWelcome || !component.IsFirstTimePlayer) ? SkipWelcomeEvent : ShowWelcomeEvent); Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "23", "check_showwelcome", text); rootStateMachine.SendEvent(text); } else { Log.LogError(this, "No profile data found for local player"); } } }
private void addOtherPlayerDetails(OtherPlayerData data) { DataEntityHandle handle; if (data.id.type == PlayerId.PlayerIdType.SWID) { handle = dataEntityCollection.FindEntity <SwidData, string>(data.id.id); if (DataEntityHandle.IsNullValue(handle)) { handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, data.name); } } else { handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, data.name); } if (!dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component)) { component = dataEntityCollection.AddComponent <AvatarDetailsData>(handle); } if (!dataEntityCollection.TryGetComponent <ProfileData>(handle, out var component2)) { component2 = dataEntityCollection.AddComponent <ProfileData>(handle); } if (!dataEntityCollection.TryGetComponent <MembershipData>(handle, out var component3)) { component3 = dataEntityCollection.AddComponent <MembershipData>(handle); } if (!dataEntityCollection.TryGetComponent <PresenceData>(handle, out var component4)) { component4 = dataEntityCollection.AddComponent <PresenceData>(handle); } setUpAvatarDetails(component, data); setUpProfile(component2, component4, component3, data); component4.IsDisconnecting = false; }