예제 #1
0
        private IEnumerator applyReceivedQuestStates(QuestServiceEvents.QuestStatesRecieved evt)
        {
            while (!QuestPlayerIsReady)
            {
                yield return(null);
            }
            CPDataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>();

            foreach (QuestState questState in evt.QuestStates)
            {
                if (!questToMascotMap.TryGetValue(questState.questId, out var value))
                {
                    continue;
                }
                QuestDefinition questDefinition = knownQuests[questState.questId];
                if (questDefinition.Prototyped)
                {
                    continue;
                }
                Quest quest = GetQuest(questDefinition, value);
                if (quest == null)
                {
                    continue;
                }
                if (questState.status == QuestStatus.ACTIVE && (ActiveQuest == null || ActiveQuest != quest) && !quest.IsActivating && pendingQuest != quest && quest.Definition.IsPausable)
                {
                    trace(Time.time + ": applyReceivedQuestStates() setting " + quest.Id + " to SUSPENDED");
                    Service.Get <INetworkServicesManager>().QuestService.SetStatus(questState.questId, QuestStatus.SUSPENDED);
                    continue;
                }
                trace(Time.time + ": applyReceivedQuestStates() quest.UpdateState()");
                quest.UpdateState(questState);
                if (quest.State == Quest.QuestState.Suspended)
                {
                    if (!value.ResumableQuests.Contains(quest))
                    {
                        value.ResumableQuests.Add(quest);
                    }
                }
                else if (quest == ActiveQuest && !quest.IsActivating)
                {
                    trace(Time.time + ": applyReceivedQuestStates() calling RestoreAsync()");
                    GameObjectReferenceData component = dataEntityCollection.GetComponent <GameObjectReferenceData>(dataEntityCollection.LocalPlayerHandle);
                    if (component != null)
                    {
                        quest.RestoreAsync(component.GameObject);
                    }
                }
                if (quest.TimesCompleted == 0 && (quest.State == Quest.QuestState.Available || quest.State == Quest.QuestState.Suspended))
                {
                    AdventureReminderTutorial.SetAvailableAdventureTimestamp(value.Name);
                }
            }
            dispatcher.DispatchEvent(default(QuestEvents.QuestSyncCompleted));
            IsQuestDataRecieved = true;
        }
 private void Start()
 {
     addListeners();
     DataEntityHandle[] entitiesByType = dataEntityCollection.GetEntitiesByType <ServerObjectItemData>();
     foreach (DataEntityHandle handle in entitiesByType)
     {
         onMmoItemAdded(handle, dataEntityCollection.GetComponent <ServerObjectItemData>(handle));
     }
     start();
 }
예제 #3
0
    private bool onLocalPlayerReadyToSpawn(PlayerSpawnedEvents.LocalPlayerReadyToSpawn evt)
    {
        eventDispatcher.RemoveListener <PlayerSpawnedEvents.LocalPlayerReadyToSpawn>(onLocalPlayerReadyToSpawn);
        ParticipationData component = dataEntityCollection.GetComponent <ParticipationData>(dataEntityCollection.LocalPlayerHandle);

        if (component != null)
        {
            component.CurrentParticipationState = ParticipationState.Ready;
        }
        createLocalPlayer(LocalPlayerGameObject, evt.Handle);
        Quest activeQuest = Service.Get <QuestService>().ActiveQuest;

        if (activeQuest == null || activeQuest.Definition.name != Service.Get <GameStateController>().FTUEConfig.FtueQuestId)
        {
            Service.Get <EventDispatcher>().DispatchEvent(default(UIDisablerEvents.EnableAllUIElements));
        }
        readyForAvatar();
        return(false);
    }
        private string createLocalKey(string baseKey)
        {
            if (string.IsNullOrEmpty(baseKey))
            {
                return("");
            }
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            return(cPDataEntityCollection.GetComponent <DisplayNameData>(cPDataEntityCollection.LocalPlayerHandle).DisplayName + baseKey);
        }
