Exemple #1
0
 public override void _Ready()
 {
     _leftButton       = GetNode <TextureButton>("LeftButton");
     _rightButton      = GetNode <TextureButton>("RightButton");
     _centerContainer  = GetNode <CenterContainer>("CenterContainer");
     _contentContainer = _centerContainer.GetNode <HBoxContainer>("ContentContainer");
 }
Exemple #2
0
 public override void _Ready()
 {
     tree        = GetTree();
     crosshair   = GetNode <CenterContainer>("Crosshair");
     pause       = GetNode <Control>("Pause");
     options     = GetNode <Options>("Options");
     voxel_world = GetNode <VoxelWorld>("../VoxelWorld");
 }
Exemple #3
0
 public override void _Ready()
 {
     this.game                           = (GameScript)this.GetParent();
     this.rtl                            = (RichTextLabel)this.game.FindNode("CenterContainer").FindNode("PanelContainer").FindNode("RichTextLabel");
     this.dialogContainer                = (CenterContainer)this.game.FindNode("CenterContainer");
     this.game.isTutorial                = true;
     this.game.isCameraTutorialLocked    = true;
     this.game.isPlacementTutorialLocked = true;
 }
        public override void _Process(float delta)
        {
            base._Process(delta);

            if (Input.IsActionJustPressed("debug_view"))
            {
                Spatial xAxis = GetNode <Spatial>("xAxis");
                Spatial yAxis = GetNode <Spatial>("yAxis");
                Spatial zAxis = GetNode <Spatial>("zAxis");

                xAxis.Visible = !xAxis.Visible;
                yAxis.Visible = xAxis.Visible;
                zAxis.Visible = yAxis.Visible;
            }

            CenterContainer centerContainer = GetNode <CenterContainer>("UI/CenterContainer");

            centerContainer.SetSize(GetViewport().Size);

            if (Input.IsActionJustPressed("ui_accept"))
            {
                GenerateDefaultChamber();
            }

            if (selection.Started() && !selection.Completed())
            {
                if (Input.IsActionPressed("select"))
                {
                    Vector2 mousePos = GetViewport().GetMousePosition();
                    Camera  camera   = RuntimeRoot.CurrentCamera;

                    Vector3 start     = camera.ProjectRayOrigin(mousePos);
                    Vector3 direction = camera.ProjectRayNormal(mousePos);

                    UpdateSelection(start, direction);
                }
                if (Input.IsActionJustReleased("select"))
                {
                    selection.FinishSelection();
                }
            }
            else if (selection.Completed())
            {
                if (Input.IsActionJustPressed("extrude"))
                {
                    Extrude(false);
                }
                if (Input.IsActionJustPressed("intrude"))
                {
                    Extrude(true);
                }
            }

            DebugOverlay.Information["Selection"] = selection;
        }
Exemple #5
0
        public void ExecuteTest_ChooseLocationSofia_UsingDoubleClick_LocationPageOpened()
        {
            topMenuInstance = mainPageInstance.MoveToTopMenu();
            Acts.Click(topMenuInstance.LocationsItem);
            mainPageInstance.DoubleClick(mainPageInstance.ModalWindow.LocationWindow.CitySofia);
            string exeptualResultTitle = "Sofia";

            groupLocationInstance = new CenterContainer(driver);
            Console.WriteLine(groupLocationInstance.GroupLocation.Text);
            Assert.AreEqual(exeptualResultTitle, groupLocationInstance.GroupLocation.Text);
        }
Exemple #6
0
        public void ExecuteTest_CancelLocationIvanoFrankivsk_UsingKeyBoard()
        {
            topMenuInstance = mainPageInstance.MoveToTopMenu();
            Acts.Click(topMenuInstance.LocationsItem);
            Acts.Click(mainPageInstance.ModalWindow.LocationWindow.CityIvanoFrankivsk);
            Acts.PressKeyboardButton("{Esc}");
            string exeptualResultTitle = "Lviv";

            groupLocationInstance = new CenterContainer(driver);
            Console.WriteLine(groupLocationInstance.GroupLocation.Text);
            Assert.AreEqual(exeptualResultTitle, groupLocationInstance.GroupLocation.Text);
        }
