private bool onPlayerStatusDataAdded(DataEntityEvents.ComponentAddedEvent <PlayerStatusData> evt)
 {
     if (dataEntityCollection.TryGetComponent <SessionIdData>(evt.Handle, out var _))
     {
         if (evt.Component.QuestMascotName != null)
         {
             onStatusChanged(evt.Component, evt.Component.QuestMascotName);
         }
         evt.Component.OnQuestMascotNameChanged += onStatusChanged;
     }
     return(false);
 }
Ejemplo n.º 2
0
        private List <string> getPlayerSwids()
        {
            List <string> list = new List <string>();

            for (int i = 0; i < allPlayersList.Count; i++)
            {
                if (dataEntityCollection.TryGetComponent <SwidData>(allPlayersList[i], out var component) && !string.IsNullOrEmpty(component.Swid))
                {
                    list.Add(component.Swid);
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
 private void queryForWorlds(LanguageWorldData languageWorldData)
 {
     if (!languageWorldData.WorldsQueried)
     {
         string room = Service.Get <GameStateController>().SceneConfig.DefaultZoneName;
         if (dataEntityCollection.TryGetComponent <PresenceData>(dataEntityCollection.LocalPlayerHandle, out var component) && !string.IsNullOrEmpty(component.Room))
         {
             room = component.Room;
         }
         Service.Get <INetworkServicesManager>().WorldService.GetWorldsWithRoomPopulation(room, languageWorldData.Language.ToString());
         languageWorldData.WorldsQueried = true;
     }
 }
Ejemplo n.º 4
0
    private void Start()
    {
        membershipController = GetComponentInParent <MembershipController>();
        membershipController.OnPurchaseRetried += onPurchaseRetried;
        backgroundButtons  = GetComponentInParent <BackgroundButtonsController>();
        showCarrierBilling = membershipController.IsCarrierBillingAvailable();
        string message = showCarrierBilling ? "with_carrier_billing_info" : "regular";

        Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().MembershipFunnelName, "03", "membership_terms", message);
        PenguinName.text = Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayName;
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

        if (!(SceneManager.GetActiveScene().name == "Boot"))
        {
            avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>();
            AvatarAnimationFrame avatarFrame = new AvatarAnimationFrame("Base Layer.Interactions.PassPortPoses_CelebrateAnimation", 0f);
            if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out AvatarDetailsData component))
            {
                avatarRenderer.RenderAvatar(component, avatarFrame);
            }
            else
            {
                avatarRenderer.RenderAvatar(new DCustomEquipment[0], avatarFrame);
            }
        }
        bool           hasTrialAvailable = true;
        MembershipData component3        = default(MembershipData);

        if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out ProfileData component2) && cPDataEntityCollection.TryGetComponent(localPlayerHandle, out component3))
        {
            if (component2.IsFirstTimePlayer || SceneManager.GetActiveScene().name != Service.Get <GameStateController>().SceneConfig.HomeSceneName)
            {
                ChangePenguinContainer.SetActive(value: false);
            }
            else
            {
                ChangePenguinContainer.SetActive(value: true);
            }
            hasTrialAvailable = component3.MembershipTrialAvailable;
        }
        membershipController.OnProductsReady += onProductsReady;
        membershipController.GetProduct(hasTrialAvailable);
        if (MonoSingleton <NativeAccessibilityManager> .Instance.AccessibilityLevel == NativeAccessibilityLevel.VOICE)
        {
            string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Accessibility.Popup.Title.MembershipTerms");
            MonoSingleton <NativeAccessibilityManager> .Instance.Native.Speak(tokenTranslation);
        }
    }
Ejemplo n.º 5
0
 private void addProfileDataAddedListener(DataEntityHandle localPlayerHandle)
 {
     if (dataEntityCollection.TryGetComponent <ProfileData>(localPlayerHandle, out var component))
     {
         onLocalPlayerProfileDataAdded(component);
     }
     else
     {
         dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ProfileData> >(onProfileDataAdded);
     }
 }
Ejemplo n.º 6
0
        private bool isLocalPenguinSpawned()
        {
            DataEntityHandle localPlayerHandle = dataEntityCollection.LocalPlayerHandle;
            bool             result            = false;

            if (!localPlayerHandle.IsNull && dataEntityCollection.TryGetComponent <GameObjectReferenceData>(localPlayerHandle, out var component) && component.GameObject != null)
            {
                AvatarView component2 = component.GameObject.GetComponent <AvatarView>();
                if (component2 != null && component2.IsReady)
                {
                    result = true;
                }
            }
            return(result);
        }
