コード例 #1
0
        private void setAfkProp(PropDefinition propDefinition)
        {
            if (propDefinition == null)
            {
            }
            DHeldObject dHeldObject = new DHeldObject();

            switch (propDefinition.PropType)
            {
            case PropDefinition.PropTypes.Consumable:
                dHeldObject.ObjectType = HeldObjectType.CONSUMABLE;
                break;

            case PropDefinition.PropTypes.Durable:
                dHeldObject.ObjectType = HeldObjectType.DURABLE;
                break;

            case PropDefinition.PropTypes.InteractiveObject:
                dHeldObject.ObjectType = HeldObjectType.DISPENSABLE;
                break;

            case PropDefinition.PropTypes.PartyGame:
                dHeldObject.ObjectType = HeldObjectType.PARTYGAME;
                break;
            }
            dHeldObject.ObjectId = propDefinition.NameOnServer;
            if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle))
            {
                dataEntityCollection.GetComponent <HeldObjectsData>(handle).HeldObject = dHeldObject;
                isUsingAFKProp = true;
            }
        }
コード例 #2
0
 private void clearAfkProp()
 {
     if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle))
     {
         if (presenceData.AFKState.EquippedObject != null)
         {
             DHeldObject dHeldObject = new DHeldObject();
             dHeldObject.ObjectId = presenceData.AFKState.EquippedObject.EquippedObjectId;
             if (presenceData.AFKState.EquippedObject.IsConsumable())
             {
                 dHeldObject.ObjectType = HeldObjectType.CONSUMABLE;
             }
             else if (presenceData.AFKState.EquippedObject.IsDurable())
             {
                 dHeldObject.ObjectType = HeldObjectType.DURABLE;
             }
             else if (presenceData.AFKState.EquippedObject.IsDispensable())
             {
                 dHeldObject.ObjectType = HeldObjectType.DISPENSABLE;
             }
             else if (presenceData.AFKState.EquippedObject.isPartyGame())
             {
                 dHeldObject.ObjectType = HeldObjectType.PARTYGAME;
             }
             dataEntityCollection.GetComponent <HeldObjectsData>(handle).HeldObject = dHeldObject;
         }
         else
         {
             dataEntityCollection.GetComponent <HeldObjectsData>(handle).HeldObject = null;
         }
     }
     isUsingAFKProp = false;
 }
コード例 #3
0
 private bool onLocomotionDataAdded(DataEntityEvents.ComponentAddedEvent <LocomotionData> evt)
 {
     if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle) && evt.Handle == handle)
     {
         dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <LocomotionData> >(onLocomotionDataAdded);
         locomotionData = evt.Component;
         addListeners();
     }
     return(false);
 }
コード例 #4
0
 private bool onAvatarDetailsAdded(DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> evt)
 {
     if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle) && evt.Handle == handle)
     {
         dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> >(onAvatarDetailsAdded);
         avatarDetailsData = evt.Component;
         processAvatarDetails(handle);
     }
     return(false);
 }
コード例 #5
0
        private void setupLocalPlayer()
        {
            DataEntityHandle localPlayerHandle = dataEntityCollection.LocalPlayerHandle;
            AvatarDataHandle avatarDataHandle  = LocalPlayerGameObject.AddComponent <AvatarDataHandle>();

            avatarDataHandle.SetHandle(localPlayerHandle, isLocalPlayer: true);
            GameObjectReferenceData gameObjectReferenceData = dataEntityCollection.AddComponent <GameObjectReferenceData>(localPlayerHandle);

            gameObjectReferenceData.GameObject = LocalPlayerGameObject;
        }
コード例 #6
0
        private void onLODGameObjectGenerated(GameObject remotePlayer, DataEntityHandle remotePlayerHandle, LODRequestData requestData)
        {
            requestData.OnGameObjectGeneratedEvent -= onLODGameObjectGenerated;
            remotePlayer.name = "rp_" + dataEntityCollection.GetComponent <DisplayNameData>(remotePlayerHandle).DisplayName;
            enableRenderers(remotePlayer, enable: false);
            remotePlayer.transform.SetParent(RemotePlayerContainer.transform);
            AvatarDataHandle component = remotePlayer.GetComponent <AvatarDataHandle>();

            component.SetHandle(remotePlayerHandle);
            remotePlayer.GetComponent <LocomotionReceiver>().Init();
        }
コード例 #7
0
 public static bool TryGetPlayerHandle(GameObject owner, out DataEntityHandle handle)
 {
     if (!owner.IsDestroyed())
     {
         AvatarDataHandle component = owner.GetComponent <AvatarDataHandle>();
         if (component != null)
         {
             handle = component.Handle;
             return(!handle.IsNull);
         }
     }
     handle = DataEntityHandle.NullHandle;
     return(false);
 }