Exemple #7
0
        public override void _Ready()
        {
            initSelectContainer = GetNode <CenterContainer>("CenterContainer");

            GMRoot.initData = new GMData.Init.InitData();

            var initNameAgePanel = InitNameAgePanel.Instance();

            initSelectContainer.AddChild(initNameAgePanel);

            initNameAgePanel.Connect("Finish", this, nameof(_on_SelectNameAgeFinish_Signal));
        }
Exemple #8
0
        public void ExecuteTest_ChooseLocationChernivtsy_LocationPageOpened()
        {
            topMenuInstance = mainPageInstance.MoveToTopMenu();
            Acts.Click(topMenuInstance.LocationsItem);
            Acts.Click(mainPageInstance.ModalWindow.LocationWindow.CityChernivtsy);
            Acts.Click(mainPageInstance.ModalWindow.LocationWindow.ConfurmButton);
            string exeptualResultTitle = "Chernivtsy";

            groupLocationInstance = new CenterContainer(driver);
            Console.WriteLine(groupLocationInstance.GroupLocation.Text);
            Assert.AreEqual(exeptualResultTitle, groupLocationInstance.GroupLocation.Text);
        }
Exemple #9
0
        public void ExecuteTest_LocationPageCloseWithoutChoosing()
        {
            topMenuInstance = mainPageInstance.MoveToTopMenu();
            Acts.Click(topMenuInstance.LocationsItem);
            Acts.Click(mainPageInstance.ModalWindow.LocationWindow.CityLviv);
            Acts.Click(mainPageInstance.ModalWindow.LocationWindow.CancelButton);
            string exeptualResultTitle = "Dnipro";

            groupLocationInstance = new CenterContainer(driver);
            Console.WriteLine(groupLocationInstance.GroupLocation.Text);
            Assert.AreEqual(exeptualResultTitle, groupLocationInstance.GroupLocation.Text);
        }
Exemple #10
0
        public void Test()
        {
            var container = new CenterContainer();
            var child     = new Control {
                MinSize = (50, 50)
            };

            container.AddChild(child);

            container.Arrange(UIBox2.FromDimensions(0, 0, 100, 100));

            Assert.That(container.DesiredSize, Is.EqualTo(new Vector2(50, 50)));
            Assert.That(child.Position, Is.EqualTo(new Vector2(25, 25)));
            Assert.That(child.Size, Is.EqualTo(new Vector2(50, 50)));
        }
Exemple #11
0
    private void _LoadButtons()
    {
        _CreateButtons();

        VBoxContainer container = GetNode <VBoxContainer>("ColorRect/VBoxContainer");

        for (int i = 0; i < container.GetChildCount(); i += 1)
        {
            container.RemoveChild(container.GetChild(i));
        }
        foreach (TextureButton button in _Buttons)
        {
            CenterContainer center = new CenterContainer();
            center.AddChild(button);
            container.AddChild(center);
        }
    }
