Esempio n. 1
0
    public void OpenPopup()
    {
        var popup = new AcceptDialog();

        popup.SizeFlagsHorizontal = (int)Control.SizeFlags.ExpandFill;
        popup.SizeFlagsVertical   = (int)Control.SizeFlags.ExpandFill;
        popup.PopupExclusive      = true;
        popup.WindowTitle         = "Configure snap";
        var container = new VBoxContainer();
        var snapSpin  = new SpinBox();

        snapSpin.MinValue = 0;
        snapSpin.MaxValue = 99;
        snapSpin.Step     = 0.0001f;
        snapSpin.Value    = snapLength;
        snapSpin.Connect("value_changed", this, "SetSnapLength");
        var snapHBox  = new HBoxContainer();
        var snapLabel = new Label();

        snapLabel.Text = "Snap length";
        snapHBox.AddChild(snapLabel);
        snapHBox.AddChild(snapSpin);
        container.AddChild(snapHBox);
        popup.AddChild(container);

        popup.Connect("popup_hide", popup, "queue_free");
        baseControl.AddChild(popup);

        popup.PopupCentered(new Vector2(200, 100));
    }
Esempio n. 2
0
        public override void DrawInterface(Control parent)
        {
            Control sizeScaleField  = moduleInterface.AddField("Size Scale");
            Control bouncinessField = moduleInterface.AddField("Bounciness");
            Control marginField     = moduleInterface.AddField("Margin");

            SpinBox sizeScaleSpinBox  = moduleInterface.AddSpinBox(sizeScaleField);
            SpinBox bouncinessSpinBox = moduleInterface.AddSpinBox(bouncinessField);
            SpinBox marginSpinBox     = moduleInterface.AddSpinBox(marginField);

            sizeScaleSpinBox.MinValue = 0f;
            sizeScaleSpinBox.MaxValue = 1f;
            sizeScaleSpinBox.Step     = 0.01f;
            sizeScaleSpinBox.Value    = sizeScale;

            bouncinessSpinBox.MinValue = 0f;
            bouncinessSpinBox.MaxValue = 1f;
            bouncinessSpinBox.Step     = 0.01f;
            bouncinessSpinBox.Value    = bounciness;

            marginSpinBox.MinValue = 0f;
            marginSpinBox.MaxValue = 1f;
            marginSpinBox.Step     = 0.01f;
            marginSpinBox.Value    = margin;

            sizeScaleSpinBox.Connect("value_changed", this, "OnSizeScaleValueChanged");
            bouncinessSpinBox.Connect("value_changed", this, "OnBouncinessValueChanged");
            marginSpinBox.Connect("value_changed", this, "OnMarginValueChanged");
        }
Esempio n. 3
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);
        }
    }
Esempio n. 4
0
    public override Control BuildUI()
    {
        HBoxContainer VecUI    = new HBoxContainer();
        SpinBox       spinboxX = new SpinBox();
        SpinBox       spinboxY = new SpinBox();

        spinboxX.MaxValue = 10000;
        spinboxY.MaxValue = 10000;
        spinboxX.Step     = 0.01;
        spinboxY.Step     = 0.01;
        spinboxX.Value    = ((Vector2)this.Value).x;
        spinboxY.Value    = ((Vector2)this.Value).x;
        VecUI.AddChild(spinboxX);
        VecUI.AddChild(spinboxY);

        /* TODO Vec2Props currently not working because here I pass the individual spin box
         * values instead of a vector2 */
        spinboxX.Connect(
            "value_changed",
            Shaderer.instance,
            nameof(Shaderer.instance.OnApplyParam),
            new Godot.Collections.Array {
            this.NameCode
        });
        spinboxY.Connect(
            "value_changed",
            Shaderer.instance,
            nameof(Shaderer.instance.OnApplyParam),
            new Godot.Collections.Array {
            this.NameCode
        });
        return(VecUI);
    }
        public override void _Ready()
        {
            base._Ready();
            Model.EventId  = GameEventDispatcher.ITEM_TURNED_IN;
            _itemSelector  = GetNode <QuestItemSelector>("VBoxContainer/HBoxContainer/QuestItemSelector");
            _amountSpinBox = GetNode <SpinBox>("VBoxContainer/HBoxContainer2/SpinBox");

            _amountSpinBox.Connect("value_changed", this, nameof(OnAmountChanged));
            _itemSelector.Connect(nameof(QuestItemSelector.ItemSelected), this, nameof(OnItemSelected));
        }
Esempio n. 6
0
        public override void _Ready()
        {
            base._Ready();
            Model.EventId = GameEventDispatcher.PLAYER_INVENTORY_ITEM_UPDATED;

            _itemSelector    = GetNode <QuestItemSelector>("VBoxContainer/HBoxContainer/QuestItemSelector");
            _requiredSpinBox = GetNode <SpinBox>("VBoxContainer/HBoxContainer2/SpinBox");
            _requiredSpinBox.Connect("value_changed", this, nameof(OnRequiredChanged));
            _itemSelector.Connect(nameof(QuestItemSelector.ItemSelected), this, nameof(OnItemSelected));
        }
