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 void loadInventory() { DataEntityHandle localPlayerHandle = Service.Get <CPDataEntityCollection>().LocalPlayerHandle; if (!localPlayerHandle.IsNull) { inventoryData = Service.Get <CPDataEntityCollection>().GetComponent <InventoryData>(localPlayerHandle); if (inventoryData == null) { Service.Get <EventDispatcher>().AddListener <InventoryServiceEvents.InventoryLoaded>(onInventoryRetrieved); Service.Get <INetworkServicesManager>().InventoryService.GetEquipmentInventory(); } else { setDefaultScreen(); } } else { setDefaultScreen(); } }
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); }
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"); } } }
protected virtual void setUpObject(RectTransform item, int poolIndex) { AbstractPlayerListItem component = item.GetComponent <AbstractPlayerListItem>(); DataEntityHandle handleFromPoolIndex = getHandleFromPoolIndex(poolIndex); AbstractPlayerListItem component2 = item.GetComponent <AbstractPlayerListItem>(); string displayName2 = (component2.Name = dataEntityCollection.GetComponent <DisplayNameData>(handleFromPoolIndex).DisplayName); component2.SetPlayer(handleFromPoolIndex); ProfileData component3; bool flag = dataEntityCollection.TryGetComponent <ProfileData>(handleFromPoolIndex, out component3); if (!flag) { Service.Get <OtherPlayerDetailsRequestBatcher>().RequestOtherPlayerDetails(handleFromPoolIndex); } if (flag) { bool flag2 = getIsOnline(handleFromPoolIndex) || !ShowPlayerOfflineState; component.SetOnlineStatus(flag2); renderPlayer(component, handleFromPoolIndex, displayName2, flag2); } }
private bool showAllAccess() { AllAccessService allAccessService = Service.Get <AllAccessService>(); if (allAccessService.IsAllAccessActive()) { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out DisplayNameData component)) { string allAccessEventKey = allAccessService.GetAllAccessEventKey(); if (!AllAccessHelper.HasSeenAllAccessFlow(allAccessEventKey, component.DisplayName)) { AllAccessHelper.SetHasSeenAllAccessFlow(allAccessEventKey, component.DisplayName); DataEntityHandle handle = cPDataEntityCollection.AddEntity("AllAccessCelebrationData"); AllAccessCelebrationData allAccessCelebrationData = cPDataEntityCollection.AddComponent <AllAccessCelebrationData>(handle); allAccessCelebrationData.ShowAllAccessCelebration = true; return(true); } } } return(false); }
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(); } } }
private void Start() { Camera = base.gameObject.AddComponent <Camera>(); localPlayerMask = LayerMask.NameToLayer("LocalPlayer"); mainCamera = Camera.main; Camera.cullingMask = mainCamera.cullingMask; mainCamera.enabled = false; base.gameObject.tag = "MainCamera"; GameObject gameObject = GameObject.FindGameObjectWithTag(UIConstants.Tags.UI_Tray_Root); if (gameObject != null) { context = gameObject.GetComponent <StateMachineContext>(); context.SendEvent(new ExternalEvent("Root", "noUI")); } Service.Get <EventDispatcher>().DispatchEvent(default(PlayerNameEvents.HidePlayerNames)); DataEntityHandle localPlayerHandle = Service.Get <CPDataEntityCollection>().LocalPlayerHandle; if (!localPlayerHandle.IsNull && Service.Get <CPDataEntityCollection>().TryGetComponent <GameObjectReferenceData>(localPlayerHandle, out var component)) { blobShadowCaster = component.GameObject.GetComponent <BlobShadowCaster>(); } groupCulling = UnityEngine.Object.FindObjectOfType <GroupCulling>(); if (groupCulling != null) { groupCulling.enabled = false; } GameObject gameObject2 = GameObject.Find("WorldChatCanvas"); if (gameObject2 != null) { worldChatCanvas = gameObject2.GetComponent <Canvas>(); if (worldChatCanvas != null) { worldChatCanvas.worldCamera = Camera; } } setLocalPlayerActive(isActive: false); }
private GameObject getPlayerGameObj(long sessionId = 0L) { GameObject result = null; if (sessionId != 0) { DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntity <SessionIdData, long>(sessionId); if (dataEntityHandle != null) { dataEntityCollection.TryGetComponent <GameObjectReferenceData>(dataEntityHandle, out var component); if (component != null) { result = component.GameObject; } } } else { result = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject; } return(result); }
private void Start() { Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "16", "restore_membership_success"); ModalBackground component = GetComponent <ModalBackground>(); component.enabled = true; PenguinName.text = string.Format(PenguinName.text, Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayName); if (!(SceneManager.GetActiveScene().name == "Boot")) { avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>(); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; AvatarAnimationFrame avatarFrame = new AvatarAnimationFrame("Base Layer.Interactions.PassPortPoses_CelebrateAnimation", 0f); if (cPDataEntityCollection.TryGetComponent <AvatarDetailsData>(localPlayerHandle, out var component2)) { avatarRenderer.RenderAvatar(component2, avatarFrame); } else { avatarRenderer.RenderAvatar(new DCustomEquipment[0], avatarFrame); } } }
protected void renderPlayer(AbstractPlayerListItem playerListItem, DataEntityHandle handle, string displayName, bool isOnline) { if (!playerListItem.IsRendered) { playerListItem.IsRendered = true; playerListItem.SetPreloaderActive(isActive: true); playerListItem.SetAvatarIconActive(isActive: false); if (playerAvatarRenderer.IsRenderInProgress(displayName)) { playerAvatarRenderer.CancelRender(displayName); } if (isOnline) { AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(IdlePenguinState, 0.5f); playerAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListIdle"); } else { AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(SleepingPenguinState, 0.75f); playerAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListSleeping"); } } }
private void renderOwner(FriendListItem friendListItem, DataEntityHandle handle, string displayName, bool isOnline) { if (!friendListItem.IsRendered || (friendListItem.IsOnlineSet && isOnline != friendListItem.IsOnline)) { friendListItem.IsRendered = true; friendListItem.SetPreloaderActive(isActive: true); friendListItem.SetAvatarIconActive(isActive: false); if (friendAvatarRenderer.IsRenderInProgress(displayName)) { friendAvatarRenderer.CancelRender(displayName); } if (isOnline) { AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(IdlePenguinState, 0.5f); friendAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListIdle"); } else { AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(SleepingPenguinState, 0.75f); friendAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListSleeping"); } } }
private bool onRewardsEarned(RewardServiceEvents.RewardsEarned evt) { if (evt.RewardedUsers != null && evt.RewardedUsers.source == RewardSource.MINI_GAME && evt.RewardedUsers.sourceId == "Targets") { List <long> list = new List <long>(); foreach (KeyValuePair <long, Reward> reward in evt.RewardedUsers.rewards) { long key = reward.Key; list.Add(reward.Key); if (!string.IsNullOrEmpty(ParticipationPlayerPrefName) && !isQuestActive()) { DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntity <SessionIdData, long>(key); if (!dataEntityHandle.IsNull && key == Service.Get <CPDataEntityCollection>().LocalPlayerSessionId) { RewardedForLocalParticipation(); } } } SceneRefs.CelebrationRunner.PlayCelebrationAnimation(list); UnityEngine.Object.Instantiate(RewardEffectsPrefab, RewardEffectsPosition.position, Quaternion.identity); } return(false); }
public void RequestImage(DataEntityHandle handle, AvatarAnimationFrame avatarAnimationFrame = null, string context = null) { if (UseCache && string.IsNullOrEmpty(context)) { throw new ArgumentException("If using the cache, the context string must not be null"); } string displayName = dataEntityCollection.GetComponent <DisplayNameData>(handle).DisplayName; if (!pendingRenderRequests.ContainsKey(displayName)) { RenderRequest renderRequest = new RenderRequest(handle); renderRequest.AvatarAnimationFrame = avatarAnimationFrame; renderRequest.Context = context; pendingRenderRequests.Add(displayName, renderRequest); if (!dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component)) { otherPlayerDetailsRequestBatcher.RequestOtherPlayerDetails(handle); return; } renderRequest.AvatarDetailsData = component; getImage(displayName, renderRequest); } }
private void onAvatarIsReady(AvatarBaseAsync avatarView) { avatarView.OnReady -= onAvatarIsReady; GameObject gameObject = avatarView.gameObject; AvatarDataHandle component = gameObject.GetComponent <AvatarDataHandle>(); if (!(component != null) || component.Handle.IsNull || !dataEntityCollection.TryGetComponent(component.Handle, out RemotePlayerData _)) { return; } DataEntityHandle handle = null; if (AvatarDataHandle.TryGetPlayerHandle(gameObject, out handle)) { avatarViewReady.Add(handle); PositionData component3 = dataEntityCollection.GetComponent <PositionData>(handle); if (component3.Position != Vector3.zero) { placeRemotePlayer(gameObject, handle, component3.Position); } } Service.Get <EventDispatcher>().DispatchEvent(new PlayerSpawnedEvents.RemotePlayerSpawned(gameObject, component.Handle)); }
private void setScreenDisplay() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; DisplayNameData component; string text = ((!localPlayerHandle.IsNull && cPDataEntityCollection.TryGetComponent <DisplayNameData>(localPlayerHandle, out component)) ? component.DisplayName : "editor"); string text2 = ""; text2 = ((!(highJumpAltitude >= 10f)) ? highJumpAltitude.ToString("0.00") : highJumpAltitude.ToString("00.00")); if (RecordText != null) { RecordText.text = text2; } if (RecordMarkerText != null && RecordMarkerShadowText != null) { RecordMarkerText.text = text2; RecordMarkerShadowText.text = text2; } if (NameText != null) { NameText.text = text; } }
public void Start() { state = CollectibleHudState.closed; animator = GetComponent <Animator>(); definitionService = Service.Get <CollectibleDefinitionService>(); loadedSprites = new Dictionary <string, Sprite>(); previousType = ""; base.gameObject.SetActive(value: false); Service.Get <EventDispatcher>().AddListener <CollectibleEvents.CollectibleAdd>(onAddCollectible); localPlayerHandle = Service.Get <CPDataEntityCollection>().LocalPlayerHandle; if (PlayerPrefs.HasKey("CollectiblesTutorialCount")) { numCollectiblesSinceTutorial = PlayerPrefs.GetInt("CollectiblesTutorialCount"); } if (PlayerPrefs.HasKey("CollectiblesTutorialsShown")) { numTutorialsShown = PlayerPrefs.GetInt("CollectiblesTutorialsShown"); } if (PlayerPrefs.HasKey("CollectiblesShowTutorial")) { ShouldShowCollectibleTutorial = PlayerPrefs.GetInt("CollectiblesShowTutorial") == 1; } }
private void onServerObjectItemAdded(DataEntityHandle handle, ServerObjectItemData obj) { StatefulWorldObject statefulWorldObject = obj.Item as StatefulWorldObject; if (statefulWorldObject == null) { return; } if (!dataModelHandleListenersMap.ContainsKey(handle) && childrenPaths.Contains(statefulWorldObject.Path)) { Transform transform = base.gameObject.transform.Find(statefulWorldObject.Path); if (transform != null) { dataModelHandleListenersMap[handle] = obj; obj.ItemChanged += onServerObjectChanged; gameObjectIdToTransformMap[statefulWorldObject.Id.Id] = transform; } } if (dataModelHandleListenersMap.ContainsKey(handle)) { UpdateWorldObjectState(statefulWorldObject); } }
public void LoadIgloo(ZoneId zoneId, Language language, SceneStateData.SceneState sceneState, string transitionScene = null, string onJoinNotificationTag = null) { ZoneDefinition zone = GetZone(zoneId.name); if (isSceneTransitionValid(zone.SceneName)) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add(SceneTransitionService.SceneArgs.LoadingScreenOverride.ToString(), IglooSplashScreen.Key); sceneTransition(zone.SceneName, transitionScene, dictionary); connectToIgloo(zoneId, zone, language, onJoinNotificationTag); } DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntityByName("ActiveSceneData"); if (dataEntityHandle.IsNull) { dataEntityHandle = dataEntityCollection.AddEntity("ActiveSceneData"); } if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out SceneStateData component)) { component = dataEntityCollection.AddComponent <SceneStateData>(dataEntityHandle); } component.State = sceneState; }
private void onServerObjectItemAdded(DataEntityHandle handle, ServerObjectItemData obj) { IslandTargetGroupMMOItem islandTargetGroupMMOItem = obj.Item as IslandTargetGroupMMOItem; if (islandTargetGroupMMOItem != null) { onIslandGroupMMOItemAdded(handle, obj, islandTargetGroupMMOItem); return; } IslandTargetMMOItem islandTargetMMOItem = obj.Item as IslandTargetMMOItem; if (islandTargetMMOItem != null) { onIslandTargetMMOItemAdded(handle, obj, islandTargetMMOItem); return; } IslandTargetPlaygroundStatsMMOItem islandTargetPlaygroundStatsMMOItem = obj.Item as IslandTargetPlaygroundStatsMMOItem; if (islandTargetPlaygroundStatsMMOItem != null) { onIslandTargetPlaygroundStatsMMOItemAdded(handle, obj, islandTargetPlaygroundStatsMMOItem); } }
protected override IEnumerator setup() { yield return(base.setup()); friendsService.FindUser(bobSession.LocalUser.DisplayName.Text, aliceSession.LocalUser); while (dataEntityCollection.GetEntityByType <SearchedUserData>().IsNull) { yield return(null); } DataEntityHandle searchedUserHandle = dataEntityCollection.GetEntityByType <SearchedUserData>(); SearchedUserData searchedUserData = dataEntityCollection.GetComponent <SearchedUserData>(searchedUserHandle); friendsService.SendFriendInvitation(searchedUserData.SearchedUser, aliceSession.LocalUser); while (dataEntityCollection.GetEntityByType <OutgoingFriendInvitationData>().IsNull) { yield return(null); } while (!bobSession.LocalUser.IncomingFriendInvitations.Any()) { yield return(null); } IAcceptFriendInvitationResult rejectResult = null; bobSession.LocalUser.AcceptFriendInvitation(bobSession.LocalUser.IncomingFriendInvitations.First(), acceptTrust : false, delegate(IAcceptFriendInvitationResult r) { rejectResult = r; }); while (rejectResult == null) { yield return(null); } IntegrationTestEx.FailIf(!rejectResult.Success, "Accept friend invitation failed"); while (dataEntityCollection.GetEntityByType <FriendData>().IsNull) { yield return(null); } }
private void addChatMessageToPool(long sessionId) { float y = layoutElementPool.ElementScrollRect.content.anchoredPosition.y; float y2 = layoutElementPool.ElementScrollRect.content.sizeDelta.y; if (dataEntityCollection.IsLocalPlayer(sessionId)) { layoutElementPool.AddElement(1); } else { DataEntityHandle dataEntityHandle = findPlayerHandle(sessionId); List <DataEntityHandle> friendsList = FriendsDataModelService.FriendsList; bool flag = false; for (int i = 0; i < friendsList.Count; i++) { if (friendsList[i] == dataEntityHandle) { flag = true; break; } } if (flag) { layoutElementPool.AddElement(1, 2); } else { layoutElementPool.AddElement(1, 1); } } if (y < -20f) { StartCoroutine(scrollToOriginalPosition(y2, y)); } }
private void Start() { Service.Get<ICPSwrveService>().Funnel(Service.Get<MembershipService>().MembershipFunnelName, "05", "membership_thanks"); membershipController = GetComponentInParent<MembershipController>(); if (MonoSingleton<NativeAccessibilityManager>.Instance.AccessibilityLevel == NativeAccessibilityLevel.VOICE) { string tokenTranslation = Service.Get<Localizer>().GetTokenTranslation("Accessibility.Popup.Title.MembershipThanks"); MonoSingleton<NativeAccessibilityManager>.Instance.Native.Speak(tokenTranslation); } CPDataEntityCollection cPDataEntityCollection = Service.Get<CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; if (!(SceneManager.GetActiveScene().name == "Boot")) { avatarRenderer = GetComponentInChildren<AvatarRenderTextureComponent>(); if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out AvatarDetailsData component)) { avatarRenderer.RenderAvatar(component); } else { avatarRenderer.RenderAvatar(new DCustomEquipment[0]); } } }
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 showFriendRequests(bool isSettingUp, GameObject friendRequestItemPrefab = null) { bool active = incomingFriendInvitationsList.Count > 0; FriendsRequestsHeader.SetActive(active); if (isSettingUp) { friendRequestItems = new List <FriendRequestItem>(); } for (int i = 0; i < 4; i++) { FriendRequestItem friendRequestItem; if (isSettingUp) { friendRequestItem = UnityEngine.Object.Instantiate(friendRequestItemPrefab).GetComponent <FriendRequestItem>(); friendRequestItem.transform.SetParent(FriendRequestsContainer, worldPositionStays: false); friendRequestItems.Add(friendRequestItem); } else { friendRequestItem = friendRequestItems[i]; } if (incomingFriendInvitationsList.Count > i) { friendRequestItem.gameObject.SetActive(value: true); DataEntityHandle handle = incomingFriendInvitationsList[i]; populateRequestPrefab(friendRequestItem, handle); DynamicMulticoloredListElement component = friendRequestItem.GetComponent <DynamicMulticoloredListElement>(); component.SetIndex(i); } else { friendRequestItem.gameObject.SetActive(value: false); } } }
public void ReturnToZoneScene(Dictionary <string, object> sceneArgs = null) { ZoneTransitionService zoneTransitionService = Service.Get <ZoneTransitionService>(); if (zoneTransitionService.IsInIgloo) { DataEntityHandle activeHandle = Service.Get <SceneLayoutDataManager>().GetActiveHandle(); if (dataEntityCollection.TryGetComponent <SceneOwnerData>(activeHandle, out var component)) { if (component.IsOwner) { if (dataEntityCollection.TryGetComponent <ProfileData>(dataEntityCollection.LocalPlayerHandle, out var component2)) { Service.Get <ZoneTransitionService>().LoadIgloo(component2.ZoneId, Service.Get <Localizer>().Language, SceneStateData.SceneState.Play); } else { returnToZoneSceneError("Could not find local owner ProfileData. Did not join igloo after returning from SceneWithoutZone state."); } } else { eventDispatcher.AddListener <PlayerStateServiceEvents.OtherPlayerDataReceived>(onOwnerPlayerDataReceived); Service.Get <INetworkServicesManager>().PlayerStateService.GetOtherPlayerDataByDisplayName(component.Name); } } else { returnToZoneSceneError("Could not find igloo OwnerData. Did not join igloo after returning from SceneWithoutZone state."); } } else { Service.Get <SceneTransitionService>().LoadScene(zoneTransitionService.CurrentZone.SceneName, SceneConfig.TransitionSceneName, sceneArgs); } }
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; }
public void AssignAvatarView(AvatarView avatarView, DataEntityHandle remotePlayerHandle, GameObject remotePlayerGO) { GameObjectReferenceData component = dataEntityCollection.GetComponent <GameObjectReferenceData>(remotePlayerHandle); component.GameObject = remotePlayerGO; if (avatarView.IsReady) { onAvatarIsReady(avatarView); } else { avatarView.OnReady += onAvatarIsReady; } PositionData component2 = dataEntityCollection.GetComponent <PositionData>(remotePlayerHandle); if (component2.Position != Vector3.zero) { placeRemotePlayer(remotePlayerGO, remotePlayerHandle, component2.Position); } else { component2.PlayerMoved += onPlayerMoved; } }
private bool onLoginSuccess(PlayerStateServiceEvents.MigrationDataRecieved recievedData) { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); DataEntityHandle localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle; if (recievedData.Data != null && !localPlayerHandle.IsNull) { if (!cPDataEntityCollection.TryGetComponent(localPlayerHandle, out ProfileData component)) { component = cPDataEntityCollection.AddComponent <ProfileData>(localPlayerHandle); } component.IsMigratedPlayer = true; if (!cPDataEntityCollection.TryGetComponent(localPlayerHandle, out LegacyProfileData component2)) { component2 = cPDataEntityCollection.AddComponent <LegacyProfileData>(localPlayerHandle); } component2.IsMember = recievedData.Data.legacyAccountData.member; component2.Username = recievedData.Data.legacyAccountData.username; component2.CreatedDate = recievedData.Data.legacyAccountData.createdDate; component2.MigratedDate = recievedData.Data.migratedDate; } rootStateMachine.SendEvent(MigrateSuccessEvent); return(false); }
public OpenReportPlayerCommand(DataEntityHandle handle) { this.handle = handle; }