public CalculateOrderCommand(string[] parameters)
        {
            base.Parameters = parameters;

            //TODO: inject these dependencies
            _taxationService = new TaxationService();

            string csvFile = base.Parameters[0];

            _productItemRepository = ProductItemRepositoryFactory.CreateInstance(csvFile);
        }
Exemple #2
0
        public EconomyPage(UIFramework ui, Texture2D texture, string Hovertext, TaxationService taxation) : base(ui, texture, Hovertext)
        {
            this.taxation = taxation;
            //Elements.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11233")));
            //Elements.Add(new ContentElementText(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11234")));
            Elements.Add(new ContentElementHeaderText(Util.Helper.Translation.Get("BalanceReportText")));
            Elements.Add(new ContentElementText(() => $"{Util.Helper.Translation.Get("CurrentLotValueText")}: {taxation.LotValue.Sum}g"));
            Elements.Add(new ContentElementText(() => $"{Util.Helper.Translation.Get("CurrentTaxBalance")}: {taxation.State?.PendingTaxAmount}g"));

            TaxSchedule     scheduledTask = null;
            CustomWorldDate date          = null;

            load();
            void load()
            {
                scheduledTask = taxation.State?.ScheduledTax.OrderBy(c => c.DayCount).FirstOrDefault(c => !c.Paid);
                date          = scheduledTask?.DayCount.ToWorldDate();
            };

            Elements.Add(new ContentElementText(() =>
            {
                load();

                return(scheduledTask != null ? Util.Helper.Translation.Get("NextScheduledTaxText") : Util.Helper.Translation.Get("NoBillsForYouText"));
            }));
            Elements.Add(new ContentElementText(() =>
            {
                return(scheduledTask != null ? $"{Game1.content.LoadString("Strings\\StringsFromCSFiles:Utility.cs.5678", date.DayOfMonth, (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.es) ? date.Season.GetLocalizedSeason().ToLower() : date.Season.GetLocalizedSeason(), date.Year)} - {scheduledTask.Sum}g" : "");
            }));


            payButton = new ClickableComponent(new Rectangle(xPositionOnScreen + 64, Game1.activeClickableMenu.height + 50, (int)Game1.dialogueFont.MeasureString("_____________").X, 96), "", "_____________");

            for (int i = 0; i < Elements.Count; ++i)
            {
                Slots.Add(new ClickableComponent(
                              new Rectangle(
                                  xPositionOnScreen + Game1.tileSize / 4,
                                  yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + i * (height - Game1.tileSize * 2) / 7,
                                  width - Game1.tileSize / 2,
                                  (height - Game1.tileSize * 2) / 7 + Game1.pixelZoom),
                              i.ToString()));
            }

            this.Draw             = DrawContent;
            this.DrawHover        = DrawHoverContent;
            this.LeftClickAction += Leftclick;
        }
Exemple #3
0
        public MessageBroadcastService(TaxationService taxation)
        {
            this.taxation = taxation;

            Util.Helper.Events.Multiplayer.ModMessageReceived += Multiplayer_ModMessageReceived;

            this.taxation.OnPayTaxesCompleted      += Taxation_OnPayTaxesCompleted;
            this.taxation.OnPostPoneTaxesCompleted += Taxation_OnPostPoneTaxesCompleted;


            this.broadcastActions = new Dictionary <BroadcastType, Action <BroadcastMessage> >()
            {
                { BroadcastType.Taxation_Paid, PaidTaxes },
                { BroadcastType.Taxation_Postpone, PostPone },
            };
        }
Exemple #4
0
        public LoanPage(UIFramework ui, TaxationService taxation) : base(ui)
        {
            LoanButton = new ClickableComponent(InterfaceHelper.GetButtonSizeForPage(this), "", "_____________");

            for (int i = 0; i < 7; ++i)
            {
                Slots.Add(new ClickableComponent(
                              new Rectangle(
                                  xPositionOnScreen + Game1.tileSize / 4,
                                  yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + i * (height - Game1.tileSize * 2) / 7,
                                  width - Game1.tileSize / 2,
                                  (height - Game1.tileSize * 2) / 7 + Game1.pixelZoom),
                              i.ToString()));
            }

            Draw = () =>
            {
                int currentItemIndex = 0;


                for (int i = 0; i < Slots.Count; ++i)
                {
                    InterfaceHelper.Draw(Slots[i].bounds);
                    if (currentItemIndex >= 0 &&
                        currentItemIndex + i < Elements.Count)
                    {
                        Elements[currentItemIndex + i].draw(Game1.spriteBatch, Slots[i].bounds.X, Slots[i].bounds.Y);
                    }
                }

                if (taxation.State.PendingTaxAmount != 0)
                {
                    IClickableMenu.drawTextureBox(Game1.spriteBatch, Game1.mouseCursors, new Rectangle(432, 439, 9, 9), LoanButton.bounds.X, LoanButton.bounds.Y, LoanButton.bounds.Width, LoanButton.bounds.Height, (LoanButton.scale > 0f) ? Color.Wheat : Color.White, 4f);
                    var btnPosition = new Vector2(LoanButton.bounds.Center.X, LoanButton.bounds.Center.Y + 4) - Game1.dialogueFont.MeasureString("Loan Funds - Pelican Town 10000g") / 2f;
                    Utility.drawTextWithShadow(Game1.spriteBatch, "Loan Funds - Pelican Town 10000g", Game1.dialogueFont, btnPosition, Game1.textColor, 1f, -1f, -1, -1, 0f);

                    InterfaceHelper.Draw(LoanButton.bounds, center: true);
                    InterfaceHelper.Draw(btnPosition, InterfaceHelper.InterfaceHelperType.Red);
                }
            };
            ui.OnLeftClick += Leftclick;
        }