Ejemplo n.º 7
0
        protected override void startGame()
        {
            hideRemotePlayers();
            loadAudioPrefab(partyGameDefinition);
            changeState(FindFourState.Intro);
            PartyGameUtils.AddParticipationFilter(localPlayerParticipationController);
            PartyGameUtils.AddActionConfirmationFilter(partyGameDefinition);
            PartyGameUtils.DisableMainNavigation();
            PartyGameUtils.DisableLocomotionControls();
            Vector3          position = default(Vector3);
            DataEntityHandle handle   = Service.Get <CPDataEntityCollection>().FindEntity <SessionIdData, long>(base.players[0].UserSessionId);

            if (dataEntityCollection.TryGetComponent <GameObjectReferenceData>(handle, out var component))
            {
                position = component.GameObject.transform.position;
            }
            CoroutineRunner.Start(createBoard(position), this, "CreateFindFourBoard");
            Content.LoadAsync(onHudPrefabLoaded, HUD_UI_PREFAB_KEY);
            dispatcher.AddListener <InputEvents.ActionEvent>(onActionEvent);
            changeControlState(ControlsState.Disabled);
            if (base.players[0].UserSessionId == localPlayerSessionId)
            {
                PartyGameUtils.LogGameStartBi(partyGameDefinition.name, base.players.Count);
                PartyGameUtils.StartBiTimer(partyGameDefinition.name, base.sessionId);
            }
            if (!disablerManager.IsUIElementDisabled("CellphoneButton"))
            {
                PartyGameUtils.DisableCellPhoneButton();
            }
            Service.Get <EventDispatcher>().DispatchEvent(new PartyGameEvents.PartyGameStarted(partyGameDefinition));
            dispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: false));
        }
        public override void Init(DRewardPopupScreen screenData, RewardPopupController popupController)
        {
            this.screenData = (DRewardPopupScreenCoinsXP)screenData;
            popupController.RewardPopupAnimator.SetTrigger("ChestDismiss");
            CoinsText.text = string.Format(Service.Get <Localizer>().GetTokenTranslation("GlobalUI.Notification.Coins"), this.screenData.CoinCount);
            if (this.screenData.CoinCount == 0)
            {
                CoinsGO.SetActive(value: false);
            }
            if (this.screenData.XPCount == 0)
            {
                XPGO.SetActive(value: false);
            }
            else
            {
                CoroutineRunner.Start(loadMascotXPPrefab(this.screenData.mascotName), this, "RewardPopupScreenCoinsXP.loadMascotXPPrefab");
            }
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            if (cPDataEntityCollection.TryGetComponent <MembershipData>(cPDataEntityCollection.LocalPlayerHandle, out var component))
            {
                component.MembershipDataUpdated += onMembershipDataUpdated;
            }
            Service.Get <TrayNotificationManager>().DismissAllNotifications();
            membershipNotificationText = Service.Get <Localizer>().GetTokenTranslation("MemberNotification.RewardScreen.LevelText");
            checkMembershipDisclaimer();
        }
Ejemplo n.º 9
0
    private void Start()
    {
        Service.Get <ICPSwrveService>().Funnel(Service.Get <MembershipService>().AccountFunnelName, "06", "welcome");
        PenguinName.text = Service.Get <SessionManager>().LocalUser.RegistrationProfile.DisplayName;
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

        if (!(SceneManager.GetActiveScene().name == "Boot"))
        {
            avatarRenderer = GetComponentInChildren <AvatarRenderTextureComponent>();
            DataEntityHandle     localPlayerHandle = cPDataEntityCollection.LocalPlayerHandle;
            AvatarAnimationFrame avatarFrame       = new AvatarAnimationFrame("Base Layer.Interactions.PassPortPoses_CelebrateAnimation", 0f);
            if (cPDataEntityCollection.TryGetComponent(localPlayerHandle, out AvatarDetailsData component))
            {
                avatarRenderer.RenderAvatar(component, avatarFrame);
            }
            else
            {
                avatarRenderer.RenderAvatar(new DCustomEquipment[0], avatarFrame);
            }
        }
        AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData();

        accountFlowData.SkipWelcome = true;
        StartCoroutine(AutoTransition());
    }
