Example #1
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 void OnSaveConvexShape()
 {
     _fd      = new FileDialog();
     _fd.Mode = FileDialog.ModeEnum.SaveFile;
     _fd.AddFilter("*.tres, *.res ; Resource files");
     _fd.Connect("file_selected", this, "OnConvexShapeSaveOK");
     _fd.DialogHideOnOk = true;
     AddChild(_fd);
     _fd.PopupCentered(new Vector2(800, 600));
 }
    private void Init()
    {
        canvas      = (TextureRect)FindNode("MapImage");
        progressBar = (ProgressBar)FindNode("ProgressBar");
        progress    = (Control)FindNode("Progress");

        progressBar.MaxValue = (THREADS * 2) + 3;

        progress.Hide();

        useEarth     = (CheckBox)FindNode("UseEarth");
        save         = (Button)FindNode("Save");
        saveas       = (Button)FindNode("Save as");
        load         = (Button)FindNode("Load");
        generate     = (Button)FindNode("Generate");
        pathLabel    = (Label)FindNode("Path");
        loadDialog   = (FileDialog)FindNode("LoadDialog");
        saveasDialog = (FileDialog)FindNode("SaveAsDialog");
        saveDialog   = (AcceptDialog)FindNode("SaveDialog");

        useEarth.Pressed = USE_EARTH_IMAGE;
        useEarth.Connect("pressed", this, "Generate");

        UpdatePath();

        save.Connect("pressed", this, nameof(SaveDialog));
        saveas.Connect("pressed", this, nameof(SaveAsDialog));
        load.Connect("pressed", this, nameof(LoadDialog));

        generate.Connect("pressed", this, nameof(Generate));

        loadDialog.Connect("file_selected", this, nameof(LoadConfig));
        loadDialog.Connect("dir_selected", this, nameof(UpdateDirectory));

        saveasDialog.Connect("file_selected", this, nameof(SaveConfig));
        saveasDialog.Connect("dir_selected", this, nameof(UpdateDirectory));

        Generate();
    }
Example #4
0
    public override void _Ready()
    {
        fileName     = GetNode <Label>("Container/Top/Label");
        resetButton  = GetNode <Button>("Container/Top/ResetButton");
        loadButton   = GetNode <Button>("Container/Top/LoadButton");
        fileDialog   = GetNode <FileDialog>("FileDialog");
        storyText    = GetNode <VBoxContainer>("Container/Bottom/Scroll/Margin/StoryText");
        storyChoices = GetNode <VBoxContainer>("Container/Bottom/StoryChoices");
        scroll       = GetNode <ScrollContainer>("Container/Bottom/Scroll");
        story        = GetNode <InkStory>("Story");

        resetButton.Connect("pressed", this, nameof(onResetButtonPressed));
        loadButton.Connect("pressed", this, nameof(onLoadButtonPressed));
        fileDialog.Connect("popup_hide", this, nameof(onFileDialogHide));
        story.Connect(nameof(InkStory.InkChoices), this, nameof(onStoryChoices));
        story.Connect(nameof(InkStory.InkContinued), this, nameof(onStoryContinued));
        story.Connect(nameof(InkStory.InkEnded), this, nameof(onStoryEnded));
    }
Example #5
0
        public override void _Ready()
        {
            GetTree().SetScreenStretch(SceneTree.StretchMode.Mode2d, SceneTree.StretchAspect.Ignore, new Vector2(1920, 1080));
            OS.SetWindowMaximized(true);

            _graphEdit           = GetNode <GraphEdit>("VBoxContainer/GraphEdit");
            _resourcePreloader   = GetNode <ResourcePreloader>("ResourcePreloader");
            _eventSelectorDialog = GetNode <WindowDialog>("EventSelectorDialog");
            _nodeSelectorDialog  = GetNode <WindowDialog>("NodeSelectorDialog");
            _openFileDialog      = GetNode <FileDialog>("OpenFileDialog");
            _saveFileDialog      = GetNode <FileDialog>("SaveFileDialog");

            var eventItemList = _eventSelectorDialog.GetNode <ItemList>("VBoxContainer/ItemList");

            foreach (var key in GameEventDispatcher.GameEventMapping.Keys)
            {
                var evt = GameEventDispatcher.GameEventMapping[key];
                eventItemList.AddItem(evt.DisplayName);
            }
            eventItemList.Connect("item_activated", this, nameof(OnQuestEventItemActivated));

            var nodeItemList = _nodeSelectorDialog.GetNode <ItemList>("VBoxContainer/ItemList");

            nodeItemList.AddItem(nameof(QuestStartNode));
            nodeItemList.AddItem(nameof(QuestStageNode));
            nodeItemList.AddItem(nameof(QuestEventNode));
            nodeItemList.AddItem(nameof(QuestCompleteNode));
            nodeItemList.AddItem(nameof(QuestRewardNode));
            nodeItemList.Connect("item_activated", this, nameof(OnNodeSelectorSelected));

            GetNode("VBoxContainer/HBoxContainer/AddNode").Connect("pressed", this, nameof(OnAddNodePressed));
            GetNode("VBoxContainer/HBoxContainer/SaveButton").Connect("pressed", this, nameof(OnSaveButtonPressed));
            GetNode("VBoxContainer/HBoxContainer/OpenButton").Connect("pressed", this, nameof(OnOpenButtonPressed));

            _graphEdit.Connect("connection_request", this, nameof(OnConnectionRequest));
            _graphEdit.Connect("disconnection_request", this, nameof(OnDisconnectRequest));

            _openFileDialog.Connect("file_selected", this, nameof(OnFileSelected));
            _saveFileDialog.Connect("file_selected", this, nameof(OnSaveFileSelected));
        }