예제 #5
0
    public void Start()
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        PresenceData           component = cPDataEntityCollection.GetComponent <PresenceData>(cPDataEntityCollection.LocalPlayerHandle);

        if (component != null)
        {
            GetComponent <Text>().text = $"{component.World} ";
        }
    }
    private void Awake()
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        SubscriptionData       component = cPDataEntityCollection.GetComponent <SubscriptionData>(cPDataEntityCollection.LocalPlayerHandle);

        if (component == null || component.SubscriptionVendor == null)
        {
            base.gameObject.SetActive(value: false);
        }
    }
예제 #7
0
    private void Start()
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        PresenceData           component = cPDataEntityCollection.GetComponent <PresenceData>(cPDataEntityCollection.LocalPlayerHandle);

        if (component == null || string.IsNullOrEmpty(component.World))
        {
            base.gameObject.SetActive(value: false);
        }
    }
예제 #8
0
        private string getPlayerName()
        {
            string result = PlayerName;

            if (Application.isPlaying && string.IsNullOrEmpty(PlayerName))
            {
                CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
                result = cPDataEntityCollection.GetComponent <DisplayNameData>(cPDataEntityCollection.LocalPlayerHandle).DisplayName;
            }
            return(result);
        }
    private void getLocalPlayerData()
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

        avatarDetailsData = cPDataEntityCollection.GetComponent <AvatarDetailsData>(localPlayerHandle);
        if (avatarDetailsData == null)
        {
            Log.LogError(this, "Local player handle did not have avatar details data.");
        }
    }
 private bool onLayoutGameObjectsLoaded(SceneTransitionEvents.LayoutGameObjectsLoaded evt)
 {
     SceneLayoutData      = dataEntityCollection.GetComponent <SceneLayoutData>(sceneHandle);
     sceneLayoutContainer = evt.Container;
     if (base.enabled)
     {
         ObjectManipulationInputController.Container = sceneLayoutContainer;
         addObjectManipulators();
     }
     return(false);
 }
예제 #11
0
        public void Execute()
        {
            PlayerOutfit playerOutfit = new PlayerOutfit();

            playerOutfit.parts = outfitToWear;
            Service.Get <INetworkServicesManager>().PlayerStateService.SetOutfit(playerOutfit);
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

            cPDataEntityCollection.GetComponent <AvatarDetailsData>(localPlayerHandle).Outfit = outfitToWearData;
        }
예제 #12
0
        public void Awake()
        {
            buttonClickListener = GetComponent <ButtonClickListener>();
            Transform transform = GetComponentInParent <MainNavStateHandler>().transform;

            mainNavButtons = transform.GetComponentsInChildren <MainNavButton>(includeInactive: true);
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       entityByType           = cPDataEntityCollection.GetEntityByType <MainNavData>();

            mainNavData = cPDataEntityCollection.GetComponent <MainNavData>(entityByType);
            mainNavData.OnCurrentStateChanged += onCurrentStateChanged;
        }
예제 #13
0
        private static ActiveQuestData getSessionPersistentContainer()
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       dataEntityHandle       = cPDataEntityCollection.GetEntityByType <ActiveQuestData>();

            if (dataEntityHandle.IsNull)
            {
                dataEntityHandle = cPDataEntityCollection.AddEntity("ActiveQuestData");
                cPDataEntityCollection.AddComponent <ActiveQuestData>(dataEntityHandle);
            }
            return(cPDataEntityCollection.GetComponent <ActiveQuestData>(dataEntityHandle));
        }
 private bool onLevelUp(RewardServiceEvents.LevelUp evt)
 {
     if (!base.gameObject.IsDestroyed() && avatarDataHandle != null && !avatarDataHandle.Handle.IsNull)
     {
         SessionIdData component = dataEntityCollection.GetComponent <SessionIdData>(avatarDataHandle.Handle);
         if (component != null && evt.SessionId == component.SessionId)
         {
             base.gameObject.AddComponent <LevelUpParticlesRemote>();
         }
     }
     return(false);
 }
        private void onItemRemoved()
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DHeldObject            dHeldObject            = null;

            if (isInvitationLocalPlayer)
            {
                dHeldObject = cPDataEntityCollection.GetComponent <HeldObjectsData>(cPDataEntityCollection.LocalPlayerHandle).HeldObject;
            }
            else
            {
                DataEntityHandle dataEntityHandle = cPDataEntityCollection.FindEntity <SessionIdData, long>(invitingPlayerId);
                if (!dataEntityHandle.IsNull)
                {
                    dHeldObject = Service.Get <CPDataEntityCollection>().GetComponent <HeldObjectsData>(dataEntityHandle).HeldObject;
                }
            }
            if (dHeldObject != null)
            {
                string         text           = "";
                PlayerHeldItem playerHeldItem = ((serverObjectData == null) ? null : (serverObjectData.Item as PlayerHeldItem));
                if (playerHeldItem != null)
                {
                    text = playerHeldItem.Type;
                }
                if (text == dHeldObject.ObjectId)
                {
                    if (isInvitationLocalPlayer)
                    {
                        cPDataEntityCollection.GetComponent <HeldObjectsData>(cPDataEntityCollection.LocalPlayerHandle).HeldObject = null;
                    }
                    else
                    {
                        DataEntityHandle dataEntityHandle = cPDataEntityCollection.FindEntity <SessionIdData, long>(invitingPlayerId);
                        Service.Get <CPDataEntityCollection>().GetComponent <HeldObjectsData>(dataEntityHandle).HeldObject = null;
                    }
                }
            }
            destroySelf();
        }
