コード例 #1
0
        private void getFriendsPresenceData()
        {
            worldsWithFriends = new HashSet <string>();
            DataEntityHandle[] entitiesByType = dataEntityCollection.GetEntitiesByType <FriendData>();
            List <string>      list           = new List <string>();

            for (int i = 0; i < entitiesByType.Length; i++)
            {
                if (dataEntityCollection.TryGetComponent <PresenceData>(entitiesByType[i], out var component))
                {
                    component.PresenceDataUpdated += OnPresenceDataUpdated;
                }
                if (dataEntityCollection.TryGetComponent <SwidData>(entitiesByType[i], out var component2))
                {
                    list.Add(component2.Swid);
                }
                else
                {
                    Log.LogError(this, "Friend data handle did not have a SwidData component");
                }
            }
            if (list.Count > 0)
            {
                dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <PresenceData> >(OnPresenceDataAdded);
                Service.Get <INetworkServicesManager>().PlayerStateService.GetOtherPlayerDataBySwids(list);
            }
        }
コード例 #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
ファイル: PropService.cs プロジェクト: smdx24/CPI-Source-Code
 private void loadExistingPlayerHeldExperiences(long playerId)
 {
     DataEntityHandle[] entitiesByType = dataEntityCollection.GetEntitiesByType <ServerObjectItemData>();
     foreach (DataEntityHandle handle in entitiesByType)
     {
         ServerObjectItemData component = dataEntityCollection.GetComponent <ServerObjectItemData>(handle);
         if (component.Item.Id.Parent != 0)
         {
             continue;
         }
         CPMMOItem item = component.Item;
         if (!(item is PlayerHeldItem))
         {
             continue;
         }
         PlayerHeldItem playerHeldItem = (PlayerHeldItem)item;
         if (playerHeldItem.CreatorId != playerId)
         {
             continue;
         }
         DHeldObject dHeldObject = new DHeldObject();
         dHeldObject.ObjectId = playerHeldItem.Type;
         DataEntityHandle dataEntityHandle = ((!dataEntityCollection.IsLocalPlayer(playerId)) ? dataEntityCollection.FindEntity <SessionIdData, long>(playerId) : dataEntityCollection.LocalPlayerHandle);
         if (!dataEntityHandle.IsNull)
         {
             HeldObjectsData  component2 = dataEntityCollection.GetComponent <HeldObjectsData>(dataEntityHandle);
             PrefabContentKey propExperiencePathFromPropId = getPropExperiencePathFromPropId(playerHeldItem.Type);
             if (propExperiencePathFromPropId != null && !string.IsNullOrEmpty(propExperiencePathFromPropId.Key))
             {
                 component2.IsInvitationalExperience = true;
                 CoroutineRunner.Start(loadPlayerHeldExperience(playerHeldItem), this, "loadPlayerHeldExperience");
             }
             component2.HeldObject = dHeldObject;
             if (propExperiencePathFromPropId != null && !string.IsNullOrEmpty(propExperiencePathFromPropId.Key))
             {
                 component2.IsInvitationalExperience = true;
             }
         }
     }
 }
コード例 #4
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);
            }
        }
    }
コード例 #5
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;
 }