Example #1
0
        public void initializeLabels()
        {
            attributeLabels = new List <G2DLabel>();
            labelPanels     = new List <G2DPanel>();
            G2DLabel thisLabel;
            G2DPanel thisPanel;

            for (int i = 0; i < 8; i++)
            {
                thisLabel                  = new G2DLabel("Attribute Label " + i);
                thisLabel.TextFont         = uiFont;
                thisLabel.TextColor        = Color.Black;
                thisLabel.Visible          = true;
                thisLabel.TextTransparency = 1.0f;
                attributeLabels.Add(thisLabel);

                thisPanel              = new G2DPanel();
                thisPanel.Border       = GoblinEnums.BorderFactory.LineBorder;
                thisPanel.Transparency = 0.7f;
                labelPanels.Add(thisPanel);
                scene.UIRenderer.Add2DComponent(labelPanels[i]);
                labelPanels[i].AddChild(attributeLabels[i]);
            }

            // Create the main panel which holds all other GUI components

            /*frame = new G2DPanel();
             * frame.Bounds = new Rectangle(615, 350, 170, 110);
             * frame.Border = GoblinEnums.BorderFactory.LineBorder;*/
        }
Example #2
0
        private void CreateObject()
        {
            G2DPanel frame = new G2DPanel();

            frame.Bounds          = new Rectangle(0, 0, 800, 600);
            frame.Border          = GoblinEnums.BorderFactory.LineBorder;
            frame.Transparency    = 1.0f; // Ranges from 0 (fully transparent) to 1 (fully opaque)
            frame.BackgroundColor = Color.Black;

            SpriteFont textBoxFont = Content.Load <SpriteFont>("TextBoxFont");
            SpriteFont textFont    = Content.Load <SpriteFont>("TextFont");



            G2DLabel label = new G2DLabel();

            label.TextFont  = textFont;
            label.TextColor = Color.Yellow;
            label.Bounds    = new Rectangle(10, 100, 780, 200);
            label.Text      = "Type Target ID and Press Enter";

            textF           = new G2DTextField();
            textF.TextFont  = textBoxFont;
            textF.TextColor = Color.Black;
            textF.Bounds    = new Rectangle(10, 200, 780, 200);
            textF.Editable  = false;
            textF.Text      = "";


            frame.AddChild(label);
            frame.AddChild(textF);
            scene.UIRenderer.Add2DComponent(frame);
        }
Example #3
0
            public PlayTimeSlider(G2DLabel tooltip)
                : base()
            {
                this.tooltip = tooltip;
                showTooltip  = false;
                value        = 0;
                snapToTicks  = false;

                tooltip.DrawBorder     = true;
                tooltip.DrawBackground = true;
            }
Example #4
0
        protected virtual void Initialize()
        {
            tooltipLabel   = new G2DLabel();
            controlButton  = new G2DButton();
            playTimeSlider = new PlayTimeSlider(tooltipLabel);
            playTimeLabel  = new G2DLabel();

            tooltipLabel.Visible      = false;
            playTimeLabel.DrawBorder  = true;
            playTimeSlider.DrawBorder = true;

            playTimeLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;
            playTimeLabel.VerticalAlignment   = GoblinEnums.VerticalAlignment.Center;

            tooltipLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;
            tooltipLabel.VerticalAlignment   = GoblinEnums.VerticalAlignment.Center;
            tooltipLabel.Visible             = false;

            controlButton.ActionPerformedEvent += new ActionPerformed(HandleControlButtonPress);

            playTimeSlider.StateChangedEvent += new StateChanged(HandleSliderMove);

            playTimeSlider.Maximum = (int)(duration / 1000);

            durationStr = "0:00";
            positionStr = "0:00";

            UpdateDurationString();

            playing       = false;
            loop          = false;
            allowNegative = false;
            curPosition   = 0;
            startPosition = 0;

            name = "G2DMediaControl";
        }