Esempio n. 7
0
        public override void _Ready()
        {
            base._Ready();
            Model          = new QuestRewardModel();
            _itemSelector  = GetNode <QuestItemSelector>("VBoxContainer/QuestItemSelector");
            _amountSpinBox = GetNode <SpinBox>("VBoxContainer/HBoxContainer/SpinBox");
            _idLineEdit    = GetNode <LineEdit>("VBoxContainer/LineEdit");

            _itemSelector.Connect(nameof(QuestItemSelector.ItemSelected), this, nameof(OnItemSelected));
            _amountSpinBox.Connect("value_changed", this, nameof(OnValueChanged));
        }
Esempio n. 8
0
        public override void DrawInterface(Control parent)
        {
            Control field = moduleInterface.AddField("Rate");

            SpinBox rateEditor = moduleInterface.AddSpinBox(field);

            rateEditor.MinValue     = 0f;
            rateEditor.MaxValue     = 100f;
            rateEditor.Step         = .01f;
            rateEditor.AllowGreater = true;
            rateEditor.Value        = rate;

            rateEditor.Connect("value_changed", this, "OnRateValueChanged");
        }
Esempio n. 9
0
 public override void _Ready()
 {
     number = GetChild <SpinBox>(0);
     slider = GetChild <Slider>(1);
     number.Connect("value_changed", this, nameof(ValuesChanged));
     slider.Connect("value_changed", this, nameof(ValuesChanged));
     number.MaxValue = max;
     slider.MaxValue = max;
     slider.MinValue = min;
     number.MinValue = min;
     GetChild <RichTextLabel>(2).BbcodeText = "[center]" + name + "[/center]";
     number.Value = SettingsOptions.GetSetting <float>(optionName) * multiplier;
     slider.Value = number.Value;
     SettingsOptions.RegisterUpdatedEvent(UpdateValue);
 }
Esempio n. 10
0
    public override Control BuildUI()
    {
        SpinBox spinBox = new SpinBox();

        //spinBox.RectMinSize = new Vector2(120, 0);
        spinBox.MinValue = 0;
        spinBox.MaxValue = this.max;
        spinBox.Value    = (int)this.Value;
        spinBox.Connect(
            "value_changed",
            Shaderer.instance,
            nameof(Shaderer.instance.OnApplyParam),
            new Godot.Collections.Array {
            this.NameCode
        });
        return(spinBox);
    }
Esempio n. 11
0
    public override void _Ready()
    {
        lbTitle            = GetNode("title") as Label;
        nLayer             = GetNode("CLayer/nLayer") as SpinBox;
        nCollision         = GetNode("CColl/nColl") as SpinBox;
        addLayer           = GetNode("CLayer/btAddLayer") as Button;
        addCollision       = GetNode("CColl/btAddColl") as Button;
        layerContainer     = GetNode("CLayer/grid") as GridContainer;
        collisionContainer = GetNode("CColl/grid") as GridContainer;



        nLayer.Connect("value_changed", this, nameof(changedLayerValue));
        nCollision.Connect("value_changed", this, nameof(changedCollisionValue));
        addLayer.Connect("pressed", this, nameof(addMaskLayer));
        addCollision.Connect("pressed", this, nameof(addMaskCollision));
    }
Esempio n. 12
0
    public override void _Ready()
    {
        // if (!Engine.EditorHint) return;
        actionLineEdit  = GetNode <LineEdit>("action");
        gamepadButton   = GetNode <Button>("gamepad");
        keyboardButton  = GetNode <Button>("keyboard");
        deadzoneSpinBox = GetNode <SpinBox>("deadzone");
        addButton       = GetNode <Button>("add");

        actionLineEdit.Connect("text_changed", this, nameof(on_text_changed));

        gamepadButton.Connect("pressed", this, nameof(on_text_changed_in_gamepad));
        keyboardButton.Connect("pressed", this, nameof(on_text_changed_in_keyboard));

        deadzoneSpinBox.Connect("value_changed", this, nameof(on_value_change));

        addButton.Connect("pressed", this, nameof(on_add_input_map));
    }
