public override void _Ready()
    {
        // Base default clear color
        VisualServer.SetDefaultClearColor(DefaultClearColor);

        background      = GetNode <ColorRect>("Background");
        launcherUI      = GetNode <VBoxContainer>("Margin/VBox");
        backButton      = GetNode <Button>("Margin/BackButton");
        examplesButton  = GetNode <Button>("Margin/VBox/Margin/Buttons/ExamplesButton");
        ecosystemButton = GetNode <Button>("Margin/VBox/Margin/Buttons/EcosystemButton");
        quitButton      = GetNode <Button>("Margin/VBox/Margin/Buttons/QuitButton");
        links           = GetNode <RichTextLabel>("Margin/VBox/Margin/Links");
        drawSpace       = GetNode <Control>("DrawSpace");
        fpsLabel        = GetNode <Label>("Margin/FPS");
        versionLabel    = GetNode <Label>("Margin/Version");

        examplesButton.Connect("pressed", this, nameof(LoadSceneExplorer));
        ecosystemButton.Connect("pressed", this, nameof(LoadEcosystem));
        quitButton.Connect("pressed", this, nameof(Quit));
        backButton.Connect("pressed", this, nameof(ReloadLauncher));
        links.Connect("meta_clicked", this, nameof(LinkClicked));

        // Set version
        versionLabel.Text = "Version " + VERSION;

        if (OS.GetName() == "HTML5")
        {
            quitButton.Hide();
        }

        ToggleBackUI(false);
    }
 public override void _Ready()
 {
     dialogText = GetTree().Root.GetNode <RichTextLabel>("MainScene/HUDLayer/DialogBox/DialogText");
     dialogText.Connect("SignalDialogActive", this, "SetDialog");
     anim           = GetNode <AnimatedSprite>("AnimatedSprite");
     anim.Animation = "Back";
     anim.Playing   = false;
 }
Example #3
0
 public override void _Ready()
 {
     SetProcessInput(true);
     dialogText = GetTree().Root.GetNode <RichTextLabel>("MainScene/HUDLayer/DialogBox/DialogText");
     Connect(nameof(SendTextToDialog), dialogText, "_ReceiveText");
     dialogText.Connect("SignalDialogActive", this, "SetDialog");
     player         = GetTree().Root.GetNode <KinematicBody2D>("MainScene/Player");
     collisionShape = GetNode <CollisionShape2D>("CollisionShape2D");
     rectangleShape = (RectangleShape2D)collisionShape.Shape;
     rect           = new Rect2(collisionShape.GlobalPosition.x - rectangleShape.Extents.x,
                                collisionShape.GlobalPosition.y - rectangleShape.Extents.y, rectangleShape.Extents.x * 2, rectangleShape.Extents.y * 2);
 }
Example #4
0
        public override void _Ready()
        {
            _creditsRichText = GetNode <RichTextLabel>("CreditsContainer/CenterContainer/VBoxContainer/Credits");

            // make sure bbcode is enabled & set the credits value
            _creditsRichText.BbcodeEnabled = true;
            _creditsRichText.SetBbcode(Game.Autoload().Credits);
            _creditsRichText.Connect("meta_clicked", this, nameof(Clicked));

            _linkSeek     = _creditsRichText.GetVisibleLineCount();
            _maxSeekLines = _creditsRichText.GetLineCount() - 1;

            // was trying to use scrolling credits, but it sucked.
//            _creditsTimer = GetNode<Timer>("CreditsTimer");
//            _creditsTimer.Connect("timeout", this, nameof(ScrollCredits));
        }
Example #5
0
        public override void _Ready()
        {
            isConsoleShown     = true;
            submitAutocomplete = true;

            instance = this;

            // load console nodes
            _consoleBox      = GetNode("ConsoleBox") as Control;
            Text             = GetNode("ConsoleBox/Container/ConsoleText") as RichTextLabel;
            Line             = GetNode("ConsoleBox/Container/ConsoleLine") as LineEdit;
            _animationPlayer = GetNode("ConsoleBox/AnimationPlayer") as AnimationPlayer;

            // Allow selecting console text
            Text.SelectionEnabled = true;
            // Follow console output (for scrolling)
            Text.ScrollFollowing = true;
            // React to clicks on console urls
            Text.Connect("meta_clicked", Line, nameof(LineEdit.SetText));

            // Hide console by default
            _consoleBox.Hide();
            _animationPlayer.Connect("animation_finished", this, nameof(_toggleAnimationFinished));
            toggleConsole();

            // Console keyboard control
            SetProcessInput(true);

            // Show some info
            var v = Engine.GetVersionInfo();

            writeLine(
                ProjectSettings.GetSetting("application/config/name") +
                " (Godot " + v["major"] + '.' + v["minor"] + '.' + v["patch"] + ' ' + v["status"] + ")\n" +
                "Type [color=#ffff66][url=help]help[/url][/color] to get more information about usage");

            // Init base commands
            BaseCommands.init();
        }