コード例 #1
0
    private void onPlayerMoved(PositionData positionData, Vector3 newPosition)
    {
        if (positionData == null)
        {
            return;
        }
        positionData.PlayerMoved -= onPlayerMoved;
        if (base.gameObject.IsDestroyed())
        {
            return;
        }
        DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(positionData);

        if (DataEntityHandle.IsNullValue(entityByComponent))
        {
            return;
        }
        GameObjectReferenceData component = dataEntityCollection.GetComponent <GameObjectReferenceData>(entityByComponent);

        if (component != null)
        {
            GameObject gameObject = component.GameObject;
            if (!gameObject.IsDestroyed())
            {
                placeRemotePlayer(gameObject, entityByComponent, newPosition);
            }
        }
    }
コード例 #2
0
        private string getPlayerName(RemotePlayerData remotePlayerData)
        {
            DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(remotePlayerData);

            if (dataEntityCollection.TryGetComponent <DisplayNameData>(entityByComponent, out var component))
            {
                return(component.DisplayName);
            }
            return("Error: name not found");
        }
コード例 #3
0
        protected virtual void onProfileDataUpdated(ProfileData profileData)
        {
            DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(profileData);
            int poolIndexFromHandle            = getPoolIndexFromHandle(entityByComponent);

            if (poolIndexFromHandle >= 0 && pooledScrollRect.IsIndexCellVisible(poolIndexFromHandle))
            {
                string displayName = dataEntityCollection.GetComponent <DisplayNameData>(entityByComponent).DisplayName;
                AbstractPlayerListItem component = pooledScrollRect.GetCellAtIndex(poolIndexFromHandle).GetComponent <AbstractPlayerListItem>();
                bool flag = getIsOnline(entityByComponent) || !ShowPlayerOfflineState;
                component.SetOnlineStatus(flag);
                component.UpdateProfileData(profileData);
                renderPlayer(component, entityByComponent, displayName, flag);
            }
        }
コード例 #4
0
        private void onStatusChanged(PlayerStatusData playerStatusData, string questMascotName)
        {
            DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(playerStatusData);

            if (dataEntityCollection.TryGetComponent <SessionIdData>(entityByComponent, out var sessionId))
            {
                if (mascotNameToIconMap.TryGetValue(questMascotName, out var value))
                {
                    setStatusIcon(sessionId.SessionId, value);
                    return;
                }
                SpriteContentKey questStatusIconContentKey = getQuestStatusIconContentKey(questMascotName);
                if (questStatusIconContentKey != null && !string.IsNullOrEmpty(questStatusIconContentKey.Key))
                {
                    Content.LoadAsync(delegate(string path, Sprite mascotIcon)
                    {
                        onMascotIconLoaded(questMascotName, mascotIcon, sessionId.SessionId);
                    }, questStatusIconContentKey);
                }
                else
                {
                    Log.LogError(this, "Mascot icon content key was null or empty");
                }
            }
            else
            {
                Log.LogError(this, "Could not find a session id for this player status data");
            }
        }
コード例 #5
0
ファイル: PropService.cs プロジェクト: smdx24/CPI-Source-Code
 private void onPlayerRemoved(RemotePlayerData remotePlayerData)
 {
     if (dataEntityCollection != null && userIdToPropUser != null)
     {
         DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(remotePlayerData);
         if (!entityByComponent.IsNull)
         {
             long sessionId = dataEntityCollection.GetComponent <SessionIdData>(entityByComponent).SessionId;
             userIdToPropUser.Remove(sessionId);
         }
         remotePlayerData.PlayerRemoved -= onPlayerRemoved;
     }
 }