Search in sources :

Example 1 with GuiElementTextBox

use of micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementTextBox in project Galacticraft by micdoodle8.

the class GuiLaunchController method onTextChanged.

@Override
public void onTextChanged(GuiElementTextBox textBox, String newText) {
    if (PlayerUtil.getName(this.mc.thePlayer).equals(this.launchController.getOwnerName())) {
        if (textBox.equals(this.frequency)) {
            this.launchController.frequency = textBox.getIntegerValue();
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 0, this.launchController.getPos(), this.launchController.frequency }));
        } else if (textBox.equals(this.destinationFrequency)) {
            this.launchController.destFrequency = textBox.getIntegerValue();
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 2, this.launchController.getPos(), this.launchController.destFrequency }));
        }
    }
}
Also used : PacketSimpleMars(micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars)

Example 2 with GuiElementTextBox

use of micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementTextBox in project Galacticraft by micdoodle8.

the class GuiAirLockController method onTextChanged.

@Override
public void onTextChanged(GuiElementTextBox textBox, String newText) {
    if (textBox.equals(this.textBoxPlayerToOpenFor)) {
        this.controller.playerToOpenFor = newText != null ? newText : "";
        GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_STRING, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 0, this.controller.getPos(), this.controller.playerToOpenFor }));
    }
}
Also used : PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple)

Example 3 with GuiElementTextBox

use of micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementTextBox in project Galacticraft by micdoodle8.

the class GuiShortRangeTelepad method onTextChanged.

@Override
public void onTextChanged(GuiElementTextBox textBox, String newText) {
    if (textBox.equals(this.address)) {
        this.telepad.address = textBox.getIntegerValue();
        GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleAsteroids(PacketSimpleAsteroids.EnumSimplePacketAsteroids.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { 0, this.telepad.getPos(), this.telepad.address }));
    } else if (textBox.equals(this.targetAddress)) {
        this.telepad.targetAddress = textBox.getIntegerValue();
        GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleAsteroids(PacketSimpleAsteroids.EnumSimplePacketAsteroids.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { 1, this.telepad.getPos(), this.telepad.targetAddress }));
    }
}
Also used : PacketSimpleAsteroids(micdoodle8.mods.galacticraft.planets.asteroids.network.PacketSimpleAsteroids)

Example 4 with GuiElementTextBox

use of micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementTextBox in project Galacticraft by micdoodle8.

the class GuiNewSpaceRace method initGui.