Example #6
0
    public override void _Ready()
    {
        InitVignette();

        var btHolder = new VBoxContainer()
        {
            MarginTop = 20, RectMinSize = GetViewportRect().Size
        };

        AddChild(btHolder);

        using (var dir = new Directory()) {
            //workaround of .obj not being exported even if included
            dir.Copy("res://assets/Alien.md", OS.GetUserDataDir() + "/" + "Alien.obj");
            dir.Copy("res://assets/Rock.md", OS.GetUserDataDir() + "/" + "Rock.obj");
            dir.Copy("res://assets/Cup.md", OS.GetUserDataDir() + "/" + "Cup.obj");

            dir.Copy(OS.GetUserDataDir() + "/" + "Alien.obj", "res://assets/Alien.obj");
            dir.Copy(OS.GetUserDataDir() + "/" + "Rock.obj", "res://assets/Rock.obj");
            dir.Copy(OS.GetUserDataDir() + "/" + "Cup.obj", "res://assets/Cup.obj");
        }

        GetTree().Root.GetNode("Main").CallDeferred("add_child", displayModel);

        Button openObjBt = new Button();

        openObjBt.Text = "Open .obj";
        openObjBt.Connect("pressed", this, nameof(OnOpenButton));
        openObjBt.SizeFlagsHorizontal = (int)Control.SizeFlags.ShrinkCenter;
        openObjBt.RectMinSize         = new Vector2(btHolder.RectMinSize.x * 0.7f, 40);
        openObjBt.AddFontOverride("font", new DynamicFont()
        {
            FontData = GD.Load <DynamicFontData>("res://assets/default/Tuffy_Bold.ttf"), Size = 30
        });
        btHolder.AddChild(openObjBt);

        filePopup.Connect("file_selected", this, nameof(OnFileSelected));
        AddChild(filePopup);
    }
Example #7
0
    public override void _Ready()
    {
        InitVignette();

        var btHolder = new VBoxContainer()
        {
            MarginTop = 20, RectMinSize = GetViewportRect().Size
        };

        AddChild(btHolder);

        Button openObjBt = new Button();

        openObjBt.Text = "Open Image";
        openObjBt.Connect("pressed", this, nameof(OnOpenButton));
        openObjBt.SizeFlagsHorizontal = (int)Control.SizeFlags.ShrinkCenter;
        openObjBt.RectMinSize         = new Vector2(btHolder.RectMinSize.x * 0.7f, 40);
        openObjBt.AddFontOverride("font", new DynamicFont()
        {
            FontData = GD.Load <DynamicFontData>("res://assets/default/Tuffy_Bold.ttf"), Size = 30
        });
        btHolder.AddChild(openObjBt);

        filePopup.Connect("file_selected", this, nameof(OnFileSelected));
        AddChild(filePopup);

        imageSprite = new Sprite();
        AddChild(imageSprite);

        var labHolder = new VBoxContainer()
        {
            Alignment = BoxContainer.AlignMode.Center
        };

        AddChild(errorDiag);
        errorDiag.AddChild(labHolder);
        labHolder.AddChild(errorLabel);
    }
Example #8
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     myFile = GetNode("FileDialog") as FileDialog;
     myFile.Connect("confirmed", this, "teste");
     myFile.Popup_();
 }