Exemplo n.º 1
0
        /// <summary>
        /// Create a copy with the total count from the original inventory (If the original inventory! = Panel)
        /// </summary>
        /// <param name="data"></param>
        private void MoveToEmptyForHotBar(MoveDataAfterExecute data)
        {
            if (data.InputData.ToInventory != _skillInventory.DataInventory)
            {
                return;
            }

            var isMoveInsidePanel = data.InputData.ToInventory == _skillInventory.DataInventory && data.InputData.ToInventory == data.InputData.FromInventory;

            //  get the total number in the source inventory (number remaining + new)
            var id = data.InputData.EntitySource.Id;

            var sumInSourceInventoryLost = DatabaseReadOnly.GetEntitiesWithId(_bagInventory.DataInventory, id).Sum(dataEntity => dataEntity.Amount);
            var sum = isMoveInsidePanel ? sumInSourceInventoryLost :
                      sumInSourceInventoryLost + data.InputData.AmountWantPut;

            data.EntityInNewPosition.AmountMax = sum;
            data.EntityInNewPosition.Amount    = sum;

            if (isMoveInsidePanel)
            {
                // destroy Source
                if (!data.InputData.IsFullStackMove)
                {
                    Commands.Create <RemoveCommand>().EnterData(new RemoveInputData(data.InputData.EntitySource, data.InputData.EntitySource.Amount))
                    .ExecuteTry();
                }
            }
            else
            {
                // return the taken amount to Source
                if (data.InputData.IsFullStackMove)
                {
                    var dataEntityForFromInventory = data.InputData.EntitySource.Copy();
                    dataEntityForFromInventory.Amount = data.InputData.AmountWantPut;
                    var slot = DatabaseReadOnly.GetSlotOrNull(data.InputData.FromInventory, data.InputData.SlotFrom.Vector2Int);
                    Commands.Create <CreateCommand>().EnterData(new CreateInputData(dataEntityForFromInventory, slot)).ExecuteTry();
                }
                else
                {
                    data.InputData.EntitySource.Amount += data.InputData.AmountWantPut;
                }
            }
        }
 protected override void MoveReact(MoveDataAfterExecute data) => ChangeAmountForMove(data.InputData);
 protected override void MoveReact(MoveDataAfterExecute data) => UpdateUi();
Exemplo n.º 4
0
 protected override void MoveReact(MoveDataAfterExecute data)
 {
     BuffDebaf(data.EntityInNewPosition, data.InputData.FromInventory, data.InputData.ToInventory);
 }
Exemplo n.º 5
0
 protected override void MoveReact(MoveDataAfterExecute data)
 {
     MoveToEmptyForHotBar(data);
 }
Exemplo n.º 6
0
 protected virtual void MoveReact(MoveDataAfterExecute data)
 {
 }