Ejemplo n.º 10
0
 private void Start()
 {
     dispatcher           = Service.Get <EventDispatcher>();
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
     determineIfLocalPlayer();
     if (isLocalPlayer)
     {
         DataEntityHandle localPlayerHandle = dataEntityCollection.LocalPlayerHandle;
         if (dataEntityCollection.TryGetComponent <AirBubbleData>(localPlayerHandle, out localPlayerAirBubbleData))
         {
             AirSupply = localPlayerAirBubbleData.AirBubble.value;
         }
         else
         {
             localPlayerAirBubbleData = dataEntityCollection.AddComponent <AirBubbleData>(localPlayerHandle);
             AirBubble airBubble = new AirBubble();
             airBubble.value = 10f;
             localPlayerAirBubbleData.AirBubble = airBubble;
         }
         if (isLocalPenguinSpawned())
         {
             initializeDiving();
         }
         else
         {
             dispatcher.AddListener <PlayerSpawnedEvents.LocalPlayerSpawned>(onLocalPlayerSpawned);
         }
     }
     else
     {
         initializeDiving();
     }
 }
Ejemplo n.º 11
0
 public override void OnEnter()
 {
     if (!string.IsNullOrEmpty(Service.Get <QuestService>().CurrentFishingPrize))
     {
         base.Fsm.Event(OkToPlayEvent);
     }
     else
     {
         CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
         if (!cPDataEntityCollection.LocalPlayerHandle.IsNull && cPDataEntityCollection.TryGetComponent <MiniGamePlayCountData>(cPDataEntityCollection.LocalPlayerHandle, out var component))
         {
             if (component.MinigamePlayCounts.ContainsKey(GameId.Value))
             {
                 int num = 10 - component.MinigamePlayCounts[GameId.Value];
                 if (num <= 0)
                 {
                     base.Fsm.Event(OutOfBaitEvent);
                 }
                 else
                 {
                     base.Fsm.Event(OkToPlayEvent);
                 }
             }
             else
             {
                 component.SetMinigamePlayCount(GameId.Value, 0);
                 base.Fsm.Event(OkToPlayEvent);
             }
         }
     }
     Finish();
 }
Ejemplo n.º 12
0
        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 <AvatarDetailsData>(localPlayerHandle, out var component))
                {
                    avatarRenderer.RenderAvatar(component);
                }
                else
                {
                    avatarRenderer.RenderAvatar(new DCustomEquipment[0]);
                }
            }
        }
 public void OnStateChanged(string state)
 {
     if (!(state == HandledState) || !(rootStateMachine != null))
     {
         return;
     }
     if (Service.Get <SessionManager>().HasSession)
     {
         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 ProfileData component))
         {
             throw new MissingReferenceException("No profile data found for local player");
         }
         if (component.IsMigratedPlayer)
         {
             rootStateMachine.SendEvent(LoggedInEvent);
         }
         else
         {
             rootStateMachine.SendEvent(MigrationNeededEvent);
         }
     }
     else
     {
         Service.Get <MembershipService>().LoginViaMembership = false;
         rootStateMachine.SendEvent(NotLoggedInEvent);
     }
 }
