Exemple #1
0
    public override void _Ready()
    {
        resourceSelect = GetNode <OptionButton>("Values/Resource/OptionButton");
        resourceSelect.Connect("item_selected", this, nameof(Signal_ResourceSelected));

        subrectX = GetNode <SpinBox>("Values/SubRectX/SpinBox");
        subrectX.Connect("value_changed", this, nameof(Signal_SubRectUpdated));
        subrectY = GetNode <SpinBox>("Values/SubRectY/SpinBox");
        subrectY.Connect("value_changed", this, nameof(Signal_SubRectUpdated));
        subrectW = GetNode <SpinBox>("Values/SubRectWidth/SpinBox");
        subrectW.Connect("value_changed", this, nameof(Signal_SubRectUpdated));
        subrectH = GetNode <SpinBox>("Values/SubRectHeight/SpinBox");
        subrectH.Connect("value_changed", this, nameof(Signal_SubRectUpdated));

        texturePreview = GetNode <TextureRect>("ImagePreview");

        var button = GetNode <Button>("Values/ResetSubRectButton");

        button.Connect("pressed", this, nameof(Signal_ResetSubRect));

        var ui = GetTree().Root.GetNode <UI>("UI");

        if (ui != null)
        {
            InitResources(ui.GetImageList(), ui.GetTexture);
        }

        if (pendingStartValue != null)
        {
            SetValues(pendingStartValue);
        }
    }
Exemple #2
0
    public override void _Ready()
    {
        fileSelect = GetNode <OptionButton>("Container/Top/OptionButton");
        fileDialog = GetNode <FileDialog>("FileDialog");
        fileSelect.Connect("item_selected", this, nameof(OnFileSelectItemSelected));
        fileDialog.Connect("file_selected", this, nameof(OnFileDialogFileSelected));
        fileDialog.Connect("popup_hide", this, nameof(OnFileDialogHide));

        storyNode = GetNode("Story");
        storyNode.SetScript(ResourceLoader.Load("res://addons/paulloz.ink/InkStory.cs") as Script);
        storyNode.Connect(nameof(InkStory.InkChoices), this, nameof(OnStoryChoices));
        storyText    = GetNode <VBoxContainer>("Container/Bottom/Scroll/Margin/StoryText");
        storyChoices = GetNode <VBoxContainer>("Container/Bottom/StoryChoices");

        scrollbar = GetNode <ScrollContainer>("Container/Bottom/Scroll").GetVScrollbar();
    }
    public override void _Ready()
    {
        DropDown = (OptionButton)GetNode("UI/Dropdown");
        DropDown.Connect("item_selected", this, "OnModSelected");

        // get an array of the folders in \Mods
        var modsList = System.IO.Directory.GetDirectories($"{System.IO.Directory.GetCurrentDirectory()}\\Mods");

        for (var i = 0; i < modsList.Length; i++)
        {
            // Add each mod to the dropdown list
            DropDown.AddItem(modsList[i].Split('\\').Last(), i);
        }

        LoadModLevel(DropDown.Items[0].ToString());
    }
Exemple #4
0
    private void _populatePlayerTeams()
    {
        playerTeams.Connect("item_selected", this, "_playerTeamSelected");

        for (int index = 0; index < (int)(Team.TeamCode.NEUTRAL); index++)
        {
            Team.TeamCode team = (Team.TeamCode)index;
            playerTeams.AddItem("" + team);

            _populateTeamSettings(team);
        }

        // Pre Select the 0 index
        playerTeams.Select(0);
        _playerTeamSelected(0);
    }
        public override async void _Ready()
        {
            CurrentSceneContainer = GetNode <Control>("CurrentScene");
            CodeLabel             = GetNode <RichTextLabel>("Container/VBox/TopControl/CodeHBox/Code");
            SummaryLabel          = GetNode <RichTextLabel>("Container/VBox/TopControl/CodeHBox/Summary");
            CodeBackground        = GetNode <ColorRect>("Container/VBox/TopControl/CodeBackground");
            ToggleCodeButton      = GetNode <Button>("Container/VBox/ButtonsMargin/Buttons/LeftButtons/ToggleCodeButton");
            ToggleUIButton        = GetNode <Button>("Container/VBox/ButtonsMargin/Buttons/LeftButtons/ToggleUIButton");
            PrevChapterButton     = GetNode <Button>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons/ChapterSelection/PrevChapter");
            NextChapterButton     = GetNode <Button>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons/ChapterSelection/NextChapter");
            SelectChapterButton   = GetNode <OptionButton>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons/ChapterSelection/SelectChapter");
            PrevExampleButton     = GetNode <Button>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons/ExampleSelection/PrevExample");
            NextExampleButton     = GetNode <Button>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons/ExampleSelection/NextExample");
            SelectExampleButton   = GetNode <OptionButton>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons/ExampleSelection/SelectExample");
            ReloadExampleButton   = GetNode <Button>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons/ExampleSelection/ReloadExample");
            SelectionButtons      = GetNode <VBoxContainer>("Container/VBox/ButtonsMargin/Buttons/SelectionButtons");
            LoadingLabel          = GetNode <Label>("Container/Loading");

            PrevChapterButton.Connect("pressed", this, nameof(SelectPrevChapter));
            NextChapterButton.Connect("pressed", this, nameof(SelectNextChapter));
            PrevExampleButton.Connect("pressed", this, nameof(SelectPrevExample));
            NextExampleButton.Connect("pressed", this, nameof(SelectNextExample));
            ToggleCodeButton.Connect("pressed", this, nameof(ToggleCodeLabel));
            ReloadExampleButton.Connect("pressed", this, nameof(LoadCurrentExample));
            SelectChapterButton.Connect("item_selected", this, nameof(SelectChapterFromId));
            SelectExampleButton.Connect("item_selected", this, nameof(SelectExampleFromId));
            ToggleUIButton.Connect("pressed", this, nameof(ToggleUI));

            SummaryLabel.Visible   = false;
            CodeBackground.Visible = false;
            CodeLabel.Visible      = false;

            ToggleCodeButton.Visible = false;
            ToggleUIButton.Visible   = false;

            sceneLoader = new SceneLoader();
            sceneLoader.Connect(nameof(SceneLoader.ScenesLoaded), this, nameof(OnScenesLoaded));

            // Force min size for exercise selection
            var font = SelectChapterButton.GetFont("font");

            SelectExampleButton.RectMinSize = font.GetCharSize('w') * new Vector2(SceneLoader.SampleNameMaxLength, 1);

            await ToSignal(GetTree().CreateTimer(0.1f), "timeout");

            AddChild(sceneLoader);
        }