예제 #16
0
    public bool ConnectToZone(string sceneName, string worldName = null, string onJoinNotificationTag = null)
    {
        ZoneDefinition zoneBySceneName = GetZoneBySceneName(sceneName);

        if (zoneBySceneName == null)
        {
            Log.LogError(this, "Attempting to join a zone that doesn't exist");
            return(false);
        }
        if (!startZoneTransition(sceneName, onJoinNotificationTag))
        {
            return(false);
        }
        PresenceData      component         = dataEntityCollection.GetComponent <PresenceData>(dataEntityCollection.LocalPlayerHandle);
        ContentIdentifier contentIdentifier = generateContentIdentifier();

        if (!string.IsNullOrEmpty(worldName))
        {
            targetWorldToJoin = worldName;
            ZoneId zoneId = new ZoneId();
            zoneId.name = zoneBySceneName.ZoneName;
            Service.Get <INetworkServicesManager>().WorldService.JoinRoomInWorld(new RoomIdentifier(worldName, Service.Get <Localizer>().Language, zoneId, contentIdentifier.ToString()), this);
        }
        else if (component != null && !string.IsNullOrEmpty(component.World))
        {
            targetWorldToJoin = component.World;
            ZoneId zoneId = new ZoneId();
            zoneId.name = zoneBySceneName.ZoneName;
            Service.Get <INetworkServicesManager>().WorldService.JoinRoomInWorld(new RoomIdentifier(component.World, Service.Get <Localizer>().Language, zoneId, contentIdentifier.ToString()), this);
        }
        else
        {
            targetWorldToJoin = null;
            Service.Get <INetworkServicesManager>().WorldService.JoinRoom(zoneBySceneName.ZoneName, contentIdentifier.ToString(), Service.Get <Localizer>().LanguageString, this);
        }
        PreviousZone      = CurrentZone;
        CurrentZone       = zoneBySceneName;
        CurrentInstanceId = "";
        return(IsConnecting);
    }
예제 #17
0
    public void Awake()
    {
        TitleParent.SetActive(value: true);
        CloseButtonParent.SetActive(value: true);
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        DataEntityHandle       entityByType           = cPDataEntityCollection.GetEntityByType <MainNavData>();

        mainNavData   = cPDataEntityCollection.GetComponent <MainNavData>(entityByType);
        layoutElement = GetComponent <LayoutElement>();
        if (layoutElement != null)
        {
            defaultLayoutElementHeight = layoutElement.preferredHeight;
        }
    }
    protected Transform getTransform(long sessionId)
    {
        DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntity <SessionIdData, long>(sessionId);

        if (!dataEntityHandle.IsNull)
        {
            GameObjectReferenceData component = dataEntityCollection.GetComponent <GameObjectReferenceData>(dataEntityHandle);
            if (component != null && component.GameObject != null)
            {
                return(component.GameObject.transform);
            }
        }
        return(null);
    }
