示例#1
0
        private void OnPlayerTargetEntityDatChanged(NetworkEntityGuid entity, EntityDataChangedArgs <ulong> changeArgs)
        {
            NetworkEntityGuid guid = new NetworkEntityGuid(changeArgs.NewValue);

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"Player Target Changed to: {guid}");
            }

            CurrentTarget = guid;

            if (guid == NetworkEntityGuid.Empty)
            {
                //target was cleared.
                if (Logger.IsDebugEnabled)
                {
                    Logger.Debug($"Player cleared target.");
                }

                //TODO: We should register listener events to increase UI performance for untargeted callbacks
            }
            else
            {
                OnPlayerTargetChanged?.Invoke(this, new LocalPlayerTargetChangedEventArgs(guid));

                //We can at least set this active here I guess.
                TargetUnitFrame.SetElementActive(true);
            }
        }
示例#2
0
        private void OnPlayerTargetDisappeared()
        {
            if (Logger.IsDebugEnabled)
            {
                Logger.Debug($"Player Target has disappeared.");
            }

            //Disable it and let everyone know.
            TargetUnitFrame.SetElementActive(false);
            CurrentTarget = NetworkEntityGuid.Empty;

            //We send an empty interaction packet to indicate our target should be cleared.
            //Server doesn't actually know the entity we targeted went out of scope.
            SendService.SendMessage(new ClientInteractNetworkedObjectRequestPayload(NetworkEntityGuid.Empty, ClientInteractNetworkedObjectRequestPayload.InteractType.Selection));
        }