Example #5
0
        public void Initialize(Scene scene, ActionPerformed gameListener, ActionPerformed modeListener)
        {
            // Create the main panel which holds all other GUI components
            frame                  = new G2DPanel();
            frame.Bounds           = new Rectangle(30, 305, 480, 280);
            frame.Border           = GoblinEnums.BorderFactory.LineBorder;
            frame.Transparency     = 0.7f; // Ranges from 0 (fully transparent) to 1 (fully opaque)
            frame.TextTransparency = 1.0f;

            uiFont = State.Content.Load <SpriteFont>("UIFont");

            G2DLabel gameLabel = new G2DLabel("Game Mode:");

            gameLabel.TextFont = uiFont;
            gameLabel.Bounds   = new Rectangle(4, 4, 100, 48);

            // Create radio buttons for selecting the game mode
            gameAdd          = new G2DRadioButton("Add");
            gameAdd.TextFont = uiFont;
            gameAdd.Bounds   = new Rectangle(18, 70, 150, 50);
            // Make the Addition mode as the selected one first
            gameAdd.DoClick();

            gameEdit          = new G2DRadioButton("Edit");
            gameEdit.TextFont = uiFont;
            gameEdit.Bounds   = new Rectangle(170, 70, 150, 50);

            gamePlay          = new G2DRadioButton("Play");
            gamePlay.TextFont = uiFont;
            gamePlay.Bounds   = new Rectangle(310, 70, 150, 50);

            ButtonGroup gameGroup = new ButtonGroup();

            gameGroup.Add(gameAdd);
            gameGroup.Add(gameEdit);
            gameGroup.Add(gamePlay);
            gameGroup.AddActionPerformedHandler(gameListener);

            frame.AddChild(gameLabel);
            frame.AddChild(gameAdd);
            frame.AddChild(gameEdit);
            frame.AddChild(gamePlay);

            G2DSeparator separator1 = new G2DSeparator();

            separator1.Bounds = new Rectangle(5, 129, 470, 5);

            frame.AddChild(separator1);

            modeLabel          = new G2DLabel("Add Mode:");
            modeLabel.TextFont = uiFont;
            modeLabel.Bounds   = new Rectangle(4, 140, 100, 48);

            modeRadio1          = new G2DRadioButton("Single");
            modeRadio1.TextFont = uiFont;
            modeRadio1.Bounds   = new Rectangle(20, 206, 200, 50);
            modeRadio1.DoClick();

            modeRadio2          = new G2DRadioButton("Line");
            modeRadio2.TextFont = uiFont;
            modeRadio2.Bounds   = new Rectangle(220, 206, 250, 50);

            ButtonGroup addGroup = new ButtonGroup();

            addGroup.Add(modeRadio1);
            addGroup.Add(modeRadio2);
            addGroup.AddActionPerformedHandler(modeListener);

            frame.AddChild(modeLabel);
            frame.AddChild(modeRadio1);
            frame.AddChild(modeRadio2);

            // Initially, make the GUI panel invisible
            frame.Visible = false;
            frame.Enabled = false;

            scene.UIRenderer.Add2DComponent(frame);
        }