コード例 #8
0
 private void Start()
 {
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
     playerDataHandle     = GetComponent <AvatarDataHandle>();
     eventDispatcher      = Service.Get <EventDispatcher>();
     if (!playerDataHandle.Handle.IsNull && dataEntityCollection.HasComponent <LocalPlayerInZoneData>(playerDataHandle.Handle))
     {
         spawnLocalPlayerInZone();
     }
     else
     {
         eventDispatcher.AddListener <PlayerSpawnedEvents.LocalPlayerReadyToSpawn>(onLocalPlayerReadyToSpawn, EventDispatcher.Priority.FIRST);
     }
     eventDispatcher.AddListener <SceneTransitionEvents.TransitionComplete>(onSceneTransitionComplete);
 }
コード例 #9
0
 private void Start()
 {
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
     if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle) && dataEntityCollection.TryGetComponent <PresenceData>(handle, out presenceData))
     {
         presenceData.PresenceDataUpdated += onPresenceDataUpdated;
         if (presenceData.AFKState.Type != 0)
         {
             onPresenceDataUpdated(presenceData);
         }
         presenceData.TemporaryHeadStatusUpdated += onTemporaryHeadStatusUpdated;
         if (presenceData.TemporaryHeadStatusType != 0)
         {
             onTemporaryHeadStatusUpdated(presenceData);
         }
     }
 }
コード例 #10
0
        public void Start()
        {
            ConditionalConfiguration conditionalConfiguration = Service.Get <ConditionalConfiguration>();

            Model.LodLevel = conditionalConfiguration.Get("AvatarSystem.LODLevel.property", 0);
            ZoneLocalPlayerManager zoneLocalPlayerManager = SceneRefs.ZoneLocalPlayerManager;

            isLocal = zoneLocalPlayerManager.LocalPlayerGameObject == base.gameObject;
            if (isLocal ? CombineLocal : CombineRemote)
            {
                base.gameObject.SetActive(value: false);
                AvatarViewCombined avatarViewCombined = base.gameObject.AddComponent <AvatarViewCombined>();
                avatarViewCombined.UseGpuSkinning    = UseGpuSkinning;
                avatarViewCombined.MaxAtlasDimension = conditionalConfiguration.Get("AvatarSystem.MaxAtlasDimension.property", 512);
                base.gameObject.SetActive(value: true);
                avatarView = avatarViewCombined;
            }
            else
            {
                avatarView = base.gameObject.AddComponent <AvatarViewDistinct>();
            }
            if (isLocal)
            {
                zoneLocalPlayerManager.AssignAvatarView(avatarView);
            }
            base.gameObject.AddComponent <PlayerMediator>();
            avatarView.OnBusy  += avatarView_OnBusy;
            avatarView.OnReady += avatarView_OnReady;
            bool flag = true;

            if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle) && dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out avatarDetailsData))
            {
                processAvatarDetails(handle);
                flag = false;
            }
            if (flag)
            {
                dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <AvatarDetailsData> >(onAvatarDetailsAdded);
                Model.ClearAllEquipment();
            }
        }
コード例 #11
0
        private void onAvatarIsReady(AvatarBaseAsync avatarView)
        {
            avatarView.OnReady -= onAvatarIsReady;
            GameObject       gameObject = avatarView.gameObject;
            AvatarDataHandle component  = gameObject.GetComponent <AvatarDataHandle>();

            if (!(component != null) || component.Handle.IsNull || !dataEntityCollection.TryGetComponent <RemotePlayerData>(component.Handle, out var _))
            {
                return;
            }
            DataEntityHandle handle = null;

            if (AvatarDataHandle.TryGetPlayerHandle(gameObject, out handle))
            {
                avatarViewReady.Add(handle);
                PositionData component3 = dataEntityCollection.GetComponent <PositionData>(handle);
                if (component3.Position != Vector3.zero)
                {
                    placeRemotePlayer(gameObject, handle, component3.Position);
                }
            }
            Service.Get <EventDispatcher>().DispatchEvent(new PlayerSpawnedEvents.RemotePlayerSpawned(gameObject, component.Handle));
        }
コード例 #12
0
 private void Start()
 {
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
     avatarView           = GetComponent <AvatarView>();
     if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle))
     {
         if (dataEntityCollection.HasComponent <RemotePlayerData>(handle))
         {
             if (dataEntityCollection.TryGetComponent <LocomotionData>(handle, out locomotionData))
             {
                 addListeners();
             }
             else
             {
                 Log.LogError(this, "Entity missing a LocomotionData component, locomotion state listeners not added");
             }
         }
     }
     else
     {
         dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <LocomotionData> >(onLocomotionDataAdded);
     }
 }
コード例 #13
0
 private void Awake()
 {
     avatarDataHandle     = GetComponent <AvatarDataHandle>();
     eventChannel         = new EventChannel(Service.Get <EventDispatcher>());
     dataEntityCollection = Service.Get <CPDataEntityCollection>();
 }