Ejemplo n.º 14
0
 private void Start()
 {
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
     if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out DataEntityHandle handle))
     {
         if (dataEntityCollection.TryGetComponent(handle, out ParticipationData component))
         {
             participationData = component;
             ResetParticipation();
             initializePriorityCompetition();
             if (InitializationCompleteAction != null)
             {
                 InitializationCompleteAction();
             }
         }
         else
         {
             dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ParticipationData> >(onParticipationDataReady);
         }
     }
     else
     {
         Log.LogError(this, "Unable to find handle");
     }
 }
        private void Start()
        {
            trayInputButton = GetComponentInParent <TrayInputButton>();
            if (trayInputButton == null)
            {
                Log.LogError(this, "Could not find TrayInputButton in parent");
            }
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            if (cPDataEntityCollection.TryGetComponent <MembershipData>(cPDataEntityCollection.LocalPlayerHandle, out membershipData))
            {
                IsPlayerAMember = membershipData.IsMember;
                IsLocked        = !membershipData.IsMember;
                membershipData.MembershipDataUpdated += onMembershipDataUpdated;
                if (IsLocked)
                {
                    Content.LoadAsync(onMemberLockLoaded, MemberLockContentKey);
                }
            }
            else
            {
                trayInputButton.Lock(TrayInputButton.ButtonState.Disabled);
                Content.LoadAsync(onMemberLockLoaded, MemberLockContentKey);
            }
        }
    public static void ChangePenguinOutfit([NamedToggleValue(typeof(EquipmentNameGenerator), 0u)] int definitionId)
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

        if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out AvatarDetailsData component))
        {
            Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
            TemplateDefinition       templateDefinition     = dictionary[definitionId];
            AvatarDefinition         definitionByName       = Service.Get <AvatarService>().GetDefinitionByName("penguinAvatar");
            EquipmentModelDefinition equipmentDefinition    = definitionByName.GetEquipmentDefinition(templateDefinition.AssetName);
            DCustomEquipment         dCustomEquipment       = default(DCustomEquipment);
            dCustomEquipment.DefinitionId = templateDefinition.Id;
            dCustomEquipment.Name         = equipmentDefinition.Name;
            dCustomEquipment.Id           = 1L + (long)definitionId;
            dCustomEquipment.Parts        = new DCustomEquipmentPart[equipmentDefinition.Parts.Length];
            for (int i = 0; i < equipmentDefinition.Parts.Length; i++)
            {
                dCustomEquipment.Parts[i].SlotIndex = equipmentDefinition.Parts[i].SlotIndex;
                DCustomEquipmentDecal[] decals = new DCustomEquipmentDecal[0];
                dCustomEquipment.Parts[i].Decals = decals;
            }
            component.Outfit = new DCustomEquipment[1]
            {
                dCustomEquipment
            };
        }
    }
 private IEnumerator setScrollRectPersistentPosition()
 {
     if (!dataEntityCollection.TryGetComponent <PersistentIglooUIPositionData>(sceneDataHandle, out persistentPositionData))
     {
         persistentPositionData = dataEntityCollection.AddComponent <PersistentIglooUIPositionData>(sceneDataHandle);
     }
     if (persistentPositionData.ScreenName != base.name)
     {
         persistentPositionData.ScreenName = base.name;
         yield break;
     }
     while (!PooledScrollRect.IsInitialized)
     {
         yield return(null);
     }
     scrollRect.normalizedPosition = persistentPositionData.Position;
 }
Ejemplo n.º 18
0
 private static bool isLocalUser(DataEntityHandle handle, CPDataEntityCollection dataEntityCollection)
 {
     if (dataEntityCollection.TryGetComponent <DisplayNameData>(handle, out var component) && dataEntityCollection.TryGetComponent <DisplayNameData>(dataEntityCollection.LocalPlayerHandle, out var component2) && component.DisplayName == component2.DisplayName)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 19
0
 public bool IsOwnIgloo(ZoneId iglooId)
 {
     if (dataEntityCollection.TryGetComponent <ProfileData>(dataEntityCollection.LocalPlayerHandle, out var component))
     {
         return(component.ZoneId.Equals(iglooId));
     }
     return(false);
 }
Ejemplo n.º 20
0
        public void Start()
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

            if (cPDataEntityCollection.TryGetComponent <CoinsData>(localPlayerHandle, out coinsData))
            {
                setCoins(coinsData.Coins);
                coinsData.OnCoinsChanged += setCoins;
            }
            else
            {
                Log.LogError(this, "Could not find CoinsData on local player handle");
            }
            if (cPDataEntityCollection.TryGetComponent <ProfileData>(localPlayerHandle, out var component))
            {
                AgeText.text = component.PenguinAgeInDays.ToString();
            }
            else
            {
                Log.LogError(this, "Could not find ProfileData on local player handle");
            }
            if (cPDataEntityCollection.TryGetComponent <MembershipData>(localPlayerHandle, out var component2))
            {
                int index = 0;
                switch (component2.MembershipType)
                {
                case MembershipType.Member:
                    index = 1;
                    break;

                case MembershipType.AllAccessEventMember:
                    index = 2;
                    break;
                }
                MembershipSpriteSelector.SelectSprite(index);
                string token = (component2.IsMember ? "MyProfile.MemberStatus.MemberText" : "MyProfile.MemberStatus.NonMemberText");
                MembershipStatusText.text = Service.Get <Localizer>().GetTokenTranslation(token);
            }
            else
            {
                Log.LogError(this, "Could not find MembershipData on local player handle");
            }
        }
Ejemplo n.º 21
0
        private static string getLocalPlayerDisplayName()
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            if (cPDataEntityCollection.TryGetComponent <DisplayNameData>(cPDataEntityCollection.LocalPlayerHandle, out var component))
            {
                return(component.DisplayName);
            }
            return(null);
        }
		private int getMyCoinCount()
		{
			int result = 0;
			CPDataEntityCollection cPDataEntityCollection = Service.Get<CPDataEntityCollection>();
			if (!cPDataEntityCollection.LocalPlayerHandle.IsNull && cPDataEntityCollection.TryGetComponent<CoinsData>(cPDataEntityCollection.LocalPlayerHandle, out var component))
			{
				result = component.Coins;
			}
			return result;
		}
