public static async Task ShowWindowDialog(UIElement instance, string header = null, string headericon = null, Action detailsback = null)
        {
            var window = new WindowDialog()
            {
                WindowContent = instance, Header = header, HeaderIcon = headericon
            };

            window.DetailsBack = detailsback;
            var isphone = DeviceManager.CurrentIs(Devices.Phone);

            if (isphone)
            {
                window.IsDialog = false;
            }
            var stylename = isphone ? "SettingsDialogBoxMobileStyle" : "SettingsDialogBoxStyle";
            var dialog    = new ContentDialog {
                Content = window, Style = window.Resources[stylename] as Style
            };

            dialog.Closing += (s, e) =>
            {
                if (window.IsDetails && isphone)
                {
                    e.Cancel         = true;
                    window.IsDetails = false;
                }
            };

            await dialog.ShowAsync();
        }
Beispiel #2
0
    public override void _Ready()
    {
        loadDialog = GetNode <WindowDialog>("LoadingDialog");
        var dados = GetTree().GetNodesInGroup("dados");

        foreach (var dado in dados)
        {
            if ((dado as Node).Name == "lblDerrotas")
            {
                lblDerrotas = dado as Label;
            }
            else if ((dado as Node).Name == "lblVitorias")
            {
                lblVitorias = dado as Label;
            }
            else if ((dado as Node).Name == "lblJogador")
            {
                lblJogador = dado as Label;
            }
        }
        //Viewport root = GetTree().GetRoot();
        Viewport root = GetNode <Viewport>("/root");

        CurrentScene = root.GetChild(root.GetChildCount() - 1);
        carregaDados();
    }
Beispiel #3
0
    private void onNouveau()
    {
        Godot.TabContainer tabContainer = (Godot.TabContainer)GetNode("Panel/TabContainer");
        if (tabContainer.CurrentTab == 0)
        {
            mode = Mode.Item;
        }
        else if (tabContainer.CurrentTab == 1)
        {
            mode = Mode.Utilisateur;
        }
        else
        {
            mode = Mode.Facture;
        }

        switch (mode)
        {
        case Mode.Utilisateur:
            WindowDialog newUser = (WindowDialog)GetNode("NouvelUtilisateur");

            newUser.PopupCenteredRatio();
            break;

        case Mode.Item:
            WindowDialog newItem = (WindowDialog)GetNode("NouvelItem");

            newItem.PopupCenteredRatio();
            break;

        default:
            break;
        }
    }
Beispiel #4
0
    public override void _Ready()
    {
        hostWindow          = GetNode <WindowDialog>("HostWindow");
        joinWindow          = GetNode <WindowDialog>("JoinWindow");
        hostPortEdit        = (LineEdit)hostWindow.FindNode("PortEdit");
        joinHostEdit        = (LineEdit)joinWindow.FindNode("HostEdit");
        joinPortEdit        = (LineEdit)joinWindow.FindNode("PortEdit");
        easyModeCheckButton = (CheckButton)FindNode("EasyModeCheckButton");

        hostPortEdit.Text           = GameSettings.Instance.ServerPort.ToString();
        joinHostEdit.Text           = GameSettings.Instance.ClientHost;
        joinPortEdit.Text           = GameSettings.Instance.ClientPort.ToString();
        easyModeCheckButton.Pressed = GameSettings.Instance.Easy;

        FindNode("ExitButton").Connect("pressed", this, nameof(OnExitButtonPressed));
        FindNode("SettingsButton").Connect("pressed", this, nameof(OnSettingsButtonPressed));
        FindNode("NewGameButton").Connect("pressed", this, nameof(OnNewGameButtonPressed));
        FindNode("HostGameButton").Connect("pressed", this, nameof(OnHostGameButtonPressed));
        FindNode("JoinGameButton").Connect("pressed", this, nameof(OnJoinGameButtonPressed));
        easyModeCheckButton.Connect("toggled", this, nameof(OnEasyModeCheckButtonPressed));

        joinWindow.Connect("popup_hide", this, nameof(OnJoinWindoPopupHide));
        joinWindow.FindNode("CancelButton").Connect("pressed", this, nameof(OnJoinWindowCancelButtonPressed));
        joinWindow.FindNode("JoinButton").Connect("pressed", this, nameof(OnJoinWindowJoinButtonPressed));
        hostWindow.Connect("popup_hide", this, nameof(OnHostWindowPopupHide));
        hostWindow.FindNode("HostButton").Connect("pressed", this, nameof(OnHostWindowHostButtonPressed));

        Signals.PlayerUpdatedEvent += OnPlayerUpdated;
        GetTree().Connect("server_disconnected", this, nameof(OnServerDisconnected));
        GetTree().Connect("connection_failed", this, nameof(OnConnectionFailed));
    }
