Ejemplo n.º 1
0
        public TradePanel(DwarfGUI gui, GUIComponent parent, Faction faction, Faction otherFaction, List <ResourceAmount> resources)
            : base(gui, parent)
        {
            Resources     = resources;
            GoodsSent     = new List <ResourceAmount>();
            GoodsReceived = new List <ResourceAmount>();
            LocalBounds   = parent.GlobalBounds;
            Faction       = faction;
            OtherFaction  = otherFaction;
            Layout        = new GridLayout(GUI, this, 10, 4);

            SpaceLabel = new Label(GUI, Layout, "Space: " + Faction.ComputeStockpileSpace() + "/" + Faction.ComputeStockpileCapacity(), GUI.DefaultFont)
            {
                ToolTip  = "Space left in our stockpiles",
                WordWrap = true
            };

            Layout.SetComponentPosition(SpaceLabel, 1, 9, 1, 1);

            SpaceLabel.OnUpdate += SpaceLabel_OnUpdate;

            Layout.UpdateSizes();

            CreateSelector();
        }
Ejemplo n.º 2
0
        void buyButton_OnClicked()
        {
            float total = ShoppingCart.ComputeTotal();


            if (!(total > 0))
            {
                Dialog.Popup(GUI, "Nothing to buy!", "Nothing to buy. Select something from the left panel.", Dialog.ButtonType.OK);
                return;
            }
            if (total > Faction.Economy.CurrentMoney)
            {
                Dialog.Popup(GUI, "Not enough money!", "Can't buy that! We don't have enough money (we have only " + Faction.Economy.CurrentMoney.ToString("C") + " in our treasury).", Dialog.ButtonType.OK);
                return;
            }
            else if (Faction.ComputeStockpileSpace() < ShoppingCart.ComputeSpace())
            {
                Dialog.Popup(GUI, "Too many items!", "Can't buy that! We don't have enough inventory space. Build more stockpiles.", Dialog.ButtonType.OK);
                return;
            }

            SoundManager.PlaySound(ContentPaths.Audio.cash);
            Buy();

            ShoppingCart.Items.Clear();
            ShoppingCart.ReCreateItems();
            ShoppingCart.UpdateItems();

            BuyTotal.Text = "Order Total: " + 0.0f.ToString("C");
        }
Ejemplo n.º 3
0
        void buyButton_OnClicked()
        {
            if (Faction.ComputeStockpileSpace() < MyGoods.ComputeSpace() + TheirTrades.ComputeSpace())
            {
                GUI.ToolTipManager.Popup("Not enough stockpile space!");
                return;
            }

            Buy();
        }
Ejemplo n.º 4
0
        void buyButton_OnClicked()
        {
            if (Faction.ComputeStockpileSpace() < MyGoods.ComputeSpace() + TheirTrades.ComputeSpace())
            {
                World.ShowToolPopup("Not enough stockpile space!");
                return;
            }

            Buy();
        }
Ejemplo n.º 5
0
        public GoodsPanel(DwarfGUI gui, GUIComponent parent, Faction faction)
            : base(gui, parent)
        {
            LocalBounds = parent.GlobalBounds;
            Faction     = faction;
            GridLayout layout = new GridLayout(GUI, this, 8, 4);

            Tabs = new TabSelector(GUI, layout, 4)
            {
                WidthSizeMode = SizeMode.Fit
            };


            layout.SetComponentPosition(Tabs, 0, 0, 4, 8);

            TotalMoney = new Label(GUI, layout, "Total Money: " + Faction.Economy.CurrentMoney.ToString("C"), GUI.DefaultFont)
            {
                ToolTip  = "Total amount of money in our treasury",
                WordWrap = true
            };

            TotalMoney.OnUpdate += TotalMoney_OnUpdate;

            layout.SetComponentPosition(TotalMoney, 3, 0, 1, 1);

            SpaceLabel = new Label(GUI, layout, "Space: " + Faction.ComputeStockpileSpace() + "/" + Faction.ComputeStockpileCapacity(), GUI.DefaultFont)
            {
                ToolTip  = "Space left in our stockpiles",
                WordWrap = true
            };

            layout.SetComponentPosition(SpaceLabel, 2, 0, 1, 1);

            SpaceLabel.OnUpdate += SpaceLabel_OnUpdate;

            layout.UpdateSizes();

            CreateBuyTab();
            CreateSellTab();
            Tabs.SetTab("Buy");
        }
Ejemplo n.º 6
0
        public GoodsPanel(DwarfGUI gui, GUIComponent parent, Faction faction)
            : base(gui, parent)
        {
            LocalBounds = parent.GlobalBounds;
            Faction = faction;
            GridLayout layout = new GridLayout(GUI, this, 8, 4);
            Tabs = new TabSelector(GUI, layout, 4)
            {
                WidthSizeMode = SizeMode.Fit
            };

            layout.SetComponentPosition(Tabs, 0, 0, 4, 8);

            TotalMoney = new Label(GUI, layout, "Total Money: " + Faction.Economy.CurrentMoney.ToString("C"), GUI.DefaultFont)
            {
                ToolTip = "Total amount of money in our treasury",
                WordWrap = true
            };

            TotalMoney.OnUpdate += TotalMoney_OnUpdate;

            layout.SetComponentPosition(TotalMoney, 3, 0, 1, 1);

            SpaceLabel = new Label(GUI, layout, "Space: " + Faction.ComputeStockpileSpace() + "/" + Faction.ComputeStockpileCapacity(), GUI.DefaultFont)
            {
                ToolTip = "Space left in our stockpiles",
                WordWrap = true
            };

            layout.SetComponentPosition(SpaceLabel, 2, 0, 1, 1);

            SpaceLabel.OnUpdate += SpaceLabel_OnUpdate;

            layout.UpdateSizes();

            CreateBuyTab();
            CreateSellTab();
            Tabs.SetTab("Buy");
        }
Ejemplo n.º 7
0
 void SpaceLabel_OnUpdate()
 {
     SpaceLabel.Text = "Space: " + Faction.ComputeStockpileSpace() + "/" + Faction.ComputeStockpileCapacity();
 }
Ejemplo n.º 8
0
        public TradePanel(DwarfGUI gui, GUIComponent parent, Faction faction, Faction otherFaction)
            : base(gui, parent)
        {
            GoodsSent = new List<ResourceAmount>();
            GoodsReceived = new List<ResourceAmount>();
            LocalBounds = parent.GlobalBounds;
            Faction = faction;
            OtherFaction = otherFaction;
            Layout = new GridLayout(GUI, this, 10, 4);

            SpaceLabel = new Label(GUI, Layout, "Space: " + Faction.ComputeStockpileSpace() + "/" + Faction.ComputeStockpileCapacity(), GUI.DefaultFont)
            {
                ToolTip = "Space left in our stockpiles",
                WordWrap = true
            };

            Layout.SetComponentPosition(SpaceLabel, 2, 9, 1, 1);

            SpaceLabel.OnUpdate += SpaceLabel_OnUpdate;

            Layout.UpdateSizes();

            CreateSelector();
        }