private bool onIglooServiceEventsDecorationsLoaded(IglooServiceEvents.DecorationsLoaded evt) { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); int count = evt.DecorationInventory.items.Count; if (!cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out DecorationInventoryData component)) { component = cPDataEntityCollection.AddComponent <DecorationInventoryData>(cPDataEntityCollection.LocalPlayerHandle); } Dictionary <int, int> dictionary = new Dictionary <int, int>(count); for (int i = 0; i < count; i++) { DecorationId decorationId = evt.DecorationInventory.items[i].decorationId; if (decorationId.type == DecorationType.Decoration && !decorationId.customId.HasValue) { dictionary.Add(decorationId.definitionId, evt.DecorationInventory.items[i].count); } } component.Decorations = dictionary; if (!cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out StructureInventoryData component2)) { component2 = cPDataEntityCollection.AddComponent <StructureInventoryData>(cPDataEntityCollection.LocalPlayerHandle); } Dictionary <int, int> dictionary2 = new Dictionary <int, int>(count); for (int i = 0; i < count; i++) { DecorationId decorationId = evt.DecorationInventory.items[i].decorationId; if (decorationId.type == DecorationType.Structure && !decorationId.customId.HasValue) { dictionary2.Add(decorationId.definitionId, evt.DecorationInventory.items[i].count); } } component2.Structures = dictionary2; return(false); }
private InitialStateEvent getInitialStateEvent() { InitialStateEvent result = InitialStateEvent.loggedout; if (Service.Get <SessionManager>().HasSession) { result = InitialStateEvent.nonmember; CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out MembershipData component)) { switch (component.MembershipType) { case MembershipType.Member: result = InitialStateEvent.member; break; case MembershipType.AllAccessEventMember: result = InitialStateEvent.allaccesseventmember; break; } } } return(result); }
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]); } } }
private void OnEnable() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection == null) { return; } nameText = GetComponent <Text>(); if (cPDataEntityCollection.TryGetComponent <DisplayNameData>(cPDataEntityCollection.LocalPlayerHandle, out var component)) { string text = component.DisplayName; if (MaxNameLength > 0 && text.Length > MaxNameLength) { text = text.Substring(0, MaxNameLength); } if (!string.IsNullOrEmpty(Token)) { string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation(Token); text = string.Format(tokenTranslation, text); } nameText.text = text; } }
public void Start() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); localPresenceData = cPDataEntityCollection.GetComponent <PresenceData>(cPDataEntityCollection.LocalPlayerHandle); if (localPresenceData != null) { localPresenceData.IsNotInCurrentRoomsScene = true; } else { Log.LogError(this, "Unable to set IsNotInCurrentRoomsScene. Jump to friends may be broken."); } PrefabContentKey prefabContentKey = (PrefabContentKey)Service.Get <SceneTransitionService>().GetSceneArg("appletToLaunch"); if (prefabContentKey == null) { CloseApplet(); throw new InvalidOperationException("CellPhoneAppletController was added in a scene that did not have a APPLET_SCENE_ARG_KEY value"); } events = new EventChannel(Service.Get <EventDispatcher>()); events.AddListenerOneShot <CellPhoneEvents.ReturnToHomeScreen>(onCloseApplet); CoroutineRunner.Start(loadAndInitPrefab(prefabContentKey), this, "loadAndInitPrefab"); }
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); }
private void applyMembership(MembershipRightsRefresh data) { CPDataEntityCollection cPDataEntityCollection = Service.Get<CPDataEntityCollection>(); if (cPDataEntityCollection == null || cPDataEntityCollection.LocalPlayerHandle.IsNull) { throw new Exception("Unable to resolve data entity collection"); } if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out MembershipData component)) { component.MembershipExpireDate = data.expireDate; component.IsMember = true; component.MembershipType = MembershipType.Member; if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out SubscriptionData component2)) { component2.SubscriptionVendor = data.vendor; component2.SubscriptionProductId = data.productId; Service.Get<INetworkServicesManager>().PlayerStateService.GetLocalPlayerData(this); Service.Get<ICPSwrveService>().Action("game.new_member"); return; } throw new MissingReferenceException("No subscription data found for local player"); } throw new MissingReferenceException("No membership data found for local player"); }
private void Awake() { avatarDataHandle = GetComponent <AvatarDataHandle>(); eventChannel = new EventChannel(Service.Get <EventDispatcher>()); dataEntityCollection = Service.Get <CPDataEntityCollection>(); }
public bool HasItem() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); return(cPDataEntityCollection.GetComponent <ClaimedRewardIdsData>(cPDataEntityCollection.LocalPlayerHandle)?.RewardIds.Contains(EventItemDefinition.Id) ?? false); }
public void RemoveAccountFlowData() { CPDataEntityCollection cPDataEntityCollection = Service.Get<CPDataEntityCollection>(); cPDataEntityCollection.RemoveComponent<AccountFlowData>(cPDataEntityCollection.LocalPlayerHandle); }
public void OnStateChanged(string state) { if (!(state == HandledState) || !(rootStateMachine != null)) { return; } Service.Get <EventDispatcher>().DispatchEvent(default(AccountSystemEvents.AccountSystemEnded)); CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); if (cPDataEntityCollection == null || cPDataEntityCollection.LocalPlayerHandle.IsNull) { throw new Exception("Unable to resolve data entity collection"); } SessionManager sessionManager = Service.Get <SessionManager>(); if (sessionManager.HasSession) { Service.Get <GameSettings>().FirstSession = false; if (!cPDataEntityCollection.TryGetComponent <ProfileData>(cPDataEntityCollection.LocalPlayerHandle, out var component) || !cPDataEntityCollection.TryGetComponent <MembershipData>(cPDataEntityCollection.LocalPlayerHandle, out var _)) { return; } bool flag = true; if (sessionManager.LocalUser.RegistrationProfile.AccountStatus == AccountStatus.AwaitingParentalConsent) { NormalLoginExitEvent = ParentalConsentRequiredEvent; ContinueFTUEExitEvent = ParentalConsentRequiredEvent; InGameExitEvent = ParentalConsentRequiredEvent; } QuestService questService = Service.Get <QuestService>(); bool flag2 = false; if (questService.ActiveQuest != null && questService.ActiveQuest.Id == Service.Get <GameStateController>().FTUEConfig.FtueQuestId) { if (component.IsFirstTimePlayer) { if (flag) { Service.Get <EventDispatcher>().DispatchEvent(default(SessionEvents.FTUENameObjectiveCompleteEvent)); } else { Service.Get <EventDispatcher>().DispatchEvent(default(SessionEvents.FTUENameObjectiveCancelledEvent)); } } else { Service.Get <EventDispatcher>().DispatchEvent(default(SessionEvents.FTUENameObjectiveAlreadyDoneEvent)); } flag2 = true; } if (cPDataEntityCollection.TryGetComponent <LocalPlayerInZoneData>(cPDataEntityCollection.LocalPlayerHandle, out var _)) { recordBI(InGameExitEvent); rootStateMachine.SendEvent(InGameExitEvent); return; } bool flag3 = false; flag3 |= MonoSingleton <NativeAccessibilityManager> .Instance.IsEnabled; if (component.IsFirstTimePlayer && questService.ActiveQuest == null && !flag3) { recordBI(StartFTUEExitEvent); rootStateMachine.SendEvent(StartFTUEExitEvent); } else if ((!component.IsFTUEComplete && !flag3) || flag2) { recordBI(ContinueFTUEExitEvent); rootStateMachine.SendEvent(ContinueFTUEExitEvent); } else { recordBI(NormalLoginExitEvent); rootStateMachine.SendEvent(NormalLoginExitEvent); } } else { recordBI(NotLoggedInExitEvent); rootStateMachine.SendEvent(NotLoggedInExitEvent); } }
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); handleToServerObject = new Dictionary <DataEntityHandle, ServerObjectItemData>(); awake(); }
public SceneLayoutDataManager() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); }
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); dispatcher = Service.Get <EventDispatcher>(); }
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); ClubPenguin.SceneRefs.SetZiplineConnector(this); ziplineEndpoints = null; }
private void Start() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); string text = ""; string text2 = ""; bool flag = false; bool productIsRecurring = true; bool flag2 = false; PriceTitleText.gameObject.SetActive(value: false); PriceTitleSpinner.gameObject.SetActive(value: true); gate = new ParentGate(); gate.OnContinue += onGatePassed; RenewalPanel.SetActive(value: true); if (cPDataEntityCollection.TryGetComponent <SubscriptionData>(cPDataEntityCollection.LocalPlayerHandle, out subscriptionData)) { string subscriptionProductId = subscriptionData.SubscriptionProductId; if (!string.IsNullOrEmpty(subscriptionProductId)) { Product productBySku = Service.Get <CommerceService>().GetProductBySku(subscriptionProductId); if (productBySku != null) { flag = true; productIsRecurring = productBySku.IsRecurring(); text = $"{productBySku.price} {productBySku.currencyCode}"; PriceTitleText.token = "Membership.MembershipTerms.TermsTitle." + productBySku.sku_duration; PriceTitleText.UpdateToken(); if (!subscriptionData.SubscriptionRecurring) { RenewTitleText.token = "Settings.MembershipInfo.FinishedTitle"; RenewTitleText.UpdateToken(); } PriceTitleText.gameObject.SetActive(value: true); PriceTitleSpinner.gameObject.SetActive(value: false); } else { productBySku = Service.Get <CommerceService>().GetProductByVendorSku(subscriptionData.SubscriptionVendor, subscriptionProductId); if (productBySku != null) { flag = true; productIsRecurring = productBySku.IsRecurring(); PriceTitleText.token = "Membership.MembershipTerms.TermsTitle." + productBySku.sku_duration; PriceTitleText.UpdateToken(); if (!subscriptionData.SubscriptionRecurring) { RenewTitleText.token = "Settings.MembershipInfo.FinishedTitle"; RenewTitleText.UpdateToken(); } PriceTitleText.gameObject.SetActive(value: true); PriceTitleSpinner.gameObject.SetActive(value: false); } else if (!Service.Get <CommerceService>().MatchCurrentVendor(subscriptionData.SubscriptionVendor) && subscriptionData.SubscriptionVendor.ToLower() == "csg") { csgProcessor = new CommerceProcessorCSG(); if (csgProcessor != null) { csgProcessor.InitializeStore(); List <Product> allProducts = Service.Get <CommerceService>().GetAllProducts(); foreach (Product item in allProducts) { csgProcessor.AddProduct(item.shared_key, item.gp_store_sku, item.apple_store_sku, item.csg_id, item.sku_duration, item.sku_trial_duration); } CommerceProcessorCSG commerceProcessorCSG = csgProcessor; commerceProcessorCSG.SkuInventoryResponse = (CommerceProcessor.SkuInventoryResponseSend)Delegate.Combine(commerceProcessorCSG.SkuInventoryResponse, new CommerceProcessor.SkuInventoryResponseSend(handleCSGDataLoaded)); csgProcessor.GetSKUDetails(); flag2 = true; } } } } } else { Log.LogError(this, "Could not find SubscriptionData on the local player"); } if (!flag && !flag2) { PriceTitleText.token = "Settings.MembershipInfo.MonthlyCostUnavailableTitle"; PriceTitleText.UpdateToken(); PriceText.gameObject.SetActive(value: false); RenewalPanel.SetActive(value: false); PriceTitleText.gameObject.SetActive(value: true); PriceTitleSpinner.gameObject.SetActive(value: false); } if (cPDataEntityCollection.TryGetComponent <MembershipData>(cPDataEntityCollection.LocalPlayerHandle, out membershipData)) { text2 = membershipData.MembershipExpireDateTime.ToString("d"); } else { Log.LogError(this, "Could not find MembershipData on the local player"); } PriceText.text = text; RenewDateText.text = text2; PriceLegalText.text = getLegalText(productIsRecurring, subscriptionData.SubscriptionRecurring, text); ManageSubscriptionButton.onClick.AddListener(onClicked); }
public virtual void SetPlayer(DataEntityHandle handle) { this.handle = handle; dataEntityCollection = Service.Get <CPDataEntityCollection>(); profileDataListener = dataEntityCollection.When <ProfileData>(handle, onProfileDataAdded); }
public ParticipationCompetitionRules(DataEntityHandle playerHandle, CPDataEntityCollection dataEntityCollection, ParticipationData data) { PlayerHandle = playerHandle; DataEntityCollection = dataEntityCollection; participation = data; }
protected void Start() { CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>(); dataEventListener = cPDataEntityCollection.When <MembershipData>(cPDataEntityCollection.LocalPlayerHandle, onMembershipDataAdded); }
private void Awake() { SceneRefs.SetCelebrationRunner(this); dataEntityCollection = Service.Get <CPDataEntityCollection>(); }
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); }
private DataEntityHandle findPlayerHandle(long sessionId, CPDataEntityCollection dataEntityCollection) { return(dataEntityCollection.FindEntity <SessionIdData, long>(sessionId)); }
public void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); sceneStateListener = dataEntityCollection.When <SceneStateData>("ActiveSceneData", onSceneStateData); }
private void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); savedIglooListener = dataEntityCollection.When <SavedIgloosMetaData>(dataEntityCollection.LocalPlayerHandle, onSavedIgloosAdded); }
private void Awake() { propExperience = GetComponent <PropExperience>(); propExperience.PropExperienceStarted += onExperienceStarted; dataEntityCollection = Service.Get <CPDataEntityCollection>(); }
protected virtual void Awake() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); eventDispatcher = Service.Get <EventDispatcher>(); eventChannel = new EventChannel(eventDispatcher); }
public void SetDataEntityCollection(CPDataEntityCollection dataEntityCollection) { this.dataEntityCollection = dataEntityCollection; }
public TutorialManager() { tutorialDefinitions = Service.Get <IGameData>().Get <Dictionary <int, TutorialDefinition> >(); dataEntityCollection = Service.Get <CPDataEntityCollection>(); }