public void MakeInputMapper(string actionName)
        {
            HBoxContainer container = new HBoxContainer();

            //Label
            Label actionLabel = new Label();

            actionLabel.Valign = Label.VAlign.Center;
            actionLabel.Text   = "Controls." + actionName;
            actionLabel.AddChild(new Translator());
            container.AddChild(actionLabel);

            container.AddChild(ControlUtility.MakeHorizontalFiller());

            //Bound actions
            Godot.Array actionList = InputMap.GetActionList(actionName);

            foreach (object actionItem in actionList)
            {
                InputEvent inputAction = actionItem as InputEvent;
                MakeRebindActionButton(container, inputAction);
            }

            //Add new binding options if its not 2 there.
            if (actionList.Count < 2)
            {
                int difference = 2 - actionList.Count;
                for (int i = 0; i < difference; i++)
                {
                    MakeRebindActionButton(container, null);
                }
            }

            GetParent().CallDeferred("add_child", container);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add all of the information for the mission
        /// </summary>
        public override void Initialise()
        {
            CheckShouldInitialise();

            base.Initialise();

            // Add the mission thumbnail image
            Image thumbnail = AddChild(new Image(new Vector2(0, -Size.Y * 0.25f), MissionData.MissionThumbnailTextureAsset), true, true);

            // Add the mission name label
            Label missionNameLabel = thumbnail.AddChild(new Label(MissionData.MissionName, Anchor.kTopCentre, 2), true, true);

            missionNameLabel.Colour = Color.White;

            // Add the mission description
            Label missionDescriptionLabel = thumbnail.AddChild(new Label(MissionData.MissionDescription, Anchor.kBottomCentre, 2), true, true);

            missionDescriptionLabel.Colour = Color.White;

            // Add the button to play the mission
            Button playMissionButton = missionDescriptionLabel.AddChild(new Button("Play Mission", Anchor.kBottomCentre, 2, AssetManager.DefaultNarrowButtonTextureAsset, AssetManager.DefaultNarrowButtonHighlightedTextureAsset), true, true);

            playMissionButton.LocalPosition = new Vector2(0, missionDescriptionLabel.Size.Y + playMissionButton.Size.Y);
            playMissionButton.ClickableModule.OnLeftClicked += PlayMissionCallback;
        }
Ejemplo n.º 3
0
        private Label ParseLabel()
        {
            var t = NextToken();

            if (!t.IsOperator(Operator.Less))
            {
                _stream.Previous();

                return(null);
            }

            var node = new Label();

            var id = ParseIdentifier();

            node.AddChild(id);

            t = NextToken();
            AssertOperator(Operator.Greater, t);

            return(node);
        }
Ejemplo n.º 4
0
    public void SetHealth(float health)
    {
        //pretty wak like this
        float prev = float.Parse(_healthText.Text.Split(":")[1]);
        float n    = health * 100;

        _healthText.Text = "Health:" + n;
        if (n - prev != 0)
        {
            ScoreChangeEffect ef = Global.Instance("Effects/ScoreChangeEffect") as ScoreChangeEffect;
            _healthText.AddChild(ef);
            if (n < prev)
            {
                ef.SetColor(Color.ColorN("red"));
                ef.SetText((n - prev).ToString());
            }
            else
            {
                ef.SetColor(Color.ColorN("green"));
                ef.SetText((n - prev).ToString());
            }
        }
    }
Ejemplo n.º 5
0
        protected void Register()
        {
            topPanel.Visible = false;

            Panel temp = new Panel(new Vector2((scrw / 2 + 20), ((scrh / 5) * 4)), PanelSkin.Default, Anchor.Center);

            temp.Padding = Vector2.Zero;
            UserInterface.Active.AddEntity(temp);

            Label label = new Label("Enter your Email:", offset: new Vector2(20, 20));

            temp.AddChild(label);

            TextInput email = new TextInput(false, size: new Vector2(scrw / 2 - 40, (scrh / 12)), offset: new Vector2(20, 0));

            temp.AddChild(email);

            Label label2 = new Label("Enter your Password:"******"Re-Enter your Password:"******"     Read the terms and conditions", offset: new Vector2(20, 10));
            Icon  icon   = new Icon(IconType.Scroll, Anchor.CenterLeft, offset: new Vector2(-30, 0));

            label4.AddChild(icon, false);
            icon.OnClick = (Entity btn) => { terms(); };
            temp.AddChild(label4);



            CheckBox check = new CheckBox("Agree to the terms and conditions", offset: new Vector2(20, 10));

            temp.AddChild(check);

            //login
            login         = new Button("Register", ButtonSkin.Default, Anchor.BottomLeft, new Vector2(((scrw / 5)), scrh / 14), new Vector2(20, 20));
            login.OnClick = (Entity btn) => { if (pass.Value != pass2.Value)
                                              {
                                                  GeonBit.UI.Utils.MessageBox.ShowMsgBox("Password dones not match!", "Please make sure you entered the same password.");
                                              }
                                              if (pass2.Value.Length < 6)
                                              {
                                                  GeonBit.UI.Utils.MessageBox.ShowMsgBox("Password is too short!", "The password must be equal or greater than 6 characters.");
                                              }
                                              if (check.Checked == false)
                                              {
                                                  GeonBit.UI.Utils.MessageBox.ShowMsgBox("Info", "Please agree to the terms and conditions first.");
                                              }
                                              try
                                              {
                                                  new System.Net.Mail.MailAddress(email.Value);
                                              }
                                              catch
                                              {
                                                  GeonBit.UI.Utils.MessageBox.ShowMsgBox("Email invalid!", "Please make sure you entered the correct email.\nEmail format is: [email protected].");
                                              }
                                              this.Reg(email.Value, pass2.Value); };
            temp.AddChild(login);
            //back
            login         = new Button("Back", ButtonSkin.Default, Anchor.BottomRight, new Vector2(((scrw / 5)), scrh / 14), new Vector2(20, 20));
            login.OnClick = (Entity btn) => { temp.RemoveFromParent(); topPanel.Visible = true; };
            temp.AddChild(login); return;
        }