Ejemplo n.º 23
0
 public AccountFlowData GetAccountFlowData()
 {
     CPDataEntityCollection cPDataEntityCollection = Service.Get<CPDataEntityCollection>();
     if (!cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out AccountFlowData component))
     {
         component = cPDataEntityCollection.AddComponent<AccountFlowData>(cPDataEntityCollection.LocalPlayerHandle);
         component.Initialize();
     }
     return component;
 }
    private void getTubeData()
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

        if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out TubeData component))
        {
            tubeData = component;
            component.OnTubeSelected += onSelectedTubeChanged;
        }
    }
Ejemplo n.º 25
0
        private string getCurrentWorldName()
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            if (cPDataEntityCollection.TryGetComponent <PresenceData>(cPDataEntityCollection.LocalPlayerHandle, out var component))
            {
                return(component.World);
            }
            return("");
        }
    private string getCurrentDisplayName()
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

        if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out DisplayNameData component))
        {
            return(component.DisplayName);
        }
        return("");
    }
    private static bool isLocalUser(DataEntityHandle handle, CPDataEntityCollection dataEntityCollection)
    {
        DisplayNameData component2 = default(DisplayNameData);

        if (dataEntityCollection.TryGetComponent(handle, out DisplayNameData component) && dataEntityCollection.TryGetComponent(dataEntityCollection.LocalPlayerHandle, out component2) && component.DisplayName == component2.DisplayName)
        {
            return(true);
        }
        return(false);
    }
 public void OnDestroy()
 {
     isDestroyed = true;
     CoroutineRunner.StopAllForOwner(this);
     Service.Get <EventDispatcher>().RemoveListener <InputEvents.ActionEvent>(onActionEvent);
     Service.Get <EventDispatcher>().RemoveListener <PenguinInteraction.InteractionStartedEvent>(onInteractionStarted);
     Service.Get <EventDispatcher>().RemoveListener <SessionEvents.SessionPausedEvent>(onSessionPaused);
     if (serverObjectData != null)
     {
         serverObjectData.ItemChanged -= onItemChanged;
     }
     if (!serverObjectHandle.IsNull)
     {
         dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.EntityRemovedEvent>(onItemRemoved);
     }
     if (itemObject != null)
     {
         UnityEngine.Object.Destroy(itemObject);
     }
     if (invitingPlayerObject != null)
     {
         stopOfferAnimation();
         invitingPlayerAvatarView.OnReady -= onAvatarViewReady;
     }
     if (isInvitationLocalPlayer && !dataEntityCollection.LocalPlayerHandle.IsNull)
     {
         ParticipationData component = dataEntityCollection.GetComponent <ParticipationData>(dataEntityCollection.LocalPlayerHandle);
         if (component != null)
         {
             component.IsInteractButtonAvailable = true;
         }
         if (propExperience.PropDef.PropType != 0 || propExperience.PropDef.ExperienceType != PropDefinition.ConsumableExperience.PartyGameLobby)
         {
             Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.EnableUIElement("ConsumablesButton"));
         }
         if (dataEntityCollection.TryGetComponent <GameObjectReferenceData>(dataEntityCollection.LocalPlayerHandle, out var component2) && component2.GameObject != null)
         {
             LocomotionHelper.GetCurrentController(component2.GameObject).LoadControlsLayout();
         }
     }
     Service.Get <EventDispatcher>().DispatchEvent(new PlayerIndicatorEvents.RemovePlayerIndicator(invitingPlayerId, isStored));
 }
    private int getCoinCount()
    {
        int result = 0;

        dataEntityCollection = Service.Get <CPDataEntityCollection>();
        if (!dataEntityCollection.LocalPlayerHandle.IsNull && dataEntityCollection.TryGetComponent(dataEntityCollection.LocalPlayerHandle, out CoinsData component))
        {
            result = component.Coins;
        }
        return(result);
    }
Ejemplo n.º 30
0
 private bool onInvalidSubscriptionError(NetworkErrors.InvalidSubscriptionError evt)
 {
     CPDataEntityCollection cPDataEntityCollection = Service.Get<CPDataEntityCollection>();
     if (cPDataEntityCollection.TryGetComponent(cPDataEntityCollection.LocalPlayerHandle, out MembershipData component))
     {
         component.IsMember = false;
         component.MembershipType = MembershipType.None;
         return false;
     }
     throw new MissingReferenceException("No membership data found for local player");
 }