コード例 #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;
        }
コード例 #2
0
 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);
    }
コード例 #4
0
        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} ";
        }
    }
コード例 #6
0
    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);
        }
コード例 #9
0
    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.");
        }
    }
コード例 #10
0
 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));
        }
コード例 #14
0
 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);
 }
コード例 #15
0
        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;
        }
    }
コード例 #18
0
    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);
            }
        }
    }
コード例 #24
0
        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);
        }
コード例 #26
0
    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();
            }
        }
    }
コード例 #27
0
 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();
     }
 }
コード例 #29
0
    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);
            }
        }
    }
コード例 #30
0
        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);
        }