コード例 #1
0
        public BankLoan(BankLoanSimulation simulation)
        {
            this.HeroId    = simulation.HeroId;
            this.Amount    = simulation.Amount;
            this.Cost      = simulation.Cost;
            this.Payments  = simulation.Payments;
            this.Remaining = simulation.Total;
            this.Date      = (float)Math.Floor(CampaignTime.Now.ToDays);
            this.Duration  = simulation.Duration;
            this.Delay     = simulation.Delay;

            this.Hero.ChangeHeroGold(simulation.Amount);
        }
コード例 #2
0
        /// <summary>
        /// Loan step 4 - Show a text popup to ask for the loan confirmation and process it.
        /// </summary>
        private void AskLoanConfirmation(BankLoanCapacity capacity, int amount, int duration, int delay)
        {
            var simulation = new BankLoanSimulation(Hero.MainHero, amount, delay, duration);

            InformationManager.ShowInquiry(new InquiryData(
                                               titleText: "Are you sure, their is no comming back with us ?",
                                               text: $"You will begin to pay <b>{simulation.Payments * -1}</b><img src=\"Icons\\Coin@2x\"> a day from your account for <b>{simulation.Duration} days</b> in <b>{simulation.Delay} days</b>. " +
                                               $"Borrowing from us {amount}<img src=\"Icons\\Coin@2x\"> will cost you <b>{simulation.Cost}</b><img src=\"Icons\\Coin@2x\"> of bank interests for a total of <b>{simulation.Total}</b><img src=\"Icons\\Coin@2x\"> repaid.\n",
                                               isAffirmativeOptionShown: true,
                                               isNegativeOptionShown: true,
                                               affirmativeText: "Agree",
                                               negativeText: "Refuse",
                                               affirmativeAction: new Action(() =>
            {
                BankAccount.Loans.Add(new BankLoan(simulation));
            }),
                                               negativeAction: new Action(() =>
            {
                this.AskLoanDelay(capacity, amount, duration);
            })
                                               ));
        }