Exemple #12
0
        public void TestLocationList(string exeptedResult, string city)
        {
            topMenuInstance = mainPageInstance.MoveToTopMenu();
            Acts.Click(topMenuInstance.LocationsItem);
            locationWindowInstance = new LocationWindow(driver);
            string[]            parts         = city.Split(',');
            List <string>       listOfCity    = new List <string>(parts);
            IList <IWebElement> nonActiveCity = locationWindowInstance.GetLocationNonActiveWebElements();

            locationWindowInstance.ClickNonActiveButtonNames(nonActiveCity, listOfCity);
            Acts.Click(locationWindowInstance.ConfurmButton);
            CenterContainer groupLocationInstance = mainPageInstance.MoveToCenterContainer();

            groupLocationInstance = new CenterContainer(driver);
            wait.Until(groupLocationInstance.IsHintVisible());
            Console.WriteLine(groupLocationInstance.LocationHint.Text);
            string exeptedResultTitle = exeptedResult;

            Assert.AreEqual(exeptedResultTitle, groupLocationInstance.LocationHint.Text);
        }
        /// <summary>
        /// Initializes the control with provided values.
        /// </summary>
        /// <param name="deselectedTexture">Texture of deactivated control</param>
        /// <param name="selectedTexture">Texture of activated control</param>
        /// <param name="controlValue">Value of the control</param>
        /// <param name="defaultSelected">Sets whether the control is selected by default</param>
        /// <param name="labelText">Text of the control's label</param>
        /// <param name="font">Font of the control's label</param>
        public void Init(Texture deselectedTexture, Texture selectedTexture, int controlValue, bool defaultSelected = false,
                         string labelText = null, DynamicFont font = null)
        {
            base.Init(deselectedTexture, selectedTexture, controlValue, defaultSelected);

            _labelText = labelText;
            _font      = font;

            _centerContainer = GetNode <CenterContainer>("CenterContainer");
            Label            = _centerContainer.GetNode <Label>("Label");

            Label.Align  = Label.AlignEnum.Center;
            Label.Valign = Label.VAlign.Center;

            if (!string.IsNullOrEmpty(_labelText) && _font != null)
            {
                Label.AddFontOverride("font", _font);
                Label.Text = _labelText;
            }
        }
        private Control SetupHoldBox(Texture panelTex)
        {
            var previewBack = new StyleBoxTexture
            {
                Texture  = panelTex,
                Modulate = Color.FromHex("#4a4a51")
            };

            previewBack.SetPatchMargin(StyleBox.Margin.All, 10);

            var grid = new GridContainer
            {
                Columns               = 1,
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 20
            };

            var holdBlockPanel = new PanelContainer
            {
                PanelOverride       = previewBack,
                CustomMinimumSize   = blockSize * 6.5f,
                SizeFlagsHorizontal = SizeFlags.None,
                SizeFlagsVertical   = SizeFlags.None
            };
            var holdCenterContainer = new CenterContainer();

            _holdBlockGrid = new GridContainer
            {
                HSeparationOverride = 1,
                VSeparationOverride = 1
            };
            holdCenterContainer.AddChild(_holdBlockGrid);
            holdBlockPanel.AddChild(holdCenterContainer);
            grid.AddChild(holdBlockPanel);

            grid.AddChild(new Label {
                Text = "Hold", Align = Label.AlignMode.Center
            });

            return(grid);
        }