Example #6
0
        public void createBuilding2DGUI()
        {
            markerLabels = new List <G2DLabel>();


            // Create the main panel which holds all other GUI components
            buildingInfoPanel        = new G2DPanel();
            buildingInfoPanel.Bounds = new Rectangle(530, 5, 265, 475);
            //frame.Bounds = new Rectangle(615, 350, 170, 220);
            buildingInfoPanel.Border       = GoblinEnums.BorderFactory.LineBorder;
            buildingInfoPanel.Transparency = 0.4f;  // Ranges from 0 (fully transparent) to 1 (fully opaque)

            nameLabel          = new G2DLabel("Name");
            nameLabel.TextFont = uiFont;
            nameLabel.Bounds   = new Rectangle(25, 5, 230, 20);
            nameLabel.Text     = "Name:";
            nameLabel.Visible  = true;

            nameField          = new G2DTextField("Enter text here", 200);
            nameField.TextFont = uiFont;
            nameField.Text     = "Enter text here";
            nameField.SelectAll();
            nameField.Enabled  = false;
            nameField.Editable = false;
            nameField.Bounds   = new Rectangle(25, 25, 230, 20);
            nameField.Visible  = true;
            nameField.setFocused(false);

            addressLabel          = new G2DLabel("Address:");
            addressLabel.TextFont = uiFont;
            addressLabel.Bounds   = new Rectangle(25, 45, 230, 20);
            addressLabel.Text     = "Address:";
            addressLabel.Visible  = true;

            addressField          = new G2DTextField("Enter text here", 200);
            addressField.TextFont = uiFont;
            addressField.Text     = "Enter text here";
            addressField.SelectAll();
            addressField.Enabled  = false;
            addressField.Editable = false;
            addressField.Bounds   = new Rectangle(25, 65, 230, 20);
            addressField.Visible  = true;
            addressField.setFocused(false);

            storiesLabel          = new G2DLabel("Number of Stories:");
            storiesLabel.TextFont = uiFont;
            storiesLabel.Bounds   = new Rectangle(25, 85, 230, 20);
            storiesLabel.Text     = "Number of Stories:";
            storiesLabel.Visible  = true;

            storiesField          = new G2DTextField("Enter text here", 200);
            storiesField.TextFont = uiFont;
            storiesField.Text     = "Enter text here";
            storiesField.SelectAll();
            storiesField.Enabled  = false;
            storiesField.Editable = false;
            storiesField.Bounds   = new Rectangle(25, 105, 230, 20);
            storiesField.Visible  = true;
            storiesField.setFocused(false);

            toxicSitesLabel          = new G2DLabel("Toxic Site Report:");
            toxicSitesLabel.TextFont = uiFont;
            toxicSitesLabel.Bounds   = new Rectangle(25, 125, 230, 20);
            toxicSitesLabel.Text     = "Toxic Site Report:";
            toxicSitesLabel.Visible  = true;

            toxicSitesField          = new G2DTextField("Enter text here", 200);
            toxicSitesField.TextFont = uiFont;
            toxicSitesField.Text     = "Enter text here";
            toxicSitesField.SelectAll();
            toxicSitesField.Enabled  = false;
            toxicSitesField.Editable = false;
            toxicSitesField.Bounds   = new Rectangle(25, 145, 230, 20);
            toxicSitesField.Visible  = true;
            toxicSitesField.setFocused(false);

            airRightsLabel          = new G2DLabel("Air Rights Information:");
            airRightsLabel.TextFont = uiFont;
            airRightsLabel.Bounds   = new Rectangle(25, 165, 230, 20);
            airRightsLabel.Text     = "Air Rights Information:";
            airRightsLabel.Visible  = true;

            airRightsField          = new G2DTextField("Enter text here", 200);
            airRightsField.TextFont = uiFont;
            airRightsField.Text     = "Enter text here";
            airRightsField.SelectAll();
            airRightsField.Enabled  = false;
            airRightsField.Editable = false;
            airRightsField.Bounds   = new Rectangle(25, 185, 230, 20);
            airRightsField.Visible  = true;
            airRightsField.setFocused(false);

            yearBuiltLabel          = new G2DLabel("Year Constructed:");
            yearBuiltLabel.TextFont = uiFont;
            yearBuiltLabel.Bounds   = new Rectangle(25, 205, 230, 20);
            yearBuiltLabel.Text     = "Year Constructed:";
            yearBuiltLabel.Visible  = true;

            yearBuiltField          = new G2DTextField("Enter text here", 200);
            yearBuiltField.TextFont = uiFont;
            yearBuiltField.Text     = "Enter text here";
            yearBuiltField.SelectAll();
            yearBuiltField.Enabled  = false;
            yearBuiltField.Editable = false;
            yearBuiltField.Bounds   = new Rectangle(25, 225, 230, 20);
            yearBuiltField.Visible  = true;
            yearBuiltField.setFocused(false);

            typeLabel          = new G2DLabel("Zone Type:");
            typeLabel.TextFont = uiFont;
            typeLabel.Bounds   = new Rectangle(25, 245, 230, 20);
            typeLabel.Text     = "Zone Type:";
            typeLabel.Visible  = true;

            typeField          = new G2DTextField("Enter text here", 200);
            typeField.TextFont = uiFont;
            typeField.Text     = "Enter text here";
            typeField.SelectAll();
            typeField.Enabled  = false;
            typeField.Editable = false;
            typeField.Bounds   = new Rectangle(25, 265, 230, 20);
            typeField.Visible  = true;
            typeField.setFocused(false);

            classLabel          = new G2DLabel("Building Class:");
            classLabel.TextFont = uiFont;
            classLabel.Bounds   = new Rectangle(25, 285, 230, 20);
            classLabel.Text     = "Building Class:";
            classLabel.Visible  = true;

            classField          = new G2DTextField("Enter text here", 200);
            classField.TextFont = uiFont;
            classField.Text     = "Enter text here";
            classField.SelectAll();
            classField.Enabled  = false;
            classField.Editable = false;
            classField.Bounds   = new Rectangle(25, 305, 230, 20);
            classField.Visible  = true;
            classField.setFocused(false);

            saleDateLabel          = new G2DLabel("Sale Date:");
            saleDateLabel.TextFont = uiFont;
            saleDateLabel.Bounds   = new Rectangle(25, 325, 230, 20);
            saleDateLabel.Text     = "Sale Date:";
            saleDateLabel.Visible  = true;

            saleDateField          = new G2DTextField("Enter text here", 200);
            saleDateField.TextFont = uiFont;
            saleDateField.Text     = "Enter text here";
            saleDateField.SelectAll();
            saleDateField.Enabled  = false;
            saleDateField.Editable = false;
            saleDateField.Bounds   = new Rectangle(25, 345, 230, 20);
            saleDateField.Visible  = true;
            saleDateField.setFocused(false);

            descriptionLabel          = new G2DLabel("Notes:");
            descriptionLabel.TextFont = uiFont;
            descriptionLabel.Bounds   = new Rectangle(25, 365, 230, 20);
            descriptionLabel.Text     = "Notes:";
            descriptionLabel.Visible  = true;

            descriptionField          = new G2DTextField("Enter text here", 200);
            descriptionField.TextFont = uiFont;
            descriptionField.Text     = "Enter text here";
            descriptionField.SelectAll();
            descriptionField.Enabled  = false;
            descriptionField.Editable = false;
            descriptionField.Bounds   = new Rectangle(25, 385, 230, 80);
            descriptionField.Visible  = true;
            descriptionField.setFocused(false);



            /*G2DTextField buildingInfoField = new G2DTextField("Enter text here", 200);
             * buildingInfoField.TextFont = uiFont;
             * buildingInfoField.Text = "Enter text here";
             * buildingInfoField.SelectAll();
             * buildingInfoField.Enabled = true;
             * buildingInfoField.Editable = true;
             * buildingInfoField.Bounds = new Rectangle(5, 25, 230, 90);
             * buildingInfoField.Visible = true;
             * buildingInfoField.setFocused(true);*/



            buildingInfoPanel.AddChild(nameLabel);
            buildingInfoPanel.AddChild(nameField);
            buildingInfoPanel.AddChild(addressLabel);
            buildingInfoPanel.AddChild(addressField);
            buildingInfoPanel.AddChild(storiesLabel);
            buildingInfoPanel.AddChild(storiesField);
            buildingInfoPanel.AddChild(toxicSitesLabel);
            buildingInfoPanel.AddChild(toxicSitesField);
            buildingInfoPanel.AddChild(airRightsLabel);
            buildingInfoPanel.AddChild(airRightsField);
            buildingInfoPanel.AddChild(yearBuiltLabel);
            buildingInfoPanel.AddChild(yearBuiltField);
            buildingInfoPanel.AddChild(typeLabel);
            buildingInfoPanel.AddChild(typeField);
            buildingInfoPanel.AddChild(classLabel);
            buildingInfoPanel.AddChild(classField);
            buildingInfoPanel.AddChild(saleDateLabel);
            buildingInfoPanel.AddChild(saleDateField);
            buildingInfoPanel.AddChild(descriptionLabel);
            buildingInfoPanel.AddChild(descriptionField);

            for (int i = 0; i < 10; i++)
            {
                G2DLabel thisMarkerLabel = new G2DLabel("Marker " + i);
                thisMarkerLabel.TextFont = uiFont;
                thisMarkerLabel.Bounds   = new Rectangle(5, 25 + i * 40, 230, 20);
                thisMarkerLabel.Text     = ">>";
                thisMarkerLabel.Visible  = false;
                markerLabels.Add(thisMarkerLabel);
            }
            for (int i = 0; i < 10; i++)
            {
                markerLabels[i].Visible = false;
                buildingInfoPanel.AddChild(markerLabels[i]);
            }
            scene.UIRenderer.Add2DComponent(buildingInfoPanel);
            buildingInfoPanel.Visible = false;


            // Create an action listener
            //TestActionListener listener = new TestActionListener();
        }