Beispiel #5
0
 public override void _Ready()
 {
     Window = GetNode <WindowDialog>("Window");
     Text   = GetNode <RichTextLabel>("Window/Container/Text");
     Button = GetNode <Button>("Window/Container/Button");
     Button.Connect("pressed", this, nameof(OnClose));
 }
Beispiel #6
0
    public override void _Ready()
    {
        // Options control buttons
        resetButton = GetNode <Button>(ResetButtonPath);
        saveButton  = GetNode <Button>(SaveButtonPath);

        // Tab selector buttons
        graphicsButton    = GetNode <Button>(GraphicsButtonPath);
        soundButton       = GetNode <Button>(SoundButtonPath);
        performanceButton = GetNode <Button>(PerformanceButtonPath);
        miscButton        = GetNode <Button>(MiscButtonPath);

        // Graphics
        graphicsTab               = GetNode <Control>(GraphicsTabPath);
        vsync                     = GetNode <CheckBox>(VSyncPath);
        fullScreen                = GetNode <CheckBox>(FullScreenPath);
        msaaResolution            = GetNode <OptionButton>(MSAAResolutionPath);
        colourblindSetting        = GetNode <OptionButton>(ColourblindSettingPath);
        chromaticAberrationToggle = GetNode <CheckBox>(ChromaticAberrationTogglePath);
        chromaticAberrationSlider = GetNode <Slider>(ChromaticAberrationSliderPath);

        // Sound
        soundTab       = GetNode <Control>(SoundTabPath);
        masterVolume   = GetNode <Slider>(MasterVolumePath);
        masterMuted    = GetNode <CheckBox>(MasterMutedPath);
        musicVolume    = GetNode <Slider>(MusicVolumePath);
        musicMuted     = GetNode <CheckBox>(MusicMutedPath);
        ambianceVolume = GetNode <Slider>(AmbianceVolumePath);
        ambianceMuted  = GetNode <CheckBox>(AmbianceMutedPath);
        sfxVolume      = GetNode <Slider>(SFXVolumePath);
        sfxMuted       = GetNode <CheckBox>(SFXMutedPath);
        guiVolume      = GetNode <Slider>(GUIVolumePath);
        guiMuted       = GetNode <CheckBox>(GUIMutedPath);

        // Performance
        performanceTab           = GetNode <Control>(PerformanceTabPath);
        cloudInterval            = GetNode <OptionButton>(CloudIntervalPath);
        cloudResolution          = GetNode <OptionButton>(CloudResolutionPath);
        runAutoEvoDuringGameplay = GetNode <CheckBox>(RunAutoEvoDuringGameplayPath);

        // Misc
        miscTab                   = GetNode <Control>(MiscTabPath);
        playIntro                 = GetNode <CheckBox>(PlayIntroPath);
        playMicrobeIntro          = GetNode <CheckBox>(PlayMicrobeIntroPath);
        tutorialsEnabledOnNewGame = GetNode <CheckBox>(TutorialsEnabledOnNewGamePath);
        cheats                = GetNode <CheckBox>(CheatsPath);
        autosave              = GetNode <CheckBox>(AutoSavePath);
        maxAutosaves          = GetNode <SpinBox>(MaxAutoSavesPath);
        maxQuicksaves         = GetNode <SpinBox>(MaxQuickSavesPath);
        tutorialsEnabled      = GetNode <CheckBox>(TutorialsEnabledPath);
        customUsernameEnabled = GetNode <CheckBox>(CustomUsernameEnabledPath);
        customUsername        = GetNode <LineEdit>(CustomUsernamePath);

        backConfirmationBox     = GetNode <WindowDialog>(BackConfirmationBoxPath);
        defaultsConfirmationBox = GetNode <ConfirmationDialog>(DefaultsConfirmationBoxPath);
        errorAcceptBox          = GetNode <AcceptDialog>(ErrorAcceptBoxPath);

        selectedOptionsTab = SelectedOptionsTab.Graphics;
    }
        public bool? ShowDialog(string title, object datacontext)
        {
            var win = new WindowDialog();
            win.Title = title;
            win.DataContext = datacontext;

            return win.ShowDialog();
        }
