コード例 #1
0
        /// <summary>
        /// Перенос предмета между указанными хранилищами.
        /// </summary>
        /// <param name="prop"> Предмет, который будет перенесён. </param>
        /// <param name="sourceStoreType"> Хранилище-источник. </param>
        /// <param name="distStoreType"> Хранилище-назначение. </param>
        public void TransferProp(IProp prop,
                                 PropTransferMachineStore sourceStoreType,
                                 PropTransferMachineStore distStoreType)
        {
            var sourceStore = GetStore(sourceStoreType);

            sourceStore.Remove(prop);

            var distStore = GetStore(distStoreType);

            distStore.Add(prop);
        }
コード例 #2
0
        private IPropStore GetStore(PropTransferMachineStore transferStoreType)
        {
            switch (transferStoreType)
            {
            case PropTransferMachineStore.Inventory:
                return(Inventory);

            case PropTransferMachineStore.Container:
                return(Container);

            default:
                throw new ArgumentException($"Неизвестный тип контейнера для трансфера {transferStoreType}");
            }
        }
コード例 #3
0
 public ContainerModalTransferContextualMenu(
     Point position,
     IPropStore inventoryStore,
     IPropStore containerStore,
     IUiContentStorage uiContentStorage,
     IServiceProvider serviceProvider,
     PropTransferMachineStore sourceStore,
     PropTransferMachineStore targetStore,
     string menuTitle) : base(position, uiContentStorage)
 {
     _inventoryStore  = inventoryStore;
     _containerStore  = containerStore;
     _serviceProvider = serviceProvider;
     _sourceStore     = sourceStore;
     _targetStore     = targetStore;
     _menuTitle       = menuTitle;
 }