Example #7
0
        public void createGradient2DGUI()
        {
            gradientPanel.Bounds       = new Rectangle(5, 495, 173, 100);
            gradientPanel.Border       = GoblinEnums.BorderFactory.LineBorder;
            gradientPanel.Transparency = 0.4f;  // Ranges from 0 (fully transparent) to 1 (fully opaque)

            gradientNameLabel                     = new G2DLabel("Gradient Name");
            gradientNameLabel.TextFont            = uiFont;
            gradientNameLabel.Bounds              = new Rectangle(60, 5, 60, 20);
            gradientNameLabel.Text                = "";
            gradientNameLabel.Visible             = true;
            gradientNameLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;

            gradientNameLabel2                     = new G2DLabel("Gradient Name 2");
            gradientNameLabel2.TextFont            = uiFont;
            gradientNameLabel2.Bounds              = new Rectangle(60, 25, 60, 20);
            gradientNameLabel2.Text                = "";
            gradientNameLabel2.Visible             = false;
            gradientNameLabel2.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;

            firstGradientLabel                 = new G2DLabel("1st Gradient");
            firstGradientLabel.TextFont        = uiFont;
            firstGradientLabel.Bounds          = new Rectangle(25, 55, 20, 20);
            firstGradientLabel.BackgroundColor = Color.Green;
            firstGradientLabel.DrawBackground  = true;
            firstGradientLabel.Text            = "";
            firstGradientLabel.Visible         = true;

            firstGradientValueLabel                     = new G2DLabel("1st Gradient Value");
            firstGradientValueLabel.TextFont            = uiFont;
            firstGradientValueLabel.Bounds              = new Rectangle(15, 75, 40, 20);
            firstGradientValueLabel.Text                = "";
            firstGradientValueLabel.TextColor           = Color.Green;
            firstGradientValueLabel.Visible             = true;
            firstGradientValueLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;

            secondGradientLabel                 = new G2DLabel("1st Gradient");
            secondGradientLabel.TextFont        = uiFont;
            secondGradientLabel.Bounds          = new Rectangle(50, 55, 20, 20);
            secondGradientLabel.BackgroundColor = Color.YellowGreen;
            secondGradientLabel.DrawBackground  = true;
            secondGradientLabel.Text            = "";
            secondGradientLabel.Visible         = true;

            thirdGradientLabel                 = new G2DLabel("1st Gradient");
            thirdGradientLabel.TextFont        = uiFont;
            thirdGradientLabel.Bounds          = new Rectangle(75, 55, 20, 20);
            thirdGradientLabel.BackgroundColor = Color.Yellow;
            thirdGradientLabel.DrawBackground  = true;
            thirdGradientLabel.Text            = "";
            thirdGradientLabel.Visible         = true;

            thirdGradientValueLabel                     = new G2DLabel("1st Gradient Value");
            thirdGradientValueLabel.TextFont            = uiFont;
            thirdGradientValueLabel.Bounds              = new Rectangle(65, 75, 40, 20);
            thirdGradientValueLabel.Text                = "";
            thirdGradientValueLabel.TextColor           = Color.Yellow;
            thirdGradientValueLabel.Visible             = true;
            thirdGradientValueLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;

            fourthGradientLabel                 = new G2DLabel("1st Gradient");
            fourthGradientLabel.TextFont        = uiFont;
            fourthGradientLabel.Bounds          = new Rectangle(100, 55, 20, 20);
            fourthGradientLabel.BackgroundColor = Color.Orange;
            fourthGradientLabel.DrawBackground  = true;
            fourthGradientLabel.Text            = "";
            fourthGradientLabel.Visible         = true;

            fifthGradientLabel                 = new G2DLabel("1st Gradient");
            fifthGradientLabel.TextFont        = uiFont;
            fifthGradientLabel.Bounds          = new Rectangle(125, 55, 20, 20);
            fifthGradientLabel.BackgroundColor = Color.Red;
            fifthGradientLabel.DrawBackground  = true;
            fifthGradientLabel.Text            = "";
            fifthGradientLabel.Visible         = true;

            fifthGradientValueLabel                     = new G2DLabel("1st Gradient Value");
            fifthGradientValueLabel.TextFont            = uiFont;
            fifthGradientValueLabel.Bounds              = new Rectangle(115, 75, 40, 20);
            fifthGradientValueLabel.Text                = "";
            fifthGradientValueLabel.TextColor           = Color.Red;
            fifthGradientValueLabel.Visible             = true;
            fifthGradientValueLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;

            gradientPanel.AddChild(gradientNameLabel);
            gradientPanel.AddChild(gradientNameLabel2);
            gradientPanel.AddChild(firstGradientLabel);
            gradientPanel.AddChild(secondGradientLabel);
            gradientPanel.AddChild(thirdGradientLabel);
            gradientPanel.AddChild(fourthGradientLabel);
            gradientPanel.AddChild(fifthGradientLabel);
            gradientPanel.AddChild(firstGradientValueLabel);
            gradientPanel.AddChild(thirdGradientValueLabel);
            gradientPanel.AddChild(fifthGradientValueLabel);

            scene.UIRenderer.Add2DComponent(gradientPanel);
            gradientPanel.Visible = false;
        }