Beispiel #8
0
        public bool?ShowDialog(string title, object datacontext)
        {
            var win = new WindowDialog();

            win.Title       = title;
            win.DataContext = datacontext;

            return(win.ShowDialog());
        }
Beispiel #9
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        // Set up the menu bar items
        FileButton = GetNode <MenuButton>("MenuBar/btnFile");
        PopupMenu FileButtonPopup = FileButton.GetPopup();

        EditButton = GetNode <MenuButton>("MenuBar/btnEdit");
        PopupMenu EditButtonPopup = EditButton.GetPopup();

        ViewButton = GetNode <MenuButton>("MenuBar/btnView");
        HelpButton = GetNode <MenuButton>("MenuBar/btnHelp");

        // Populate file
        FileButtonPopup.AddItem("New");
        FileButtonPopup.AddItem("Open");
        FileButtonPopup.AddItem("Import");
        FileButtonPopup.AddSeparator();
        FileButtonPopup.AddItem("Save");
        FileButtonPopup.AddItem("Save As");
        FileButtonPopup.AddSeparator();
        FileButtonPopup.AddItem("Preferences");
        FileButtonPopup.AddSeparator();
        FileButtonPopup.AddItem("Exit");
        FileButtonPopup.Connect("id_pressed", this, "FileButtonPressed");

        PreferencesWindow = GetNode <WindowDialog>("/root/main/UI/PreferencesWindow");
        ImportWindow      = GetNode <FileDialog>("/root/main/UI/ImportWindow");
        // Populate edit

        // Create Insert shape submenu
        PopupMenu AddShapeMenu = new PopupMenu();

        AddShapeMenu.Name = "Shape";
        AddShapeMenu.AddItem("Square");
        AddShapeMenu.AddItem("Sphere");
        AddShapeMenu.AddItem("Cylinder");
        AddShapeMenu.AddItem("Prism");
        AddShapeMenu.AddItem("Capsule");
        EditButtonPopup.AddChild(AddShapeMenu);

        EditButtonPopup.AddSubmenuItem("Add Shape", "Shape");



        // Populate view
        ViewButton.GetPopup().AddItem("1");
        ViewButton.GetPopup().AddItem("2");
        ViewButton.GetPopup().AddItem("2alt");
        ViewButton.GetPopup().AddItem("3");
        ViewButton.GetPopup().AddItem("3alt");
        ViewButton.GetPopup().AddItem("4");
        ViewButton.GetPopup().Connect("id_pressed", GetNode("/root/main/UI/AppWindow/EnvironmentContainer/4WayViewport/"), "toolbarViewItemPressed");

        this.Connect("gui_input", this, "TitleBarGUIInputHandler");
        GD.Print("TITLEBAR.CS: READY");
    }
Beispiel #10
0
    public override void _Ready()
    {
        statusLabel           = GetNode <Label>(StatusLabelPath);
        errorDialog           = GetNode <WindowDialog>(ErrorDialogPath);
        extraDescriptionLabel = GetNode <Label>(ExtraErrorDescriptionPath);
        exceptionLabel        = GetNode <Label>(ExceptionPath);

        Visible = false;
        hidden  = true;
    }
Beispiel #11
0
 private void PopupClosed()
 {
     GetTree().Paused = false;
     if (Popup == null)
     {
         return;
     }
     Popup.QueueFree();
     Popup = null;
 }
