private bool createRemotePlayer(DataEntityHandle remotePlayerHandle, bool attemptSpawn = true) { if (!dataEntityCollection.HasComponent <GameObjectReferenceData>(remotePlayerHandle)) { dataEntityCollection.AddComponent <GameObjectReferenceData>(remotePlayerHandle); } if (!dataEntityCollection.HasComponent <AirBubbleData>(remotePlayerHandle)) { dataEntityCollection.AddComponent <AirBubbleData>(remotePlayerHandle); } PositionData component = dataEntityCollection.GetComponent <PositionData>(remotePlayerHandle); RemotePlayerData component2 = dataEntityCollection.GetComponent <RemotePlayerData>(remotePlayerHandle); component2.PlayerRemoved += onPlayerRemoved; playerRemovedListeners.Add(component2); PresenceData component3 = dataEntityCollection.GetComponent <PresenceData>(remotePlayerHandle); if (component3 != null) { component3.PresenceDataUpdated += onPresenceDataUpdated; } if (!dataEntityCollection.HasComponent <LODRequestReference>(remotePlayerHandle)) { LODRequestData requestData = new LODRequestData(LODSystem.REMOTE_PLAYER, remotePlayerHandle, component); requestData.OnGameObjectGeneratedEvent += onLODGameObjectGenerated; requestData.OnGameObjectRevokedEvent += onLODGameObjectRevoked; LODRequest request = Service.Get <LODService>().Request(requestData, attemptSpawn); dataEntityCollection.AddComponent <LODRequestReference>(remotePlayerHandle).Request = request; } return(false); }
public static FriendStatus GetFriendStatus(DataEntityHandle handle) { if (handle.IsNull) { return(FriendStatus.None); } CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (isLocalUser(handle, cPDataEntityCollection)) { return(FriendStatus.Self); } if (cPDataEntityCollection.HasComponent <FriendData>(handle)) { return(FriendStatus.Friend); } if (cPDataEntityCollection.HasComponent <IncomingFriendInvitationData>(handle)) { return(FriendStatus.IncomingInvite); } if (cPDataEntityCollection.HasComponent <OutgoingFriendInvitationData>(handle)) { return(FriendStatus.OutgoingInvite); } return(FriendStatus.None); }
public void Start() { if (FullAnimPathNames.Length > 0) { animHashes = new int[FullAnimPathNames.Length]; for (int i = 0; i < animHashes.Length; i++) { animHashes[i] = Animator.StringToHash(FullAnimPathNames[i]); } } else { base.enabled = false; } eventDispatcher = Service.Get <EventDispatcher>(); dataEntityCollection = Service.Get <CPDataEntityCollection>(); localPlayerHandle = dataEntityCollection.LocalPlayerHandle; if (localPlayerHandle.IsNull || !dataEntityCollection.HasComponent <PresenceData>(localPlayerHandle)) { eventDispatcher.AddListener <NetworkControllerEvents.LocalPlayerJoinedRoomEvent>(onLocalPlayerAdded); } else { anim = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <Animator>(); } Change(onoff: false); }
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); if (!dataEntityCollection.HasComponent <DecorationInventoryData>(dataEntityCollection.LocalPlayerHandle)) { Service.Get <INetworkServicesManager>().IglooService.GetDecorations(); } Object.Destroy(this); }
public void Execute() { if (playerCardDataData.Enabled && !playerCardDataData.IsPlayerCardShowing && dataEntityCollection.HasComponent <DisplayNameData>(handle)) { playerCardDataData.IsPlayerCardShowing = true; modalBackground = new GameObject("ModalBackground", typeof(ModalBackground)); Content.LoadAsync(onPlayerCardLoaded, PlayerCardContentKey); } }
public SceneLayoutData AddNewActiveLayout() { DataEntityHandle activeHandle = GetActiveHandle(); if (dataEntityCollection.HasComponent <SceneLayoutData>(activeHandle)) { return(null); } return(dataEntityCollection.AddComponent <SceneLayoutData>(activeHandle)); }
public void Start() { eventDispatcher = Service.Get <EventDispatcher>(); dataEntityCollection = Service.Get <CPDataEntityCollection>(); localPlayerHandle = dataEntityCollection.LocalPlayerHandle; if (!localPlayerHandle.IsNull && dataEntityCollection.HasComponent <PresenceData>(localPlayerHandle)) { dataEntityCollection.GetComponent <HeldObjectsData>(localPlayerHandle).PlayerHeldObjectChanged += onHeldObjectChanged; } else { eventDispatcher.AddListener <NetworkControllerEvents.LocalPlayerJoinedRoomEvent>(onLocalPlayerAdded); } }
public override void Start() { base.Start(); if (dataEntityCollection.HasComponent <CollectiblesData>(dataEntityCollection.LocalPlayerHandle)) { initializeCollectibleData(); } else { dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <CollectiblesData> >(onCollectiblesReady); isListenerActive = true; } SceneRefs.CollectibleController.RegisterCollectible(this); }
private void Start() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); playerDataHandle = GetComponent <AvatarDataHandle>(); eventDispatcher = Service.Get <EventDispatcher>(); if (!playerDataHandle.Handle.IsNull && dataEntityCollection.HasComponent <LocalPlayerInZoneData>(playerDataHandle.Handle)) { spawnLocalPlayerInZone(); } else { eventDispatcher.AddListener <PlayerSpawnedEvents.LocalPlayerReadyToSpawn>(onLocalPlayerReadyToSpawn, EventDispatcher.Priority.FIRST); } eventDispatcher.AddListener <SceneTransitionEvents.TransitionComplete>(onSceneTransitionComplete); }
public void Awake() { dispatcher = Service.Get <EventDispatcher>(); isPlayerSpawned = false; activationDelay = activationDelayTime; CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; if (!localPlayerHandle.IsNull && cPDataEntityCollection.HasComponent <PresenceData>(localPlayerHandle)) { isPlayerSpawned = true; } else { dispatcher.AddListener <PlayerSpawnedEvents.LocalPlayerSpawned>(onLocalPlayerSpawned); } }
public void Start() { eventDispatcher = Service.Get <EventDispatcher>(); eventChannel = new EventChannel(eventDispatcher); state = CoinHudState.closed; coinAnimator = GetComponent <Animator>(); remainingCoins = 0; base.gameObject.SetActive(value: false); dataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = dataEntityCollection.LocalPlayerHandle; if (!localPlayerHandle.IsNull && dataEntityCollection.HasComponent <PresenceData>(localPlayerHandle)) { setUpCoinCount(localPlayerHandle); } else { eventDispatcher.AddListener <PlayerSpawnedEvents.LocalPlayerSpawned>(onLocalPlayerAdded); } eventDispatcher.AddListener <HudEvents.SuppressCoinDisplay>(onSuppressCoinDisplay); eventDispatcher.AddListener <HudEvents.UnsuppressCoinDisplay>(onUnsuppressCoinDisplay); }
private void Start() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); avatarView = GetComponent <AvatarView>(); if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out DataEntityHandle handle)) { if (dataEntityCollection.HasComponent <RemotePlayerData>(handle)) { if (dataEntityCollection.TryGetComponent(handle, out locomotionData)) { addListeners(); } else { Log.LogError(this, "Entity missing a LocomotionData component, locomotion state listeners not added"); } } } else { dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <LocomotionData> >(onLocomotionDataAdded); } }
private bool onLocalPlayerDataReceived(PlayerStateServiceEvents.LocalPlayerDataReceived evt) { if (dataEntityCollection == null) { return(false); } DataEntityHandle localPlayerHandle = dataEntityCollection.LocalPlayerHandle; bool flag = !dataEntityCollection.HasComponent <DisplayNameData>(localPlayerHandle); PlayerDataEntityFactory.AddLocalPlayerProfileDataComponents(dataEntityCollection, evt.Data, isOnline: true); if (flag) { PlayerDataEntityFactory.AddCommonDataComponents(dataEntityCollection, localPlayerHandle); PlayerDataEntityFactory.AddLocalPlayerSessionScopeDataComponents(dataEntityCollection, localPlayerHandle); doFTUECheck(localPlayerHandle); ILocalUser localUser = Service.Get <SessionManager>().LocalUser; networkServicesManager.FriendsService.SetLocalUser(localUser); setLocalUser(localUser); string text = "free"; if (dataEntityCollection.IsLocalPlayerMember()) { text = "member"; } string tier = (EnvironmentManager.AreHeadphonesConnected ? "headphone_on" : "headphone_off"); Service.Get <ICPSwrveService>().Action("login", text, localUser.HashedId, tier); Dictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("status", text); Service.Get <ICPSwrveService>().UserUpdate(dictionary); eventDispatcher.DispatchEvent(new NetworkControllerEvents.LocalPlayerDataReadyEvent(localPlayerHandle)); } if (evt.Data.minigameProgress != null) { foreach (MinigameProgress item in evt.Data.minigameProgress) { dataEntityCollection.GetComponent <MiniGamePlayCountData>(localPlayerHandle)?.SetMinigamePlayCount(item.gameId, item.playCount); } } return(false); }
private bool isLocalAndRemoteInTheSameRoom(PresenceData remotePresenceData, PresenceData localPresenceData) { if (localPresenceData.IsNotInCurrentRoomsScene) { return(false); } return((!localPresenceData.IsInInstancedRoom && remotePresenceData.Room == localPresenceData.Room && remotePresenceData.World == localPresenceData.World) || (localPresenceData.IsInInstancedRoom && dataEntityCollection.HasComponent <GameObjectReferenceData>(Handle))); }