Example #8
0
            public PlayTimeSlider(G2DLabel tooltip)
                : base()
            {
                this.tooltip = tooltip;
                showTooltip = false;
                value = 0;
                snapToTicks = false;

                tooltip.DrawBorder = true;
                tooltip.DrawBackground = true;
            }
Example #9
0
        protected virtual void Initialize()
        {
            tooltipLabel = new G2DLabel();
            controlButton = new G2DButton();
            playTimeSlider = new PlayTimeSlider(tooltipLabel);
            playTimeLabel = new G2DLabel();

            tooltipLabel.Visible = false;
            playTimeLabel.DrawBorder = true;
            playTimeSlider.DrawBorder = true;

            playTimeLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;
            playTimeLabel.VerticalAlignment = GoblinEnums.VerticalAlignment.Center;

            tooltipLabel.HorizontalAlignment = GoblinEnums.HorizontalAlignment.Center;
            tooltipLabel.VerticalAlignment = GoblinEnums.VerticalAlignment.Center;
            tooltipLabel.Visible = false;

            controlButton.ActionPerformedEvent += new ActionPerformed(HandleControlButtonPress);

            playTimeSlider.StateChangedEvent += new StateChanged(HandleSliderMove);

            playTimeSlider.Maximum = (int)(duration / 1000);

            durationStr = "0:00";
            positionStr = "0:00";

            UpdateDurationString();

            playing = false;
            loop = false;
            allowNegative = false;
            curPosition = 0;
            startPosition = 0;

            name = "G2DMediaControl";
        }