Beispiel #12
0
    public override void _Ready()
    {
        MTGInstaller.Logger.Subscribe((logger, level, indent, str) => {
            GD.Print($"[{logger.ID} {level}] {str}");
        });
        ServicePointManager.ServerCertificateValidationCallback = _RemoteCertificateValidationCallback;

        MainInterface           = GetNode <VBoxContainer>("MainPanel/ColumnBox/MainInterface");
        AdvancedInterface       = GetNode <VBoxContainer>("MainPanel/ColumnBox/AdvancedInterface");
        HostControllerInterface = GetNode <VBoxContainer>("MainPanel/ColumnBox/HostControllerInterface");
        GungeonPath             = GetNode <LineEdit>("MainPanel/ColumnBox/MainInterface/ExeSelect/LineEdit");

        InstallButton  = GetNode <Button>("MainPanel/ColumnBox/MainInterface/Buttons/Install");
        SettingsButton = GetNode <Button>("MainPanel/ColumnBox/MainInterface/Buttons/Settings");
        ExeFileButton  = GetNode <Button>("MainPanel/ColumnBox/MainInterface/ExeSelect/Button");

        LargeImage = GetNode <TextureRect>("MainPanel/ColumnBox/LeftPane/LargeImage");
        InstallLog = GetNode <TextEdit>("MainPanel/ColumnBox/LeftPane/InstallLog");

        InstallErrorLabel          = GetNode <Label>("MainPanel/ColumnBox/LeftPane/ErrorLabel");
        InstallErrorButtons        = GetNode <HBoxContainer>("MainPanel/ColumnBox/LeftPane/ErrorButtons");
        InstallErrorDiscordButton  = GetNode <Button>("MainPanel/ColumnBox/LeftPane/ErrorButtons/Discord");
        InstallErrorLogHasteButton = GetNode <Button>("MainPanel/ColumnBox/LeftPane/ErrorButtons/LogHaste");

        OptionComponent        = GetNode <LineEdit>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/Component/Content");
        ArchitectureList       = GetNode <MenuButton>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/Architecture/ArchList");
        OptionShowLog          = GetNode <CheckBox>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/Log");
        OptionForceHTTP        = GetNode <CheckBox>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/ForceHTTP");
        OptionSkipVersionCheck = GetNode <CheckBox>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/SkipVersionChecks");
        OptionForceBackup      = GetNode <CheckBox>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/ForceBackup");
        OptionLeavePatchDLLs   = GetNode <CheckBox>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/LeavePatchDLLs");
        OptionOffline          = GetNode <CheckBox>("MainPanel/ColumnBox/AdvancedInterface/Settings/SettingsList/Offline");

        ExeFileDialog       = GetNode <FileDialog>("ExeFileDialog");
        ETGModWarningDialog = GetNode <WindowDialog>("ETGModWarning");

        DoneLabel   = GetNode <Label>("MainPanel/ColumnBox/MainInterface/DoneLabel");
        NewsContent = GetNode <Label>("MainPanel/ColumnBox/MainInterface/NewsContent");

        NewsContent.Text = GetNews();

        CurrentInterface = MainInterface;

        //Logger.Subscribe((logger, loglevel, indent, str) => {
        //	var logline = logger.String(loglevel, str, indent);
        //	QueuedLogText += $"{logline}\n";
        //});

        Console.SetOut(new FieldWriter(this, "QueuedLogText"));


        InitializeGungeonPath();
        InitializeAdvancedSettings();
    }
Beispiel #13
0
    private void onNewItemButton()
    {
        WindowDialog newUser = (WindowDialog)GetNode("NouvelItem");
        Control      control = (Control)GetNode("NouvelItem/Control");
        var          nom     = (LineEdit)control.GetNode("Nom");
        var          prix    = (LineEdit)control.GetNode("Prix");
        Item         nouveau = new Item(nom.Text, Convert.ToDouble(prix.Text));

        current.database.creerItem(nouveau);
        newUser.Hide();
        onItems();
    }
Beispiel #14
0
        private void PopupQuit()
        {
            GetTree().Paused = false;
            Input.SetMouseMode(Input.MouseMode.Visible);
            if (Popup != null)
            {
                Popup.QueueFree();
                Popup = null;
            }

            LoadNewScene(MainMenuPath);
        }
