예제 #1
0
        public override void Create(VisualElement root)
        {
            var tabs = new Tabs();

            var stats = new TabPage("Stats");

            stats.Add(new Slider("Hp"));
            stats.Add(new Slider("Attack"));
            stats.Add(new Slider("Defense"));
            stats.Add(new Slider("Speed"));
            tabs.Add(stats);

            var equipment = new TabPage("Equipment");

            equipment.Add(new TextField("Helmet"));
            equipment.Add(new TextField("Gloves"));
            equipment.Add(new TextField("Sword"));
            equipment.Add(new TextField("Shield"));
            equipment.Add(new TextField("Boots"));
            tabs.Add(equipment);

            var inventory = new TabPage("Inventory");

            inventory.Add(new IntegerField("Money"));
            inventory.Add(new IntegerField("Potions"));
            tabs.Add(inventory);

            root.Add(tabs);
        }
예제 #2
0
        private void PopulatePlayerPage(TabPage tabPage)
        {
            const string playerName = "Unknown Player";

            tabPage.Text = playerName;
            var objectEditor = playerObjectEditors[playerCount - 1] = new ObjectEditor <Player>(ControlManager.Manager, tabPage, saveButton: false, spacing: Margin);

            objectEditor.CreateInterface(typeof(Player));

            var nameControl = objectEditor.GetControl("Name");

            nameControl.TextChanged += (sender, args) => tabPage.Text = (((TextBox)sender).Text);
            nameControl.Text         = playerName;

            var cashControl = objectEditor.GetControl("Cash");

            cashControl.Enabled = false;
            cashControl.Text    = Constants.GameRules.StartingCash.ToString(CultureInfo.InvariantCulture);

            // Add any additional controls!
            var endLocation = objectEditor.SizeY;
            var buttonTest  = new Button(ControlManager.Manager)
            {
                Text = "Moar controls!", Top = endLocation, Left = Margin, Width = 200
            };

            buttonTest.Init();
            tabPage.Add(buttonTest);
            endLocation += buttonTest.Height + Margin;

            tabPage.MinimumHeight = endLocation;
        }
예제 #3
0
        protected void AddPage(string name, TabbedWindowPanel panel)
        {
            TabPage tabPage = this.tabControl.AddPage(name);

            this.SetupTabPanel(ref panel);
            tabPage.Add(panel);
            panel.SetupPanel();
            this.panels.Add(panel);
        }
예제 #4
0
            internal void Load(TabPage TabPage)
            {
                Thread LoadItem = new Thread(delegate()
                {
                    Manager manager = TabPage.Manager;

                    //Add description, now saying "prgLoading..."
                    Label DescriptionLabel = new Label(manager)
                    {
                        Left = 8, Top = 8, Width = 400, Height = 12, TextColor = Color.LightGray, Text = "Loading..."
                    };
                    TabPage.Add(DescriptionLabel);
                    DescriptionLabel.BringToFront();

                    //List of labels for the news items
                    List <Label> TextItems = new List <Label>();

                    //Connect to the feed
                    HttpWebRequest request     = (HttpWebRequest)WebRequest.Create(FeedLink);
                    request.Proxy              = null;
                    XmlReaderSettings settings = new XmlReaderSettings {
                        CloseInput = true
                    };
                    SyndicationFeed feed = null;

                    // 2018: Since we no longer have these pages, just show a placeholder and don't try to load.
                    DescriptionLabel.Text = "Could not load.";
                    return;

                    try
                    {
                        using (XmlReader reader = XmlReader.Create(request.GetResponse().GetResponseStream(), settings))
                        {
                            feed = SyndicationFeed.Load(reader);
                        }
                    }
                    catch (Exception e)
                    {
                        DescriptionLabel.Text = e.Message;
                    }

                    if (feed != null)
                    {
                        //Setup the descripton link
                        DescriptionLabel.Text      = Description;
                        DescriptionLabel.TextColor = Color.LightGray;
                        TomShane.Neoforce.Controls.EventHandler r = new TomShane.Neoforce.Controls.EventHandler(delegate(object o, Controls.EventArgs e)
                        {
                            System.Diagnostics.Process.Start(Link);
                        });
                        DescriptionLabel.MouseOver += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, Controls.MouseEventArgs e)
                        {
                            ((Label)o).TextColor = Color.SkyBlue;
                        });
                        DescriptionLabel.MouseOut += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, Controls.MouseEventArgs e)
                        {
                            ((Label)o).TextColor = Color.LightGray;
                        });
                        DescriptionLabel.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, Controls.EventArgs e)
                        {
                            System.Diagnostics.Process.Start(Link);
                        });
                        DescriptionLabel.Passive = false;

                        int i = 0;
                        //Foreach item, add a new label_TextChanged and set the text/link
                        foreach (SyndicationItem item in feed.Items)
                        {
                            Label ItemLabel = new Label(manager);
                            ItemLabel.Init();
                            ItemLabel.Top       = DescriptionLabel.Top + ((DescriptionLabel.Height + 6) * (i + 1));
                            ItemLabel.Left      = DescriptionLabel.Left;
                            ItemLabel.Width     = DescriptionLabel.Width;
                            ItemLabel.Height    = DescriptionLabel.Height;
                            ItemLabel.Text      = item.Title.Text;
                            ItemLabel.Passive   = false;
                            ItemLabel.TextColor = Color.White;

                            //Add event handlers
                            ItemLabel.MouseOver += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, Controls.MouseEventArgs e)
                            {
                                ((Label)o).TextColor = Color.DeepSkyBlue;
                            });
                            ItemLabel.MouseOut += new TomShane.Neoforce.Controls.MouseEventHandler(delegate(object o, Controls.MouseEventArgs e)
                            {
                                ((Label)o).TextColor = Color.White;
                            });

                            ItemLabel.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, Controls.EventArgs e)
                            {
                                if (manager.Game.IsActive)
                                {
                                    System.Diagnostics.Process.Start(item.Links[0].Uri.ToString());
                                }
                            });

                            ItemLabel.ToolTip.Text = GetToolTip(this, item);

                            TextItems.Add((Label)ItemLabel.Clone());
                            i++;
                            //Max amount of items
                            if (i > 5)
                            {
                                break;
                            }
                        }
                    }
                    //Add each item in the temp list to the tabpage
                    foreach (Label l in TextItems)
                    {
                        TabPage.Add(l);
                        l.BringToFront();
                    }
                });

                LoadItem.Start();
                LoadItem.IsBackground = true;
            }