public void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); childrenPaths = new HashSet <string>(base.gameObject.GetChildrenPaths()); dataModelHandleListenersMap = new Dictionary <DataEntityHandle, ServerObjectItemData>(); gameObjectIdToTransformMap = new Dictionary <long, Transform>(); }
private void Start() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); searchResultsTitle = Service.Get <Localizer>().GetTokenTranslation("Friends.FindFriendScreenController.SEARCH_RESULTS_TITLE"); noPlayersFound = Service.Get <Localizer>().GetTokenTranslation("Friends.FindFriendScreenController.NO_PLAYERS_FOUND"); setTitleText(searchResultsTitle); }
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); } }
private void removeReferences() { DataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>(); dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <ServerObjectPositionData> >(onComponentAdded); dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.EntityRemovedEvent>(onItemRemoved); serverObjectItemData = null; propService = null; handle = null; }
public static DataEntityHandle CreateRemotePlayerEntity(DataEntityCollection dataEntityCollection, string displayName, string swid) { DataEntityHandle dataEntityHandle = createRemotePlayerEntity(dataEntityCollection, displayName); if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out SwidData component)) { component = dataEntityCollection.AddComponent <SwidData>(dataEntityHandle); } component.Swid = swid; return(dataEntityHandle); }
private void Start() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ProfileData> >(onProfileDataAdded); dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <MembershipData> >(onMembershipDataAdded); friendAvatarRenderer = GetComponent <AvatarImageComponent>(); AvatarImageComponent avatarImageComponent = friendAvatarRenderer; avatarImageComponent.OnImageReady = (Action <DataEntityHandle, Texture2D>)Delegate.Combine(avatarImageComponent.OnImageReady, new Action <DataEntityHandle, Texture2D>(onImageReady)); ownerDataLoader = dataEntityCollection.When <SceneOwnerData>("ActiveSceneData", showOwner); }
private static void setClaimedRewardIds(DataEntityCollection dataEntityCollection, DataEntityHandle handle, List <int> claimedRewardIds) { if (!dataEntityCollection.HasComponent <ClaimedRewardIdsData>(handle)) { dataEntityCollection.AddComponent <ClaimedRewardIdsData>(handle); } if (claimedRewardIds != null && claimedRewardIds.Count > 0) { ClaimedRewardIdsData component = dataEntityCollection.GetComponent <ClaimedRewardIdsData>(handle); component.RewardIds = claimedRewardIds; } }
private static DataEntityHandle createRemotePlayerEntity(DataEntityCollection dataEntityCollection, string displayName) { if (!dataEntityCollection.TryFindEntity <DisplayNameData, string>(displayName, out DataEntityHandle dataEntityHandle)) { dataEntityHandle = dataEntityCollection.AddEntity("rp_" + displayName); } if (!dataEntityCollection.HasComponent <DisplayNameData>(dataEntityHandle)) { dataEntityCollection.AddComponent <DisplayNameData>(dataEntityHandle).DisplayName = displayName; } return(dataEntityHandle); }
private static void addDailySpinDataComponent(DataEntityCollection dataEntityCollection, DataEntityHandle handle, LocalPlayerData localPlayerData) { if (localPlayerData.dailySpinData != null) { if (!dataEntityCollection.TryGetComponent(handle, out DailySpinEntityData component)) { component = dataEntityCollection.AddComponent <DailySpinEntityData>(handle); } component.CurrentChestId = localPlayerData.dailySpinData.currentChestId; component.NumChestsReceivedOfCurrentChestId = localPlayerData.dailySpinData.numChestsReceivedOfCurrentChestId; component.NumPunchesOnCurrentChest = localPlayerData.dailySpinData.numPunchesOnCurrentChest; component.TimeOfLastSpinInMilliseconds = localPlayerData.dailySpinData.timeOfLastSpinInMilliseconds; } }
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); imageBuilderCameraData = GetComponent <ImageBuilderCameraData>(); dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> >(onAvatarDetailsDataAdded); pendingRenderRequests = new Dictionary <string, RenderRequest>(); pausedRenderRequests = new HashSet <string>(); otherPlayerDetailsRequestBatcher = Service.Get <OtherPlayerDetailsRequestBatcher>(); otherPlayerDetailsRequestBatcher.ResetFirstRequestStatus(); isLoadingAvatarPrefab = false; if (UseCache) { avatarImageCacher = new AvatarImageCacher(); } }
public ServerObjectTracker(PropService propService, DataEntityHandle handle, ServerObjectItemData serverObjectItemData) { this.serverObjectItemData = serverObjectItemData; this.propService = propService; this.handle = handle; DataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>(); if (dataEntityCollection.TryGetComponent <ServerObjectPositionData>(handle, out var component)) { spawnObject(component.Position); return; } dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ServerObjectPositionData> >(onComponentAdded); dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.EntityRemovedEvent>(onItemRemoved); }
public static void AddCommonDataComponents(DataEntityCollection dataEntityCollection, DataEntityHandle handle) { if (!dataEntityCollection.HasComponent <TubeData>(handle)) { dataEntityCollection.AddComponent <TubeData>(handle); } if (!dataEntityCollection.HasComponent <HeldObjectsData>(handle)) { dataEntityCollection.AddComponent <HeldObjectsData>(handle); } if (!dataEntityCollection.HasComponent <PresenceData>(handle)) { dataEntityCollection.AddComponent <PresenceData>(handle); } }
public static void AddCommonZoneScopeDataComponents(DataEntityCollection dataEntityCollection, DataEntityHandle handle) { if (!dataEntityCollection.HasComponent <LocomotionData>(handle)) { dataEntityCollection.AddComponent <LocomotionData>(handle); } if (!dataEntityCollection.HasComponent <PositionData>(handle)) { dataEntityCollection.AddComponent <PositionData>(handle); } if (!dataEntityCollection.HasComponent <ChatHistoryData>(handle)) { dataEntityCollection.AddComponent <ChatHistoryData>(handle); } }
public static DataEntityHandle CreateRemotePlayerEntity(DataEntityCollection dataEntityCollection, string displayName, long sessionId) { DataEntityHandle dataEntityHandle = createRemotePlayerEntity(dataEntityCollection, displayName); if (dataEntityCollection.TryGetComponent(dataEntityHandle, out SessionIdData component2)) { component2.SessionId = sessionId; } else { component2 = dataEntityCollection.AddComponent(dataEntityHandle, delegate(SessionIdData component) { component.SessionId = sessionId; }); } return(dataEntityHandle); }
public void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); dataModelHandleListenersMap = new Dictionary <DataEntityHandle, ServerObjectItemData>(); gameObjectIdToTransformMap = new Dictionary <long, Transform>(); gameObjectIdToIslandTargetComponentMap = new Dictionary <long, IslandTarget>(); if (dispatcher == null) { dispatcher = new EventDispatcher(); } childrenPaths = new HashSet <string>(base.gameObject.GetChildrenPaths()); if (string.IsNullOrEmpty(BI_Tier1Name)) { BI_Tier1Name = "crate_co_game"; Log.LogError(this, $"Error: Tier1 name for BI is not set on '{base.gameObject.GetPath()}'"); } }
private void Start() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); membershipDataList = new List <MembershipData>(); friendAvatarRenderer = GetComponent <AvatarImageComponent>(); AvatarImageComponent avatarImageComponent = friendAvatarRenderer; avatarImageComponent.OnImageReady = (Action <DataEntityHandle, Texture2D>)Delegate.Combine(avatarImageComponent.OnImageReady, new Action <DataEntityHandle, Texture2D>(onImageReady)); dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <MembershipData> >(onMembershipDataAdded); incomingFriendInvitationsList = FriendsDataModelService.IncomingInvitationsList; createIncomingFriendInvitations(incomingFriendInvitationsList); bool active = incomingFriendInvitationsList.Count > 0; FriendsRequestsHeader.SetActive(active); screenTitle = Service.Get <Localizer>().GetTokenTranslation("Friends.FriendRequestContent.FriendRequestText"); TitleText.text = string.Format(screenTitle, incomingFriendInvitationsList.Count); isInitialized = true; }
public static void AddLocalPlayerSessionScopeDataComponents(DataEntityCollection dataEntityCollection, DataEntityHandle handle) { if (!dataEntityCollection.HasComponent <CoinsData>(handle)) { dataEntityCollection.AddComponent <CoinsData>(handle); } if (!dataEntityCollection.HasComponent <CollectiblesData>(handle)) { dataEntityCollection.AddComponent <CollectiblesData>(handle); } if (!dataEntityCollection.HasComponent <ConsumableInventoryData>(handle)) { dataEntityCollection.AddComponent <ConsumableInventoryData>(handle); } if (!dataEntityCollection.HasComponent <MiniGamePlayCountData>(handle)) { dataEntityCollection.AddComponent <MiniGamePlayCountData>(handle); } }
public abstract void AddComponent(DataEntityCollection dataEntityCollection);
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); eventChannel = new EventChannel(Service.Get <EventDispatcher>()); if (eventChannel != null) { eventChannel.AddListener <TiltATubesEvents.AddPlayer>(onAddPlayer); eventChannel.AddListener <TiltATubesEvents.RemovePlayer>(onRemovePlayer); eventChannel.AddListener <TiltATubesEvents.DisconnectPlayer>(onDisconnectPlayer); } else { Log.LogError(null, $"Event dispatcher not set, this mini game will not work properly."); isSetupCorrect = false; } activePlayers = new HashSet <string>(); finishedPlayers = new List <string>(); localPlayerName = getLocalPlayerName(); animBuoyAndPlatform = base.gameObject.GetComponent <Animator>(); if (animBuoyAndPlatform == null) { Log.LogError(null, $"Animator component not found on controller object, this mini game will not work properly."); isSetupCorrect = false; } else { hashBuoyAppear = Animator.StringToHash("BuoyAppear"); hashBuoyDisappear = Animator.StringToHash("BuoyDisappear"); hashPlatformAppear = Animator.StringToHash("PlatformAppear"); hashPlatformGameEndPiston = Animator.StringToHash("PlatformGameEndPiston"); hashPlatformDisappear = Animator.StringToHash("PlatformDisappear"); } if (BuoyObject == null) { Log.LogError(null, $"Buoy object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { textBuoy = BuoyObject.GetComponentInChildren <TextMesh>(); if (textBuoy == null) { Log.LogError(null, $"Text mesh component not found on buoy, this mini game will not work properly."); isSetupCorrect = false; } else { animAntenna = BuoyObject.GetComponent <Animator>(); if (animAntenna == null) { Log.LogError(null, $"Animator component not found on buoy, this mini game will not work properly."); isSetupCorrect = false; } else { hashAntennaUp = Animator.StringToHash("AntennaUp"); hashAntennaDown = Animator.StringToHash("AntennaDown"); } } } if (string.IsNullOrEmpty(PlatformVolumeId)) { Log.LogError(null, $"PlatformId not specified, this mini game will not work properly."); isSetupCorrect = false; } if (PlatformObject == null) { Log.LogError(null, $"Platform object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { platformFinalPosition = PlatformObject.transform.localPosition; platformOriginalAngle = PlatformObject.transform.eulerAngles; platformWaterTrigger = PlatformObject.GetComponent <Collider>(); if (platformWaterTrigger == null) { Log.LogError(null, $"Platform water triger component not found, this mini game will not work properly."); isSetupCorrect = false; } } if (PlatformSign == null) { Log.LogError(null, $"Platform text object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { textPlatform = PlatformSign.GetComponentInChildren <TextMesh>(); if (textPlatform == null) { Log.LogError(null, $"Platform text component not found, this mini game will not work properly."); isSetupCorrect = false; } } if (PlatformRotation == null) { Log.LogError(null, $"Platform rotation object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { rotateScript = PlatformRotation.GetComponentInChildren <RotateTransform>(); if (rotateScript == null) { Log.LogError(null, $"RotatateTransform component not found, this mini game will not work properly."); isSetupCorrect = false; } else { platformOriginalRotation = PlatformRotation.transform.eulerAngles; rotateScript.isActive = true; } } if (PlatformCollider == null) { Log.LogError(null, $"Platform collider object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (PlatformShrink == null) { Log.LogError(null, $"Platform shrink object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (PlatformPistonSpring == null) { Log.LogError(null, $"Platform piston spring object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (PlatformTilt == null) { Log.LogError(null, $"Platform tilt object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (PlatformTube == null) { Log.LogError(null, $"Platform tube object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { platformTubeBattlePosition = PlatformTube.transform.localPosition; Vector3 vector = platformTubeBattlePosition; vector.y = 0.6f; platformTubeSafetyPosition = vector; } if (PlatformOneWayIn == null) { Log.LogError(null, $"Platform one-way-in object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (PlatformOneWayOut == null) { Log.LogError(null, $"Platform one-way-out object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (SyncPlayerVolume == null) { Log.LogError(null, $"Sync player volume object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (LaunchpadObject == null) { Log.LogError(null, $"Launchpad prefab not specified, this mini game will not work properly."); isSetupCorrect = false; } else { hashLaunchpadAppear = Animator.StringToHash("LaunchpadAppear"); hashLaunchpadDisppear = Animator.StringToHash("LaunchpadDisappear"); } PlatformObject.SetActive(value: true); BuoyObject.SetActive(value: true); if (BuoyBulbOn == null) { Log.LogError(null, $"Bulb on prefab not specified, this mini game will not work properly."); isSetupCorrect = false; } else { BuoyBulbOn.SetActive(value: true); rendBulbOn = BuoyBulbOn.GetComponent <Renderer>(); if (rendBulbOn == null) { Log.LogError(null, $"Bulb on renderer not found, this mini game will not work properly."); isSetupCorrect = false; } } if (BuoyBulbOff == null) { Log.LogError(null, $"Bulb off prefab not specified, this mini game will not work properly."); isSetupCorrect = false; } else { BuoyBulbOff.SetActive(value: true); rendBulbOff = BuoyBulbOff.GetComponent <Renderer>(); if (rendBulbOff == null) { Log.LogError(null, $"Bulb off renderer not found, this mini game will not work properly."); isSetupCorrect = false; } } if (ParticlesGameOver == null) { Log.LogError(null, $"GameOver particle object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { ParticlesGameOver.SetActive(value: false); } if (SignGameOver == null) { Log.LogError(null, $"GameOver sign object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { textGameOver = SignGameOver.GetComponentInChildren <TextMesh>(); if (textGameOver == null) { Log.LogError(null, $"GameOver sign text component not found, this mini game will not work properly."); isSetupCorrect = false; } else { textGameOver.text = ""; } SignGameOver.SetActive(value: false); } if (AudioPrefab == null) { Log.LogError(null, $"Audio prefab object not specified, this mini game will not work properly."); isSetupCorrect = false; } else { audioPrefab = UnityEngine.Object.Instantiate(AudioPrefab, base.transform); } if (AudioAnchor == null) { Log.LogError(null, $"Audio anchor prefab object not specified, this mini game will not work properly."); isSetupCorrect = false; } if (HelpSign == null) { Log.LogError(null, $"HelpSign object not specified, this mini game will not work properly."); isSetupCorrect = false; } }
protected override IEnumerator setup() { dataEntityCollection = new DataEntityCollectionDictionaryImpl(); yield return(null); }
public static DataEntityHandle CreateRemotePlayerEntity(DataEntityCollection dataEntityCollection, string displayName) { return(createRemotePlayerEntity(dataEntityCollection, displayName)); }
public override void AddComponent(DataEntityCollection dataEntityCollection) { DataEntityHandle handle = dataEntityCollection.AddEntity(entityName); dataEntityCollection.AddComponent <T>(handle); }
public static DataEntityHandle AddLocalPlayerProfileDataComponents(DataEntityCollection dataEntityCollection, LocalPlayerData data, bool isOnline = false) { DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntityByName("LocalPlayer"); if (dataEntityHandle.IsNull) { return(dataEntityHandle); } if (data == null) { return(dataEntityHandle); } if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out DisplayNameData component2)) { component2 = dataEntityCollection.AddComponent <DisplayNameData>(dataEntityHandle); } component2.DisplayName = data.name; if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out QuestStateData component3)) { component3 = dataEntityCollection.AddComponent <QuestStateData>(dataEntityHandle); } component3.Data = data.quests; if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out AvatarDetailsData component4)) { component4 = dataEntityCollection.AddComponent <AvatarDetailsData>(dataEntityHandle); component4.BodyColor = AvatarService.DefaultBodyColor; component4.Outfit = new DCustomEquipment[0]; } if (data.outfit != null && data.outfit.Count > 0) { component4.Outfit = CustomEquipmentResponseAdaptor.ConvertResponseToOutfit(data.outfit); } if (data.profile != null) { Dictionary <int, AvatarColorDefinition> avatarColors = Service.Get <GameData>().Get <Dictionary <int, AvatarColorDefinition> >(); component4.BodyColor = AvatarBodyColorAdaptor.GetColorFromDefinitions(avatarColors, data.profile.colour); } if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out ProfileData component5)) { component5 = dataEntityCollection.AddComponent <ProfileData>(dataEntityHandle); } component5.PenguinAgeInDays = ((data.profile != null) ? data.profile.daysOld : 0); component5.IsOnline = isOnline; component5.IsMigratedPlayer = (data.migrationData != null && data.migrationData.status.Equals("MIGRATED")); component5.ZoneId = data.zoneId; if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out MembershipData component6)) { component6 = dataEntityCollection.AddComponent <MembershipData>(dataEntityHandle); } component6.IsMember = data.member; component6.MembershipType = (data.member ? MembershipType.Member : MembershipType.None); component6.MembershipExpireDate = data.membershipExpireDate; component6.MembershipTrialAvailable = data.trialAvailable; if (!component6.IsMember && Service.Get <AllAccessService>().IsAllAccessActive()) { component6.IsMember = true; component6.MembershipType = MembershipType.AllAccessEventMember; } logPlayerStatusBI(data); if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out SubscriptionData component7)) { component7 = dataEntityCollection.AddComponent <SubscriptionData>(dataEntityHandle); } component7.SubscriptionVendor = data.subscriptionVendor; component7.SubscriptionProductId = data.subscriptionProductId; component7.SubscriptionPaymentPending = data.subscriptionPaymentPending; component7.SubscriptionRecurring = data.recurring; if (data.migrationData != null && data.migrationData.legacyAccountData != null) { if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out LegacyProfileData component8)) { component8 = dataEntityCollection.AddComponent <LegacyProfileData>(dataEntityHandle); } component8.Username = data.migrationData.legacyAccountData.username; component8.IsMember = data.migrationData.legacyAccountData.member; component8.CreatedDate = data.migrationData.legacyAccountData.createdDate; component8.MigratedDate = data.migrationData.migratedDate; } byte[] array = new byte[data.tutorialData.Count]; for (int i = 0; i < array.Length; i++) { array[i] = (byte)data.tutorialData[i]; } if (!dataEntityCollection.TryGetComponent(dataEntityHandle, out TutorialData component9)) { component9 = dataEntityCollection.AddComponent <TutorialData>(dataEntityHandle); } component9.Data = new BitArray(array); switch (data.id.type) { case PlayerId.PlayerIdType.SESSION_ID: if (!dataEntityCollection.HasComponent <SessionIdData>(dataEntityHandle)) { dataEntityCollection.AddComponent(dataEntityHandle, delegate(SessionIdData component) { component.SessionId = Convert.ToInt64(data.id.id); }); } break; case PlayerId.PlayerIdType.SWID: if (!dataEntityCollection.HasComponent <SwidData>(dataEntityHandle)) { dataEntityCollection.AddComponent <SwidData>(dataEntityHandle).Swid = data.id.id; } break; } setClaimedRewardIds(dataEntityCollection, dataEntityHandle, data.claimedRewardIds); addDailySpinDataComponent(dataEntityCollection, dataEntityHandle, data); return(dataEntityHandle); }
public AvatarImageCacher() { imageCache = Service.Get <ImageCache>(); dataEntityCollection = Service.Get <CPDataEntityCollection>(); }