private void PutIdInHand(ContainerSlot container, IHandsComponent hands)
        {
            var idEntity = container.ContainedEntity;

            if (idEntity == null || !container.Remove(idEntity))
            {
                return;
            }
            UpdateUserInterface();

            hands.PutInHand(idEntity.GetComponent <ItemComponent>());
        }
示例#2
0
        private void InsertIdFromHand(IEntity user, ContainerSlot container, IHandsComponent hands)
        {
            var isId = hands.GetActiveHand?.Owner.HasComponent <IdCardComponent>();

            if (isId != true)
            {
                return;
            }
            if (!hands.Drop(hands.ActiveIndex, container))
            {
                _notifyManager.PopupMessage(Owner.Transform.GridPosition, user, _localizationManager.GetString("You can't let go of the ID card!"));
                return;
            }
            UpdateUserInterface();
        }
        /// <summary>
        /// Gets the hands component controling this gui, returns true if successful and false if failure
        /// </summary>
        /// <param name="hands"></param>
        /// <returns></returns>
        private bool TryGetHands(out IHandsComponent hands)
        {
            hands = null;
            if (_playerManager?.LocalPlayer == null)
            {
                return(false);
            }

            IEntity entity = _playerManager.LocalPlayer.ControlledEntity;

            if (entity == null || !entity.TryGetComponent(out hands))
            {
                return(false);
            }

            return(true);
        }
        private void InsertIdFromHand(IEntity user, ContainerSlot container, IHandsComponent hands)
        {
            var isId = hands.GetActiveHand?.Owner.HasComponent <IdCardComponent>();

            if (isId != true)
            {
                return;
            }

            if (hands.ActiveHand == null)
            {
                return;
            }

            if (!hands.Drop(hands.ActiveHand, container))
            {
                Owner.PopupMessage(user, Loc.GetString("You can't let go of the ID card!"));
                return;
            }
            UpdateUserInterface();
        }