Beispiel #15
0
        public void Main()
        {
            string cMensaje = string.Empty;

            IFabrica Ifabrica = new WebDialog(new HTMLButton());

            cMensaje = Ifabrica.CrearBoton();
            Console.WriteLine(cMensaje);

            Ifabrica = new WindowDialog(new WindowButton());
            cMensaje = Ifabrica.CrearBoton();
            Console.WriteLine(cMensaje);
            Console.ReadLine();
        }
Beispiel #16
0
    public void OnFileNew()
    {
        WindowDialog dialog = (WindowDialog)GetNode(newGlobe);
        int          size   = (int)((SpinBox)dialog.GetNode((NodePath)dialog.Get("size"))).Value;

        ((Spatial)GetNode(anchor)).Transform = normalAnchor;
        ((Camera)GetNode(camera)).Size       = normalSize;

        image = new Image();
        undo  = new Image();

        image.Create(size * 2, size, false, Image.Format.Rgb8);
        Create(image);
    }
Beispiel #17
0
 public override void _Process(float delta)
 {
     if (!Input.IsActionJustPressed("ui_cancel") || Popup != null)
     {
         return;
     }
     Popup = PopupScene.Instance <WindowDialog>();
     Popup.GetNode("Button_quit").Connect("pressed", this, nameof(PopupQuit));
     Popup.Connect("popup_hide", this, nameof(PopupClosed));
     Popup.GetNode("Button_resume").Connect("pressed", this, nameof(PopupClosed));
     CanvasLayer.AddChild(Popup);
     Popup.PopupCentered();
     Input.SetMouseMode(Input.MouseMode.Visible);
     GetTree().Paused = true;
 }
Beispiel #18
0
        public override void _Ready()
        {
            ConsoleEntry  = GD.Load <PackedScene>("Unary.Common/Nodes/ConsoleEntry.tscn");
            AutofillEntry = GD.Load <PackedScene>("Unary.Common/Nodes/AutofillEntry.tscn");

            Window = GetNode <WindowDialog>("Window");

            ConsoleLine = GetNode <LineEdit>("Window/Container/ConsoleLine");
            ConsoleLine.Connect("text_changed", this, nameof(OnTextChanged));

            ConsoleHistory = GetNode <VBoxContainer>("Window/Container/ScrollContainer/ConsoleHistory");

            ScrollBar = GetNode <ScrollContainer>("Window/Container/ScrollContainer").GetVScrollbar();

            Autofill = GetNode <VBoxContainer>("Window/Container/Autofill");

            Message("Reinitialized console!");
        }
Beispiel #19
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));
        }
Beispiel #20
0
    private void onNewUserButton()
    {
        WindowDialog newUser = (WindowDialog)GetNode("NouvelUtilisateur");
        Control      control = (Control)GetNode("NouvelUtilisateur/Control");
        var          surnom  = (LineEdit)control.GetNode("surnom");
        var          nom     = (LineEdit)control.GetNode("nom");
        var          email   = (LineEdit)control.GetNode("email");
        var          mdp     = (LineEdit)control.GetNode("mdp");

        string hash = Hasher.Hash.GetHashString(mdp.Text);

        Utilisateur nouveau = new Utilisateur(nom.Text, surnom.Text, email.Text, hash);

        current.database.creerUtilisateur(nouveau);
        newUser.Hide();
        onUtilisateurs();


        nom.Text    = "";
        surnom.Text = "";
        mdp.Text    = "";
        email.Text  = "";
    }
        public override void _Ready()
        {
            _itemList     = GetNode <ItemList>("CanvasLayer/WindowDialog/ItemList");
            _windowDialog = GetNode <WindowDialog>("CanvasLayer/WindowDialog");

            switch (_itemType)
            {
            case ItemType.LOOT:
                _sourceDict = MetadataLoader.LootItemIdToMetadata;
                break;

            case ItemType.ENTITY:
                _sourceDict = MetadataLoader.EntityIdToMetadata;
                break;
            }

            _items = _sourceDict.Select(x => x.Value).OrderBy(x => x.DisplayName).ToList();
            foreach (var item in _items)
            {
                _itemList.AddItem(FormatButtonText(item.Id));
            }
            _itemList.Connect("item_selected", this, nameof(OnItemSelected));
            Connect("pressed", this, nameof(OnItemButtonPressed));
        }
