Ejemplo n.º 1
0
        void SetupWares()
        {
            int sellX = 0;
            int sellY = 0;

            GUI.Controls.TabbedView tabbie = new GUI.Controls.TabbedView();
            tabbie.Width  = 320;
            tabbie.Height = 160;
            AddControl(tabbie);
            for (int t = 0; t < shop.Selling.Count; t++)
            {
                List <GUI.Control> tab     = new List <GUI.Control>();
                string             tabname = shop.Selling[t].Item1;
                List <Tuple <GameObject.Item, int, int> > tabentry = shop.Selling[t].Item2;
                for (int y = 0; y < ShopHeight; y++)
                {
                    for (int x = 0; x < ShopWidth; x++)
                    {
                        int      index    = y * ShopWidth + x;
                        int      tabindex = t;
                        ItemSlot i;
                        if (index < tabentry.Count)
                        {
                            i          = new ItemSlot(tabentry[index].Item1);
                            i.OnClick += new ClickEventHandler((sender, m) => AddToBasket(tabindex, index, 1));
                        }
                        else
                        {
                            i = new ItemSlot(null);
                        }
                        i.CanGrab = false;
                        i.CanPut  = false;
                        i.X       = x * i.Width + sellX;
                        i.Y       = y * i.Height + sellY;
                        tab.Add(i);
                    }
                }
                tabbie.AddTab(tabname, tab);
            }
            tabbie.SetActiveTab(0);
        }
Ejemplo n.º 2
0
        public StatusWindow(WindowManager WM, GameObject.MapEntities.Actors.Player Player)
        {
            this.Player = Player;
            this.WM     = WM;
            this.Width  = 360;
            this.Height = 500;
            this.Title  = "Status";
            this.HPBar  = new GUI.Controls.ProgressBar
            {
                DisplayLabel = true,
                Style        = 0,
                Height       = 16,
                Width        = 192,
                Colour       = new Color(255, 0, 80),
                X            = 3,
                Y            = 3
            };
            this.AddControl(HPBar);
            this.MPBar = new GUI.Controls.ProgressBar
            {
                DisplayLabel = true,
                Style        = 0,
                Height       = 16,
                Width        = 192,
                Colour       = new Color(25, 150, 255),
                X            = 3,
                Y            = 21
            };
            this.AddControl(MPBar);
            this.EXPBar = new GUI.Controls.ProgressBar
            {
                DisplayLabel = true,
                Style        = 0,
                Height       = 24,
                Width        = 192,
                Colour       = new Color(200, 100, 255),
                X            = 3,
                Y            = 39
            };
            this.AddControl(EXPBar);
            //all these will be moved to a separate GUI testing window someday ;_;


            this.OKButton          = new GUI.Controls.Button("Make something!");
            this.OKButton.Clicked += OKButton_Clicked;
            this.OKButton.Width    = 128;
            this.OKButton.Height   = 48;
            this.OKButton.X        = 0;
            this.OKButton.Y        = 300;
            this.AddControl(this.OKButton);

            this.slot   = new ItemSlot(null);
            this.slot.X = 0;
            this.slot.Y = 49;
            this.slot.Y = 0;
            //  this.Controls.Add(this.slot);

            GUI.Controls.TextBox box = new GUI.Controls.TextBox();
            box.Height = 20;
            box.Width  = 200;
            box.Y      = 100;
            box.Y      = 0;
            // AddControl(box);
            GUI.Controls.NumberBox nbox = new GUI.Controls.NumberBox();
            nbox.Height = 20;
            nbox.Width  = 200;
            nbox.Y      = 130;
            nbox.Y      = 0;
            nbox.Value  = 1204;
            // AddControl(nbox);

            ////
            recipe = new GameObject.ItemLogic.CraftingRecipe();
            GameObject.Item result       = MakeRandomEquip();
            GameObject.Item betterresult = (GameObject.Item)result.Clone();
            betterresult.NameColour = Color.Red;
            GameObject.Item comp  = MakeRandomMat();
            GameObject.Item comp2 = MakeRandomMat();
            comp.SubType  = 1;
            comp2.SubType = 2;
            recipe.Components.Add(new Tuple <GameObject.Item, int>(comp, 1));
            // recipe.Components.Add(new Tuple<GameObject.Item, int>(comp2, 1));
            recipe.Outputs[0] = new List <GameObject.Item>()
            {
                result
            };
            recipe.Outputs[1] = new List <GameObject.Item>()
            {
                betterresult
            };
            recipe.Outputs[2] = new List <GameObject.Item>()
            {
                betterresult
            };

            rs          = new ItemSlot(result);
            rs.X        = 40;
            rs.CanGrab  = false;
            rs.CanPut   = false;
            cs          = new ItemSlot(comp);
            cs.X        = 10;
            cs.Y        = 50;
            cs.CanGrab  = false;
            cs.CanPut   = false;
            cs2         = new ItemSlot(comp2);
            cs2.X       = 60;
            cs2.Y       = 50;
            cs2.CanGrab = false;
            cs2.CanPut  = false;
            GUI.Controls.Button craftb = new GUI.Controls.Button("Craft");
            craftb.Y        = 100;
            craftb.Width    = 150;
            craftb.Height   = 32;
            craftb.OnClick += CraftTest;



            GUI.Controls.TabbedView tabs = new GUI.Controls.TabbedView();
            AddControl(tabs);
            tabs.Width = 200;
            tabs.AddTab("first", new List <Control>()
            {
                slot
            });
            tabs.AddTab("second", new List <Control>()
            {
                cs, cs2, rs, craftb
            });
            tabs.AddTab("thirddd", new List <Control>()
            {
                box
            });
            tabs.Y      = 100;
            tabs.Height = 152;
            tabs.SetActiveTab(0);
            // this.AddControl(Texst);
        }