Exemplo n.º 1
0
        public bool TransferUnits(PartyCharacterVM troop, PMTransferType transferType)
        {
            try
            {
                if (troop == null || troop.Number == 0)
                {
                    return(true);
                }

                int unitCount = 0;

                switch (transferType)
                {
                case PMTransferType.All:
                    unitCount = troop.Number;
                    break;

                case PMTransferType.Half:
                    unitCount = (int)Math.Round(troop.Number / 2f, MidpointRounding.AwayFromZero);
                    break;

                case PMTransferType.Custom:
                    unitCount = Math.Min(troop.Number, PartyManagerSettings.Settings.CustomShiftTransferCount);
                    break;
                }

                if (unitCount == 0 || unitCount < 0)
                {
                    return(true);
                }

                troop.OnTransfer(troop, -1, unitCount, troop.Side);
                PartyVM.ExecuteRemoveZeroCounts();
                return(false);
            }
            catch (Exception e)
            {
                GenericHelpers.LogException("TransferUnits", e);
            }


            return(true);
        }
Exemplo n.º 2
0
 public void TransferUnit(PartyCharacterVM troop, bool fromLeft)
 {
     troop.OnTransfer(troop, -1, troop.Number,
                      fromLeft ? PartyScreenLogic.PartyRosterSide.Left : PartyScreenLogic.PartyRosterSide.Right);
 }