예제 #19
0
    private void setupNetworkServiceListeners(long id)
    {
        CPMMOItemId cPMMOItemId = new CPMMOItemId(id, CPMMOItemId.CPMMOItemParent.WORLD);

        if (dataEntityCollection.TryFindEntity <ServerObjectItemData, CPMMOItemId>(cPMMOItemId, out serverObjectHandle))
        {
            serverObjectItemData = dataEntityCollection.GetComponent <ServerObjectItemData>(serverObjectHandle);
            GetComponent <NetworkObjectController>().ItemId = cPMMOItemId;
            serverObjectItemData.ItemChanged += onItemChanged;
            dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.EntityRemovedEvent>(onItemRemoved);
            parseCPMMOItem(serverObjectItemData.Item);
        }
        Service.Get <EventDispatcher>().AddListener <RewardServiceEvents.RewardsEarned>(onRewardsReceived);
    }
예제 #20
0
 public void Start()
 {
     eventDispatcher      = Service.Get <EventDispatcher>();
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
     localPlayerHandle    = dataEntityCollection.LocalPlayerHandle;
     if (!localPlayerHandle.IsNull && dataEntityCollection.HasComponent <PresenceData>(localPlayerHandle))
     {
         dataEntityCollection.GetComponent <HeldObjectsData>(localPlayerHandle).PlayerHeldObjectChanged += onHeldObjectChanged;
     }
     else
     {
         eventDispatcher.AddListener <NetworkControllerEvents.LocalPlayerJoinedRoomEvent>(onLocalPlayerAdded);
     }
 }
예제 #21
0
    private void setPresenceData()
    {
        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.");
        }
    }
예제 #22
0
        public FindFour()
        {
            dataEntityCollection  = Service.Get <CPDataEntityCollection>();
            disablerManager       = Service.Get <UIElementDisablerManager>();
            dispatcher            = Service.Get <EventDispatcher>();
            jsonService           = Service.Get <JsonService>();
            localPlayerSessionId  = dataEntityCollection.LocalPlayerSessionId;
            localPlayerGameObject = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;
            localPlayerParticipationController = localPlayerGameObject.GetComponent <ParticipationController>();
            DataEntityHandle handle = dataEntityCollection.FindEntityByName("ControlsScreenData");

            controlsData = dataEntityCollection.GetComponent <ControlsScreenData>(handle);
            addListeners();
            getDefinitions();
        }
예제 #23
0
    private static void updateMembershipDataValues(bool isAllAccessActive)
    {
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

        DataEntityHandle[] entitiesByType = cPDataEntityCollection.GetEntitiesByType <MembershipData>();
        for (int i = 0; i < entitiesByType.Length; i++)
        {
            MembershipData component = cPDataEntityCollection.GetComponent <MembershipData>(entitiesByType[i]);
            if (component.MembershipType != MembershipType.Member)
            {
                component.IsMember       = isAllAccessActive;
                component.MembershipType = (isAllAccessActive ? MembershipType.AllAccessEventMember : MembershipType.None);
            }
        }
    }
        private void onImageReady(DataEntityHandle handle, Texture2D icon)
        {
            long sessionId = dataEntityCollection.GetComponent <SessionIdData>(handle).SessionId;

            for (int i = 0; i < fullScreenChatBlockDataList.Count; i++)
            {
                if (fullScreenChatBlockDataList[i].SessionId == sessionId && layoutElementPool.IsElementVisible(i))
                {
                    GameObject          elementAtIndex = layoutElementPool.GetElementAtIndex(i);
                    FullScreenChatBlock component      = elementAtIndex.GetComponent <FullScreenChatBlock>();
                    component.SetIcon(icon);
                }
            }
            imageRequests.Dequeue();
        }