@Override
public void initGui() {
    float sliderR = 0;
    float sliderG = 0;
    float sliderB = 0;
    if (this.sliderColorR != null && this.sliderColorG != null && this.sliderColorB != null) {
        sliderR = this.sliderColorR.getSliderPos() / (float) this.sliderColorR.getButtonHeight();
        sliderG = this.sliderColorG.getSliderPos() / (float) this.sliderColorG.getButtonHeight();
        sliderB = this.sliderColorB.getSliderPos() / (float) this.sliderColorB.getButtonHeight();
    }
    super.initGui();
    this.buttonList.clear();
    if (this.initialized) {
        this.buttonFlag_width = 81;
        this.buttonFlag_height = 58;
        this.buttonFlag_xPosition = this.width / 2 - this.buttonFlag_width / 2;
        this.buttonFlag_yPosition = this.height / 2 - this.height / 3 + 10;
        this.buttonTeamColor_width = 45;
        this.buttonTeamColor_height = 45;
        this.buttonTeamColor_xPosition = this.buttonFlag_xPosition + this.buttonFlag_width + 10;
        this.buttonTeamColor_yPosition = this.buttonFlag_yPosition + this.buttonFlag_height / 2 - this.buttonTeamColor_height / 2;
        this.buttonList.add(new GuiElementGradientButton(0, this.width / 2 - this.width / 3 + 15, this.height / 2 - this.height / 4 - 15, 50, 15, this.currentState == EnumSpaceRaceGui.MAIN ? GCCoreUtil.translate("gui.space_race.create.close.name") : GCCoreUtil.translate("gui.space_race.create.back.name")));
        switch(this.currentState) {
            case MAIN:
                this.textBoxRename = new GuiElementTextBox(1, this, this.width / 2 - 75, this.buttonFlag_yPosition + this.buttonFlag_height + 10, 150, 16, GCCoreUtil.translate("gui.space_race.create.rename.name"), false, 25, true);
                this.buttonList.add(this.textBoxRename);
                if (this.canEdit) {
                    this.buttonList.add(new GuiElementGradientButton(2, this.width / 2 - 120, this.textBoxRename.yPosition + this.height / 10, 100, this.height / 10, GCCoreUtil.translate("gui.space_race.create.add_players.name")));
                    this.buttonList.add(new GuiElementGradientButton(3, this.width / 2 - 120, this.textBoxRename.yPosition + this.height / 10 + this.height / 10 + this.height / 50, 100, this.height / 10, GCCoreUtil.translate("gui.space_race.create.rem_players.name")));
                }
                GuiElementGradientButton localStats = new GuiElementGradientButton(4, this.width / 2 + (this.canEdit ? 20 : -50), this.textBoxRename.yPosition + this.height / 10, 100, this.height / 10, GCCoreUtil.translate("gui.space_race.create.server_stats.name"));
                GuiElementGradientButton serverStats = new GuiElementGradientButton(5, this.width / 2 + (this.canEdit ? 20 : -50), this.textBoxRename.yPosition + this.height / 10 + this.height / 10 + this.height / 50, 100, this.height / 10, GCCoreUtil.translate("gui.space_race.create.global_stats.name"));
                localStats.enabled = false;
                serverStats.enabled = false;
                this.buttonList.add(localStats);
                this.buttonList.add(serverStats);
                break;
            case ADD_PLAYER:
                this.buttonList.add(new GuiElementGradientButton(2, this.width / 2 - this.width / 3 + 7, this.height / 2 + this.height / 4 - 15, 64, 15, GCCoreUtil.translate("gui.space_race.create.send_invite.name")));
                int xPos0 = ((GuiElementGradientButton) this.buttonList.get(0)).xPosition + ((GuiElementGradientButton) this.buttonList.get(0)).getButtonWidth() + 10;
                int xPos1 = this.width / 2 + this.width / 3 - 10;
                int yPos0 = this.height / 2 - this.height / 3 + 10;
                int yPos1 = this.height / 2 + this.height / 3 - 10;
                this.gradientListAddPlayers = new GuiElementGradientList(xPos0, yPos0, xPos1 - xPos0, yPos1 - yPos0);
                break;
            case REMOVE_PLAYER:
                this.buttonList.add(new GuiElementGradientButton(2, this.width / 2 - this.width / 3 + 7, this.height / 2 + this.height / 4 - 15, 64, 15, GCCoreUtil.translate("gui.space_race.create.remove.name")));
                int xPos0b = ((GuiElementGradientButton) this.buttonList.get(0)).xPosition + ((GuiElementGradientButton) this.buttonList.get(0)).getButtonWidth() + 10;
                int xPos1b = this.width / 2 + this.width / 3 - 10;
                int yPos0b = this.height / 2 - this.height / 3 + 10;
                int yPos1b = this.height / 2 + this.height / 3 - 10;
                this.gradientListRemovePlayers = new GuiElementGradientList(xPos0b, yPos0b, xPos1b - xPos0b, yPos1b - yPos0b);
                break;
            case DESIGN_FLAG:
                int guiBottom = this.height / 2 + this.height / 4;
                int guiTop = this.height / 2 - this.height / 4;
                int guiRight = this.width / 2 + this.width / 3;
                int guiLeft;
                this.flagDesignerScale = new Vector2(this.width / 130.0F, this.height / 70.0F);
                this.flagDesignerMinX = this.width / 2 - this.spaceRaceData.getFlagData().getWidth() * (float) this.flagDesignerScale.x / 2;
                this.flagDesignerMinY = this.height / 2 - this.spaceRaceData.getFlagData().getHeight() * (float) this.flagDesignerScale.y / 2;
                this.flagDesignerWidth = this.spaceRaceData.getFlagData().getWidth() * (float) this.flagDesignerScale.x;
                this.flagDesignerHeight = this.spaceRaceData.getFlagData().getHeight() * (float) this.flagDesignerScale.y;
                int flagDesignerRight = (int) (this.flagDesignerMinX + this.flagDesignerWidth);
                int availWidth = (int) ((guiRight - 10 - (this.flagDesignerMinX + this.flagDesignerWidth + 10)) / 3);
                float x1 = flagDesignerRight + 10;
                float x2 = guiRight - 10;
                float y1 = guiBottom - 10 - (x2 - x1);
                int height = (int) (y1 - 10 - (guiTop + 10));
                this.sliderColorR = new GuiElementSlider(1, flagDesignerRight + 10, guiTop + 10, availWidth, height, true, new Vector3(0, 0, 0), new Vector3(1, 0, 0));
                this.sliderColorG = new GuiElementSlider(2, flagDesignerRight + 11 + availWidth, guiTop + 10, availWidth, height, true, new Vector3(0, 0, 0), new Vector3(0, 1, 0));
                this.sliderColorB = new GuiElementSlider(3, flagDesignerRight + 12 + availWidth * 2, guiTop + 10, availWidth, height, true, new Vector3(0, 0, 0), new Vector3(0, 0, 1));
                this.sliderColorR.setSliderPos(sliderR);
                this.sliderColorG.setSliderPos(sliderG);
                this.sliderColorB.setSliderPos(sliderB);
                this.buttonList.add(this.sliderColorR);
                this.buttonList.add(this.sliderColorG);
                this.buttonList.add(this.sliderColorB);
                this.checkboxPaintbrush = new GuiElementCheckbox(5, this, (int) (this.flagDesignerMinX - 15), this.height / 2 - this.height / 4 + 10, 13, 13, 26, 26, 133, 0, "", 4210752, false);
                this.checkboxEraser = new GuiElementCheckbox(6, this, (int) (this.flagDesignerMinX - 15), this.height / 2 - this.height / 4 + 25, 13, 13, 26, 26, 133, 52, "", 4210752, false);
                this.checkboxSelector = new GuiElementCheckbox(7, this, (int) (this.flagDesignerMinX - 15), this.height / 2 - this.height / 4 + 40, 13, 13, 26, 26, 133, 78, "", 4210752, false);
                this.checkboxColorSelector = new GuiElementCheckbox(8, this, (int) (this.flagDesignerMinX - 15), this.height / 2 - this.height / 4 + 55, 13, 13, 26, 26, 133, 104, "", 4210752, false);
                this.checkboxShowGrid = new GuiElementCheckbox(9, this, (int) (this.flagDesignerMinX - 15), this.height / 2 - this.height / 4 + 90, 13, 13, 26, 26, 133, 26, "", 4210752, false);
                this.sliderBrushSize = new GuiElementSlider(10, this.checkboxPaintbrush.xPosition - 40, this.checkboxPaintbrush.yPosition, 35, 13, false, new Vector3(0.34, 0.34, 0.34), new Vector3(0.34, 0.34, 0.34), GCCoreUtil.translate("gui.space_race.create.brush_size.name"));
                this.sliderEraserSize = new GuiElementSlider(11, this.checkboxEraser.xPosition - 40, this.checkboxEraser.yPosition, 35, 13, false, new Vector3(0.34, 0.34, 0.34), new Vector3(0.34, 0.34, 0.34), GCCoreUtil.translate("gui.space_race.create.eraser_size.name"));
                this.sliderEraserSize.visible = false;
                this.buttonList.add(this.checkboxPaintbrush);
                this.buttonList.add(this.checkboxShowGrid);
                this.buttonList.add(this.checkboxEraser);
                this.buttonList.add(this.checkboxSelector);
                this.buttonList.add(this.checkboxColorSelector);
                this.buttonList.add(this.sliderBrushSize);
                this.buttonList.add(this.sliderEraserSize);
                break;
            case CHANGE_TEAM_COLOR:
                guiBottom = this.height / 2 + this.height / 4;
                guiTop = this.height / 2 - this.height / 4;
                guiLeft = this.width / 6;
                guiRight = this.width / 2 + this.width / 3;
                flagDesignerRight = guiLeft;
                availWidth = (guiRight - guiLeft - 100) / 3;
                x1 = flagDesignerRight + 10;
                x2 = guiLeft - 10;
                y1 = guiBottom - 10 - (x2 - x1);
                height = (int) (y1 - 10 - (guiTop + 30));
                this.sliderColorR = new GuiElementSlider(1, flagDesignerRight + 25, guiTop + 30, availWidth, height, true, new Vector3(0, 0, 0), new Vector3(1, 0, 0));
                this.sliderColorG = new GuiElementSlider(2, flagDesignerRight + availWidth + 50, guiTop + 30, availWidth, height, true, new Vector3(0, 0, 0), new Vector3(0, 1, 0));
                this.sliderColorB = new GuiElementSlider(3, flagDesignerRight + availWidth * 2 + 75, guiTop + 30, availWidth, height, true, new Vector3(0, 0, 0), new Vector3(0, 0, 1));
                this.sliderColorR.setSliderPos(this.spaceRaceData.getTeamColor().floatX());
                this.sliderColorG.setSliderPos(this.spaceRaceData.getTeamColor().floatY());
                this.sliderColorB.setSliderPos(this.spaceRaceData.getTeamColor().floatZ());
                this.buttonList.add(this.sliderColorR);
                this.buttonList.add(this.sliderColorG);
                this.buttonList.add(this.sliderColorB);
                break;
            default:
                break;
        }
    }
}
Also used : Vector2(micdoodle8.mods.galacticraft.api.vector.Vector2) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 5 with GuiElementTextBox

