public ResourceLimitWindow(Vector2 position)
            : base("Resource Limits", false)
        {
            Position = position;
            Dimention = new Vector2(370, 90);

            _beerChooser = new Gui.NumberChooser(Vector2.Zero, 9999, 0);
            AddNumberChooser(_beerChooser, "Beer: ");

            _toolChooser = new NumberChooser(Vector2.Zero, 9999, 0);
            AddNumberChooser(_toolChooser, "Tools: ");

            _clowthChooser = new NumberChooser(Vector2.Zero, 9999, 0);
            AddNumberChooser(_clowthChooser, "Clothes: ");

            _mealChooser = new NumberChooser(Vector2.Zero, 9999, 0);
            AddNumberChooser(_mealChooser, "Meals: ");

            _beerChooser.Number = TaskRequester.PreferedBeers;
            _clowthChooser.Number = TaskRequester.PreferedClowth;
            _toolChooser.Number = TaskRequester.PreferedTools;
            _mealChooser.Number = TaskRequester.PreferedMeals;

            //Components.Add(new SquareDropdown(new Vector2(10, 30), options, "None"));
        }
        private void AddNumberChooser(NumberChooser chooser, string text)
        {
            int x = 10 + (_count % 2) * 180;
            int y = 40 + (_count / 2) * 30;

            AddGuiComponent(new Label(text, new Vector2(x, y)));

            chooser.Position = new Vector2(x+100, y-5);
            AddGuiComponent(chooser);

            _count++;
        }
Beispiel #3
0
        public PriorityBox(string name, GlobalJobType type, Func<NumberChooser, int, bool> validator)
        {
            Type = type;
            Name = name;
            _windowTexture = GameLoop.GlobalContent.Load<Texture2D>("priorityBox");
            _font = GameLoop.GlobalContent.Load<BitmapFont>("Fonts/pressStart2P");
            Priority = 1000000;

            int max = 0;

            if (name == "Mining" || name == "Hauling")
                max = 9999;

            _numberChooser = new NumberChooser(new Vector2(230, 10), max, 0, validator);

            AddGuiComponent(_numberChooser);
        }
Beispiel #4
0
        public TraderMenu(Salesman s, Vector2 position)
            : base("Trader menu", false)
        {
            Position = position;
            _s = s;
            Dimention = new Vector2(500, 300);

            List<TraderItem> traderItems = WorldMap.Instance.GetTraderItems();

            int counter = 0;
            foreach (TraderItem t in traderItems)
            {
                Label l = new Label(NameHelper.GetNameOfWorldObject(t.Type) + ": ",
                    new Vector2(5 + (counter % 3) * 175, 45 + (counter / 3) * 50));
                NumberChooser nc = new NumberChooser(new Vector2(100 + (counter % 3) * 175, 40 + (counter / 3) * 50), t.Amount, 0);

                AddGuiComponent(l);
                AddGuiComponent(nc);

                counter++;
            }
        }
Beispiel #5
0
        private static bool OnPriorityChanged(NumberChooser numberChooser, int newNumber)
        {
            PriorityBox box = null;
            // Find the prioritybox that the numberchooser belongs to
            foreach (PriorityBox p in _priorityBoxes)
            {
                if (p.GetNumberChooser() == numberChooser)
                {
                    box = p;
                }
            }

            if (box.Name == "Mining")
            {
                return MiningJobChanged(box.Name, newNumber, numberChooser.Number);
            }
            else if (box.Name == "Hauling")
            {
                return HaulingJobChanged(box.Name, newNumber, numberChooser.Number);
            }
            else
            {
                return NonMiningHaulingJobChanged(box.Name, newNumber, numberChooser.Number);
            }
        }