Esempio n. 13
0
        public override void DrawInterface(Control parent)
        {
            Control sizeCurveField      = moduleInterface.AddField("Curve");
            Control sizeMultiplierField = moduleInterface.AddField("Size Multiplier");

            CurveEditor sizeCurveEditor      = moduleInterface.AddCurveEditor(sizeCurveField);
            SpinBox     sizeMultiplierEditor = moduleInterface.AddSpinBox(sizeMultiplierField);

            sizeCurveEditor.curve = curve;

            sizeMultiplierEditor.MinValue     = 0f;
            sizeMultiplierEditor.MaxValue     = 2f;
            sizeMultiplierEditor.Step         = 0.01f;
            sizeMultiplierEditor.AllowGreater = true;
            sizeMultiplierEditor.Value        = sizeMultiplier;

            sizeCurveEditor.Connect("CurveChanged", this, "OnCurveChanged");
            sizeMultiplierEditor.Connect("value_changed", this, "OnSizeMultiplierValueChanged");
        }
Esempio n. 14
0
    public void Init(Config config)
    {
        this.config = config;

        //General

        seed.Value      = config.map.seed;
        latitude.Value  = config.map.latitude;
        longitude.Value = config.map.longitude;

        seed.Connect("value_changed", this, "BoxTriggered");
        longitude.Connect("value_changed", this, "BoxTriggered");
        latitude.Connect("value_changed", this, "BoxTriggered");

        //Precipitation
        circulationIntensitySlider.Value = config.precipitation.circulation_intensity;
        circulationIntensityBox.Value    = config.precipitation.circulation_intensity;

        precipitationIntesitySlider.Value = config.precipitation.precipitation_intensity;
        precipitationIntesityBox.Value    = config.precipitation.precipitation_intensity;

        maxPrecipitationSlider.Value = config.precipitation.max_precipitation;
        maxPrecipitationBox.Value    = config.precipitation.max_precipitation;

        circulationIntensityBox.Connect("value_changed", this, "BoxTriggered");
        precipitationIntesityBox.Connect("value_changed", this, "BoxTriggered");
        maxPrecipitationBox.Connect("value_changed", this, "BoxTriggered");

        circulationIntensitySlider.Connect("value_changed", this, "SliderTriggered");
        precipitationIntesitySlider.Connect("value_changed", this, "SliderTriggered");
        maxPrecipitationSlider.Connect("value_changed", this, "SliderTriggered");

        //Circulation

        windIntesitySlider.Value = config.circulation.wind_intensity;
        windIntesityBox.Value    = config.circulation.wind_intensity;

        windRangeSlider.Value = config.circulation.wind_range;
        windRangeBox.Value    = config.circulation.wind_range;

        pressureAtSeaLevelBox.Value = config.circulation.pressure_at_sea_level;

        windIntesityBox.Connect("value_changed", this, "BoxTriggered");
        windRangeBox.Connect("value_changed", this, "BoxTriggered");
        pressureAtSeaLevelBox.Connect("value_changed", this, "BoxTriggered");

        windIntesitySlider.Connect("value_changed", this, "SliderTriggered");
        windRangeSlider.Connect("value_changed", this, "SliderTriggered");

        //Transpiration
        transpirationSlider.Value = config.humidity.transpiration;
        transpirationBox.Value    = config.humidity.transpiration;

        evaporationSlider.Value = config.humidity.evaporation;
        evaporationBox.Value    = config.humidity.evaporation;

        transpirationBox.Connect("value_changed", this, "BoxTriggered");
        evaporationBox.Connect("value_changed", this, "BoxTriggered");

        transpirationSlider.Connect("value_changed", this, "SliderTriggered");
        evaporationSlider.Connect("value_changed", this, "SliderTriggered");

        //Temperature
        minTemperatureSlider.Value = config.temperature.min_temperature;
        minTemperatureBox.Value    = config.temperature.min_temperature;

        maxTemperatureSlider.Value = config.temperature.max_temperature;
        maxTemperatureBox.Value    = config.temperature.max_temperature;

        maxTemperatureBox.Connect("value_changed", this, "BoxTriggered");
        minTemperatureBox.Connect("value_changed", this, "BoxTriggered");

        maxTemperatureSlider.Connect("value_changed", this, "SliderTriggered");
        minTemperatureSlider.Connect("value_changed", this, "SliderTriggered");

        //Elevation
        minElevation.Value    = config.elevation.min_elevation;
        maxElevation.Value    = config.elevation.max_elevation;
        waterLevel.Value      = config.elevation.water_level;
        frequencyBox.Value    = config.elevation.frequency;
        frequencySlider.Value = config.elevation.frequency;
        octavesBox.Value      = config.elevation.octaves;
        octavesSlider.Value   = config.elevation.octaves;

        minElevation.Connect("value_changed", this, "BoxTriggered");
        maxElevation.Connect("value_changed", this, "BoxTriggered");
        waterLevel.Connect("value_changed", this, "BoxTriggered");
        frequencyBox.Connect("value_changed", this, "BoxTriggered");
        frequencySlider.Connect("value_changed", this, "SliderTriggered");
        octavesBox.Connect("value_changed", this, "BoxTriggered");
        octavesSlider.Connect("value_changed", this, "SliderTriggered");
    }