use of micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementTextBox in project Galacticraft by micdoodle8.

the class GuiAirLockController method initGui.

@Override
public void initGui() {
    super.initGui();
    this.buttonList.clear();
    final int var5 = (this.width - this.xSize) / 2;
    final int var6 = (this.height - this.ySize) / 2;
    this.checkboxRedstoneSignal = new GuiElementCheckbox(0, this, this.width / 2 - 84, var6 + 18, GCCoreUtil.translate("gui.checkbox.redstone_signal.name"));
    this.checkboxPlayerDistance = new GuiElementCheckbox(1, this, this.width / 2 - 84, var6 + 33, GCCoreUtil.translate("gui.checkbox.player_within.name") + ": ");
    String[] dropboxStrings = { GCCoreUtil.translate("gui.dropbox.player_distance.name.0"), GCCoreUtil.translate("gui.dropbox.player_distance.name.1"), GCCoreUtil.translate("gui.dropbox.player_distance.name.2"), GCCoreUtil.translate("gui.dropbox.player_distance.name.3") };
    this.dropdownPlayerDistance = new GuiElementDropdown(2, this, var5 + 99, var6 + 32, dropboxStrings);
    this.checkboxOpenForPlayer = new GuiElementCheckbox(3, this, this.width / 2 - 68, var6 + 49, GCCoreUtil.translate("gui.checkbox.player_name.name") + ": ");
    this.textBoxPlayerToOpenFor = new GuiElementTextBox(4, this, this.width / 2 - 61, var6 + 64, 110, 15, "", false, 16, false);
    this.checkboxInvertSelection = new GuiElementCheckbox(5, this, this.width / 2 - 84, var6 + 80, GCCoreUtil.translate("gui.checkbox.invert.name"));
    this.checkboxHorizontalMode = new GuiElementCheckbox(6, this, this.width / 2 - 84, var6 + 96, GCCoreUtil.translate("gui.checkbox.horizontal.name"));
    this.buttonList.add(this.checkboxRedstoneSignal);
    this.buttonList.add(this.checkboxPlayerDistance);
    this.buttonList.add(this.dropdownPlayerDistance);
    this.buttonList.add(this.checkboxOpenForPlayer);
    this.buttonList.add(this.textBoxPlayerToOpenFor);
    this.buttonList.add(this.checkboxInvertSelection);
    this.buttonList.add(this.checkboxHorizontalMode);
}
Also used : GuiElementCheckbox(micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementCheckbox) GuiElementTextBox(micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementTextBox) GuiElementDropdown(micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementDropdown)

Aggregations

GuiElementTextBox (micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementTextBox)3 ArrayList (java.util.ArrayList)2 GuiElementInfoRegion (micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementInfoRegion)2 GuiButton (net.minecraft.client.gui.GuiButton)2 Vector2 (micdoodle8.mods.galacticraft.api.vector.Vector2)1 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)1 GuiElementCheckbox (micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementCheckbox)1 GuiElementDropdown (micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementDropdown)1 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)1 PacketSimpleAsteroids (micdoodle8.mods.galacticraft.planets.asteroids.network.PacketSimpleAsteroids)1 PacketSimpleMars (micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars)1