Beispiel #22
0
    public void OnFilePressed(int id)
    {
        switch (id)
        {
        case 0:     // new
            WindowDialog dialog = (WindowDialog)GetNode(newGlobe);
            dialog.PopupCentered();
            break;

        case 1:     // open
            FileDialog open = (FileDialog)GetNode(openGlobe);
            open.PopupCentered();
            break;

        case 3:     // save
            if (lastSave != null)
            {
                image.SavePng(lastSave);
            }
            else
            {
                FileDialog save1 = (FileDialog)GetNode(saveGlobe);
                save1.PopupCentered();
            }
            break;

        case 4:     // save as
            FileDialog save2 = (FileDialog)GetNode(saveGlobe);
            save2.PopupCentered();
            break;

        case 6:     // quit
            GetTree().Quit();
            break;
        }
    }
Beispiel #23
0
    List <Ingredient> IngredientList = new List <Ingredient>();   //using this to store current list of ingredients so we can query the list easily and update the JSON

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        //get reference to controls
        receiptList               = (ItemList)GetNode("ReceiptList");
        receiptIngredients        = (ItemList)GetNode("ReceiptIngredients");
        receiptTitle              = (LineEdit)GetNode("ReceiptTitle");
        receiptDescription        = (TextEdit)GetNode("ReceiptDescription");
        ingredientsPopup          = (PopupMenu)GetNode("ReceiptIngredients").GetNode("PopupMenu");
        ingredientAmountOption    = (LineEdit)GetNode("AmountOption");
        ingredientVolumeOption    = (OptionButton)GetNode("VolumeOption");
        ingredientOption          = (OptionButton)GetNode("IngredientOption");
        saveFileDialog            = (FileDialog)GetNode("SaveButton").GetNode("FileDialog");
        receiptSearch             = (LineEdit)GetNode("Search");
        receiptsLabel             = (Label)GetNode("ReceiptsLabel");
        searchLabel               = (Label)GetNode("SearchLabel");
        titleLabel                = (Label)GetNode("TitleLabel");
        descriptionLabel          = (Label)GetNode("DescriptionLabel");
        ingredientsLabel          = (Label)GetNode("IngredientsLabel");
        ingredientSearchAddButton = (Button)GetNode("IngredientSearchAddButton");
        ingredientAddButton       = (Button)GetNode("AddIngredientButton");
        saveButton                = (Button)GetNode("SaveButton");
        printButton               = (Button)GetNode("PrintButton");
        updateButton              = (Button)GetNode("UpdateButton");
        deleteButton              = (Button)GetNode("ReceiptIngredients").GetNode("PopupMenu").GetNode("DeleteButton");

        ingredientSearchOption  = (OptionButton)GetNode("IngredientSearchOption");
        ingredientSearchList    = (ItemList)GetNode("IngredientSearchList");
        ingredientSearchPopup   = (PopupMenu)GetNode("IngredientSearchList").GetNode("PopupMenu");
        confirmationPopupDialog = (WindowDialog)GetParent().GetParent().GetNode("ConfirmationWindowDialog");

        //get reference to the file store the receipts
        receiptPath       = Options.ReceiptPath;
        ingredientPath    = Options.IngredientPath;
        volumePath        = Options.VolumePath;
        configurationPath = Options.ConfigurationPath;

        //get language configuration from JSON
        r    = new StreamReader(configurationPath);
        json = r.ReadToEnd();
        r.Close();

        rss = JObject.Parse(json); //convert string to object
        string _language = rss["Language"].ToString();

        //now get the language file
        r    = new StreamReader("data/languages/lang.json");
        json = r.ReadToEnd();
        r.Close();

        rss = JObject.Parse(json);
        string _langFile = rss[_language].ToString();

        //now get all the text for the selected language
        r    = new StreamReader($"data/languages/{_langFile}.json");
        json = r.ReadToEnd();
        r.Close();
        rss = JObject.Parse(json);

        //now change text on all buttons and labels
        this.SetName(rss["Browse"].ToString());
        ingredientsLabel.Text          = rss["Ingredients"].ToString();
        titleLabel.Text                = rss["Title"].ToString();
        descriptionLabel.Text          = rss["Description"].ToString();
        ingredientAddButton.Text       = rss["Add"].ToString();
        ingredientSearchAddButton.Text = rss["Add"].ToString();
        saveButton.Text                = rss["Save"].ToString();
        updateButton.Text              = rss["Update"].ToString();
        printButton.Text               = rss["Print"].ToString();
        deleteButton.Text              = rss["Delete"].ToString();
        searchLabel.Text               = rss["Search"].ToString();
        receiptSearch.HintTooltip      = rss["Search"].ToString();
        receiptSearch.PlaceholderText  = rss["Search"].ToString();
        receiptsLabel.Text             = rss["Receipts"].ToString();
        saveFileDialog.SetTitle(rss["Select folder"].ToString());

        //now get messages we are going to display in popup dialog
        receiptAlreadyExistMsg    = rss["ReceiptAlreadyExistMsg"].ToString();
        ingredientAlreadyExistMsg = rss["IngredientAlreadyExistMsg"].ToString();
        receiptSavedToJsonMsg     = rss["ReceiptSavedToJsonMsg"].ToString();
        receiptSavedToFileMsg     = rss["ReceiptSavedToFileMsg"].ToString();
        receiptUpdatedMsg         = rss["ReceiptUpdatedMsg"].ToString();
    }
