Exemplo n.º 1
0
        private void UserInterfaceOnOnReceiveMessage(BoundUserInterfaceMessage message)
        {
            switch (message)
            {
            case VendingMachineEjectMessage msg:
                TryEject(msg.ID);
                break;

            case InventorySyncRequestMessage msg:
                _userInterface.SendMessage(new VendingMachineInventoryMessage(Inventory));
                break;
            }
        }
        private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
        {
            if (!Powered)
            {
                return;
            }

            var message = serverMsg.Message;

            switch (message)
            {
            case VendingMachineEjectMessage msg:
                TryEject(msg.ID);
                break;

            case InventorySyncRequestMessage msg:
                _userInterface.SendMessage(new VendingMachineInventoryMessage(Inventory));
                break;
            }
        }
        private void UserInterfaceOnOnReceiveMessage(BoundUserInterfaceMessage message)
        {
            switch (message)
            {
            case LatheQueueRecipeMessage msg:
                _prototypeManager.TryIndex(msg.ID, out LatheRecipePrototype recipe);
                if (recipe != null)
                {
                    for (var i = 0; i < msg.Quantity; i++)
                    {
                        Queue.Enqueue(recipe);
                        _userInterface.SendMessage(new LatheFullQueueMessage(GetIDQueue()));
                    }
                }
                break;

            case LatheSyncRequestMessage msg:
                if (!Owner.TryGetComponent(out MaterialStorageComponent storage))
                {
                    return;
                }
                _userInterface.SendMessage(new LatheFullQueueMessage(GetIDQueue()));
                if (_producingRecipe != null)
                {
                    _userInterface.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
                }
                break;
            }
        }
Exemplo n.º 4
0
        private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
        {
            switch (message.Message)
            {
            case LatheQueueRecipeMessage msg:
                _prototypeManager.TryIndex(msg.ID, out LatheRecipePrototype recipe);
                if (recipe != null)
                {
                    for (var i = 0; i < msg.Quantity; i++)
                    {
                        Queue.Enqueue(recipe);
                        _userInterface.SendMessage(new LatheFullQueueMessage(GetIDQueue()));
                    }
                }
                break;

            case LatheSyncRequestMessage msg:
                if (!Owner.TryGetComponent(out MaterialStorageComponent storage))
                {
                    return;
                }
                _userInterface.SendMessage(new LatheFullQueueMessage(GetIDQueue()));
                if (_producingRecipe != null)
                {
                    _userInterface.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
                }
                break;

            case LatheServerSelectionMessage msg:
                if (!Owner.TryGetComponent(out ResearchClientComponent researchClient))
                {
                    return;
                }
                researchClient.OpenUserInterface(message.Session);
                break;

            case LatheServerSyncMessage msg:
                if (!Owner.TryGetComponent(out TechnologyDatabaseComponent database) ||
                    !Owner.TryGetComponent(out ProtolatheDatabaseComponent protoDatabase))
                {
                    return;
                }

                if (database.SyncWithServer())
                {
                    protoDatabase.Sync();
                }

                break;
            }
        }
Exemplo n.º 5
0
        public void Activate(ActivateEventArgs eventArgs)
        {
            if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
            {
                return;
            }

            if (!eventArgs.User.TryGetComponent(out HumanoidAppearanceComponent looks))
            {
                Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't have any hair!"));
                return;
            }

            _userInterface.Open(actor.playerSession);

            var msg = new MagicMirrorInitialDataMessage(looks.Appearance.HairColor, looks.Appearance.FacialHairColor, looks.Appearance.HairStyleName,
                                                        looks.Appearance.FacialHairStyleName);

            _userInterface.SendMessage(msg, actor.playerSession);
        }
 public void UpdateSurgeryUIBodyPartRequest(IPlayerSession session, Dictionary <string, int> options)
 {
     _userInterface.SendMessage(new RequestBodyPartSurgeryUIMessage(options), session);
 }