Exemple #15
0
    public override void _Ready()
    {
        CenterContainer word = GetNode <CenterContainer>("WordContainer");

        word.Connect("ColorValidationComplete", this, nameof(_OnColorValidationComplete));

        //Connect Color and Quit Buttons
        VBoxContainer gameButtons = GetNode <VBoxContainer>("GameButtons");

        gameButtons.Connect("ColorButtonPressed", this, nameof(CheckCorrectButtonPressed));
        gameButtons.Connect("QuitButtonPressed", this, nameof(OnQuitToMainMenuPressed));

        _startTimer = GetNode <Timer>("StartTimer");
        _startTimer.Connect("timeout", this, nameof(OnStartTimerTimeout));
        _timeBeforeStart = 3;
        _gameStarted     = false;

        _timeRemaining = GetNode <Timer>("TimeRemaining");
        _timeRemaining.Connect("timeout", this, nameof(OnTimeRemainingTimeout));

        _secondsRemaining = 60;
    }
        public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner)
        {
            Title = "Space Villain";
            Owner = owner;

            GridContainer grid = new GridContainer();

            grid.Columns = 1;

            GridContainer infoGrid = new GridContainer();

            infoGrid.Columns = 3;
            infoGrid.AddChild(new Label {
                Text = "Player", Align = Label.AlignMode.Center
            });
            infoGrid.AddChild(new Label {
                Text = "|", Align = Label.AlignMode.Center
            });
            _enemyNameLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_enemyNameLabel);

            _playerInfoLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_playerInfoLabel);
            infoGrid.AddChild(new Label {
                Text = "|", Align = Label.AlignMode.Center
            });
            _enemyInfoLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_enemyInfoLabel);
            CenterContainer centerContainer = new CenterContainer();

            centerContainer.AddChild(infoGrid);
            grid.AddChild(centerContainer);

            _playerActionLabel       = new Label();
            _playerActionLabel.Align = Label.AlignMode.Center;
            grid.AddChild(_playerActionLabel);

            _enemyActionLabel       = new Label();
            _enemyActionLabel.Align = Label.AlignMode.Center;
            grid.AddChild(_enemyActionLabel);

            GridContainer buttonGrid = new GridContainer();

            buttonGrid.Columns = 3;
            Button attack = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack);

            attack.Text = "ATTACK";
            buttonGrid.AddChild(attack);

            Button heal = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal);

            heal.Text = "HEAL";
            buttonGrid.AddChild(heal);

            Button recharge = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge);

            recharge.Text = "RECHARGE";
            buttonGrid.AddChild(recharge);

            centerContainer = new CenterContainer();
            centerContainer.AddChild(buttonGrid);
            grid.AddChild(centerContainer);

            Button newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame);

            newGame.Text = "New Game";
            grid.AddChild(newGame);

            centerContainer = new CenterContainer();
            centerContainer.AddChild(grid);
            Contents.AddChild(centerContainer);
        }
Exemple #17
0
 public override void _Ready()
 {
     _pause = GetNode <CenterContainer>("Pause");
     _pause.Hide();
 }
Exemple #18
0
        private readonly Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons
        public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner)
        {
            MinSize = SetSize = (400, 200);
            Title   = Loc.GetString("Space Villain");
            Owner   = owner;

            var grid = new GridContainer {
                Columns = 1
            };

            var infoGrid = new GridContainer {
                Columns = 3
            };

            infoGrid.AddChild(new Label {
                Text = Loc.GetString("Player"), Align = Label.AlignMode.Center
            });
            infoGrid.AddChild(new Label {
                Text = "|", Align = Label.AlignMode.Center
            });
            _enemyNameLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_enemyNameLabel);

            _playerInfoLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_playerInfoLabel);
            infoGrid.AddChild(new Label {
                Text = "|", Align = Label.AlignMode.Center
            });
            _enemyInfoLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_enemyInfoLabel);
            var centerContainer = new CenterContainer();

            centerContainer.AddChild(infoGrid);
            grid.AddChild(centerContainer);

            _playerActionLabel = new Label {
                Align = Label.AlignMode.Center
            };
            grid.AddChild(_playerActionLabel);

            _enemyActionLabel = new Label {
                Align = Label.AlignMode.Center
            };
            grid.AddChild(_enemyActionLabel);

            var buttonGrid = new GridContainer {
                Columns = 3
            };

            _gameButtons[0] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack)
            {
                Text = Loc.GetString("ATTACK")
            };
            buttonGrid.AddChild(_gameButtons[0]);

            _gameButtons[1] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal)
            {
                Text = Loc.GetString("HEAL")
            };
            buttonGrid.AddChild(_gameButtons[1]);

            _gameButtons[2] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge)
            {
                Text = Loc.GetString("RECHARGE")
            };
            buttonGrid.AddChild(_gameButtons[2]);

            centerContainer = new CenterContainer();
            centerContainer.AddChild(buttonGrid);
            grid.AddChild(centerContainer);

            var newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame)
            {
                Text = Loc.GetString("New Game")
            };

            grid.AddChild(newGame);

            centerContainer = new CenterContainer();
            centerContainer.AddChild(grid);
            Contents.AddChild(centerContainer);
        }
Exemple #19
0
 public override void _Ready()
 {
     endingContainer = GetNode <CenterContainer>("CanvasLayer/EndContainer");
 }