Beispiel #24
0
    public override void _Ready()
    {
        // Options control buttons
        resetButton = GetNode <Button>(ResetButtonPath);
        saveButton  = GetNode <Button>(SaveButtonPath);

        // Tab selector buttons
        graphicsButton    = GetNode <Button>(GraphicsButtonPath);
        soundButton       = GetNode <Button>(SoundButtonPath);
        performanceButton = GetNode <Button>(PerformanceButtonPath);
        miscButton        = GetNode <Button>(MiscButtonPath);

        // Graphics
        graphicsTab               = GetNode <Control>(GraphicsTabPath);
        vsync                     = GetNode <CheckBox>(VSyncPath);
        fullScreen                = GetNode <CheckBox>(FullScreenPath);
        msaaResolution            = GetNode <OptionButton>(MSAAResolutionPath);
        colourblindSetting        = GetNode <OptionButton>(ColourblindSettingPath);
        chromaticAberrationToggle = GetNode <CheckBox>(ChromaticAberrationTogglePath);
        chromaticAberrationSlider = GetNode <Slider>(ChromaticAberrationSliderPath);

        // Sound
        soundTab       = GetNode <Control>(SoundTabPath);
        masterVolume   = GetNode <Slider>(MasterVolumePath);
        masterMuted    = GetNode <CheckBox>(MasterMutedPath);
        musicVolume    = GetNode <Slider>(MusicVolumePath);
        musicMuted     = GetNode <CheckBox>(MusicMutedPath);
        ambianceVolume = GetNode <Slider>(AmbianceVolumePath);
        ambianceMuted  = GetNode <CheckBox>(AmbianceMutedPath);
        sfxVolume      = GetNode <Slider>(SFXVolumePath);
        sfxMuted       = GetNode <CheckBox>(SFXMutedPath);
        guiVolume      = GetNode <Slider>(GUIVolumePath);
        guiMuted       = GetNode <CheckBox>(GUIMutedPath);

        // Performance
        performanceTab  = GetNode <Control>(PerformanceTabPath);
        cloudInterval   = GetNode <OptionButton>(CloudIntervalPath);
        cloudResolution = GetNode <OptionButton>(CloudResolutionPath);

        // Misc
        miscTab          = GetNode <Control>(MiscTabPath);
        playIntro        = GetNode <CheckBox>(PlayIntroPath);
        playMicrobeIntro = GetNode <CheckBox>(PlayMicrobeIntroPath);
        tutorialsEnabled = GetNode <CheckBox>(TutorialsEnabledPath);
        cheats           = GetNode <CheckBox>(CheatsPath);
        autosave         = GetNode <CheckBox>(AutoSavePath);
        maxAutosaves     = GetNode <SpinBox>(MaxAutoSavesPath);
        maxQuicksaves    = GetNode <SpinBox>(MaxQuickSavesPath);

        backConfirmationBox     = GetNode <WindowDialog>(BackConfirmationBoxPath);
        defaultsConfirmationBox = GetNode <ConfirmationDialog>(DefaultsConfirmationBoxPath);
        errorAcceptBox          = GetNode <AcceptDialog>(ErrorAcceptBoxPath);

        selectedOptionsTab = SelectedOptionsTab.Graphics;

        // Copy settings from the singleton to serve as a copy of the last saved settings.
        savedSettings = Settings.Instance.Clone();

        // Set the initial state of the options controls to match the settings data.
        ApplySettingsToControls(savedSettings);
        CompareSettings();
    }