예제 #25
0
        private bool shouldPreventPhoneFromOpening()
        {
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       entityByType           = cPDataEntityCollection.GetEntityByType <AllAccessCelebrationData>();

            if (!entityByType.IsNull)
            {
                AllAccessCelebrationData component = cPDataEntityCollection.GetComponent <AllAccessCelebrationData>(entityByType);
                if (component.ShowAllAccessCelebration)
                {
                    return(true);
                }
            }
            return(false);
        }
    protected override void start()
    {
        base.start();
        eventChannel.AddListener <ActionSequencerEvents.ActionSequenceStarted>(onActionSequenceStarted);
        eventChannel.AddListener <ActionSequencerEvents.ActionSequenceCompleted>(onActionSequenceCompleted);
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

        if (!cPDataEntityCollection.LocalPlayerHandle.IsNull)
        {
            ParticipationData component = cPDataEntityCollection.GetComponent <ParticipationData>(cPDataEntityCollection.LocalPlayerHandle);
            if (component != null && ParticipationState.Retained == component.CurrentParticipationState)
            {
                disableAndLockForActionSequence();
            }
        }
    }
 private void Awake()
 {
     mascotNameToIconMap  = new Dictionary <string, Sprite>();
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
     DataEntityHandle[] entitiesByType = dataEntityCollection.GetEntitiesByType <PlayerStatusData>();
     if (entitiesByType.Length > 0)
     {
         for (int i = 0; i < entitiesByType.Length; i++)
         {
             PlayerStatusData component = dataEntityCollection.GetComponent <PlayerStatusData>(entitiesByType[i]);
             onPlayerStatusDataAdded(new DataEntityEvents.ComponentAddedEvent <PlayerStatusData>(entitiesByType[i], component));
         }
     }
     dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <PlayerStatusData> >(onPlayerStatusDataAdded);
     dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentRemovedEvent>(onComponentRemoved);
     PlayerNameController.OnPlayerNameAdded += onPlayerTagAdded;
 }
예제 #28
0
 public void OnJumpToFriendButtonClicked()
 {
     if (!playerCardController.IsShowingJumpPrompt)
     {
         playerCardController.IsShowingJumpPrompt = true;
         CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
         PresenceData           component = cPDataEntityCollection.GetComponent <PresenceData>(cPDataEntityCollection.LocalPlayerHandle);
         if (component.World == playerWorld)
         {
             Service.Get <PromptManager>().ShowPrompt("JumpToFriendPrompt", onJumpToFriendPromptButtonClicked);
             return;
         }
         PromptDefinition promptDefinition = Service.Get <PromptManager>().GetPromptDefinition("JumpToFriendServerPrompt");
         PromptLoaderCMD  promptLoaderCMD  = new PromptLoaderCMD(this, promptDefinition, showJumpToFriendServerPrompt);
         promptLoaderCMD.Execute();
     }
 }
    public void ConnectIfNeeded(DataEntityHandle handle, LocomotionState state)
    {
        if (dataEntityCollection.TryGetComponent(dataEntityCollection.LocalPlayerHandle, out GameObjectReferenceData component) && isInteractingWithZiplineActionGraph(component.GameObject))
        {
            return;
        }
        LocomotionData component2 = dataEntityCollection.GetComponent <LocomotionData>(handle);

        if (!component2.LocomotionStateIsInitialized && state == LocomotionState.Zipline && dataEntityCollection.TryGetComponent(handle, out component))
        {
            GameObject gameObject = component.GameObject;
            if (gameObject != null && !gameObject.IsDestroyed())
            {
                connectPlayerObject(gameObject);
            }
        }
    }
        private void Start()
        {
            interactInWorldIconController = GetComponent <InteractInWorldIconController>();
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
            DataEntityHandle       entityByType           = cPDataEntityCollection.GetEntityByType <ControlsScreenData>();

            controlsScreenData = cPDataEntityCollection.GetComponent <ControlsScreenData>(entityByType);
            interactInWorldIconController.SetEnabled(controlsScreenData.IsControlsScreenActive);
            controlsScreenData.OnControlsScreenActiveChanged += onControlsScreenActiveChanged;
            eventChannel = new EventChannel(Service.Get <EventDispatcher>());
            eventChannel.AddListener <ActionSequencerEvents.ActionSequenceStarted>(onActionSequenceStarted);
            eventChannel.AddListener <ActionSequencerEvents.ActionSequenceCompleted>(onActionSequenceCompleted);
            eventChannel.AddListener <TubeRaceEvents.LocalPlayerJoinedLobby>(onRaceLobbyEntered);
            eventChannel.AddListener <TubeRaceEvents.LocalPlayerLeftLobby>(onRaceLobbyLeft);
            eventChannel.AddListener <RaceGameEvents.Start>(onRaceGameStart);
            eventChannel.AddListener <RaceGameEvents.RaceFinished>(onRaceFinished);
        }