Beispiel #25
0
    List <Ingredient> IngredientList = new List <Ingredient>();   //using this to store current list of ingredients so we can query the list easily and write it in to JSON

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        //get reference to data files
        ingredientPath    = Options.IngredientPath;
        volumePath        = Options.VolumePath;
        receiptPath       = Options.ReceiptPath;
        configurationPath = Options.ConfigurationPath;

        //get reference to controls
        volumeOption            = (OptionButton)GetNode("VolumeOption");
        ingredientOption        = (OptionButton)GetNode("IngredientOption");
        amountOption            = (LineEdit)GetNode("AmountOption");
        ingredientList          = (ItemList)GetNode("Ingredients");
        receiptTitle            = (LineEdit)GetNode("Title");
        receiptDescription      = (TextEdit)GetNode("Receipt");
        tabContainer            = (TabContainer)GetParent();
        ingredientsPopup        = (PopupMenu)GetNode("Ingredients").GetNode("PopupMenu");
        confirmationPopupDialog = (WindowDialog)GetParent().GetParent().GetNode("ConfirmationWindowDialog");
        titleLabel          = (Label)GetNode("TitleLabel");
        receiptLabel        = (Label)GetNode("ReceiptLabel");
        ingredientsLabel    = (Label)GetNode("IngredientsLabel");
        ingredientAddButton = (Button)GetNode("AddButton");
        saveButton          = (Button)GetNode("SaveButton");
        deleteButton        = (Button)GetNode("Ingredients").GetNode("PopupMenu").GetNode("DeleteButton");;

        //get language configuration from JSON
        r    = new StreamReader(configurationPath);
        json = r.ReadToEnd();
        r.Close();

        rss = JObject.Parse(json);         //convert string to object
        string _language = rss["Language"].ToString();

        //now get the language file
        r    = new StreamReader("data/languages/lang.json");
        json = r.ReadToEnd();
        r.Close();

        rss = JObject.Parse(json);
        string _langFile = rss[_language].ToString();

        //now get all the text for the selected language
        r    = new StreamReader($"data/languages/{_langFile}.json");
        json = r.ReadToEnd();
        r.Close();
        rss = JObject.Parse(json);

        //now change text on all buttons and labels
        this.SetName(rss["New Receipt"].ToString());
        ingredientsLabel.Text    = rss["Ingredients"].ToString();
        titleLabel.Text          = rss["Title"].ToString();
        receiptLabel.Text        = rss["Description"].ToString();
        ingredientAddButton.Text = rss["Add"].ToString();
        saveButton.Text          = rss["Save"].ToString();
        deleteButton.Text        = rss["Delete"].ToString();

        //now get messages we are going to display in popup dialog
        receiptAlreadyExistMsg    = rss["ReceiptAlreadyExistMsg"].ToString();
        ingredientAlreadyExistMsg = rss["IngredientAlreadyExistMsg"].ToString();
        receiptSavedToJsonMsg     = rss["ReceiptSavedToJsonMsg"].ToString();

        //get file dialog title
    }