void createDialog() { toolDialog = new GUIControl(editor.editorGui); ResourceComponent rc = editor.engine.resourceComponent; //Right menu GUILabel background = new GUILabel(editor.editorGui, editor.editorGui.leftBG, text: "Selection Tool"); background.size = new Vector2(EditorGUI.RIGHTBOUNDARY, editor.engine.graphicsComponent.height - EditorGUI.BOTTOMBOUNDARY); toolDialog.pos = new Vector2(editor.engine.graphicsComponent.width - EditorGUI.RIGHTBOUNDARY, 0); toolDialog.add(background); GUILabel modeLabel = new GUILabel(editor.editorGui, text: "Mode:"); modeLabel.pos = new Vector2(0, 25); toolDialog.add(modeLabel); modeControl = new GUIRadioControl(editor.editorGui); modeControl.addRadioButton((isdown) => { if (isdown) { mode = Mode.select; } }, "Select"); modeControl.addRadioButton((isdown) => { if (isdown) { //Update mode if (copiedTiles == null) { modeControl.pressed = (int)mode; } else { mode = Mode.paste; //Update selection for copying isDragging = true; Vector2 pos = editor.engine.graphicsComponent.camera.world2Screen(selection.topLeft * Tile.size); moveAction(pos); isDragging = false; } } }, "Paste"); modeControl.pos = new Vector2(0, 45); toolDialog.add(modeControl); clearButton = new GUIButton(editor.editorGui, rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/019_buttBack.png"))), rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/018_buttBack.png"))), "Erase"); clearButton.pos = new Vector2(0, 105); toolDialog.add(clearButton); GUILabel selectLabel = new GUILabel(editor.editorGui, text: "Select Mode:"); selectLabel.pos = new Vector2(0, 145); toolDialog.add(selectLabel); copyButton = new GUIButton(editor.editorGui, rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/019_buttBack.png"))), rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/018_buttBack.png"))), "Copy"); copyButton.pos = new Vector2(0, 165); toolDialog.add(copyButton); GUILabel pasteLabel = new GUILabel(editor.editorGui, text: "Paste Mode:"); pasteLabel.pos = new Vector2(0, 205); toolDialog.add(pasteLabel); pasteButton = new GUIButton(editor.editorGui, rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/019_buttBack.png"))), rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/018_buttBack.png"))), "Paste"); pasteButton.pos = new Vector2(0, 225); toolDialog.add(pasteButton); }
/* Attempts to remove, then adds a dialog in succession * Useful for moving a dialog to the front * and refreshing its fields */ public void refreshDialog(GUIControl dialog) { remove(dialog); add(dialog); }
/* Kicks out the previous singular dialog and adds a new one */ public void switchDialogs(GUIControl dialog) { remove(currentDialog); add(dialog); currentDialog = dialog; }
void createDialog() { ResourceComponent rc = editor.engine.resourceComponent; toolDialog = new GUIControl(editor.editorGui); //Right menu GUILabel background = new GUILabel(editor.editorGui, editor.editorGui.leftBG, text: "Pencil Tool"); background.size = new Vector2(EditorGUI.RIGHTBOUNDARY, editor.engine.graphicsComponent.height - EditorGUI.BOTTOMBOUNDARY); toolDialog.pos = new Vector2(editor.engine.graphicsComponent.width - EditorGUI.RIGHTBOUNDARY, 0); toolDialog.add(background); GUILabel textureLabel = new GUILabel(editor.editorGui, text: "Texture"); textureLabel.pos = new Vector2(0, 25); toolDialog.add(textureLabel); textureOverwriteBox = new GUICheckBox(editor.editorGui, editor.currentTile.texture != Mapfile.TileData.IGNORESTRING, "Overwrite"); textureOverwriteBox.pos = new Vector2(0, 40); toolDialog.add(textureOverwriteBox); int numCols = EditorGUI.RIGHTBOUNDARY / Tile.size; int numRows = (editor.engine.graphicsComponent.height / Tile.size) / 3; thumbs = new ScrollingImageTable(editor.editorGui, numRows, numCols, Tile.size, Tile.size, ScrollingImageTable.ScrollDirection.VERTICAL, new Vector2(0, 55)); thumbs.padding = 2; toolDialog.add(thumbs); GUILabel solidityLabel = new GUILabel(editor.editorGui, text: "Solidity"); solidityLabel.pos = new Vector2(0, thumbs.size.y); toolDialog.add(solidityLabel); solidityOverwriteBox = new GUICheckBox(editor.editorGui, editor.currentTile.solidity != Mapfile.TileData.IGNOREBYTE, "Overwrite"); solidityOverwriteBox.pos = new Vector2(0, thumbs.size.y + 15); toolDialog.add(solidityOverwriteBox); solidityCheckBox = new GUICheckBox(editor.editorGui, editor.currentValues.solidity == 1, "Is solid"); solidityCheckBox.pos = new Vector2(0, thumbs.size.y + 30); toolDialog.add(solidityCheckBox); GUILabel opacityLabel = new GUILabel(editor.editorGui, text: "Opacity"); opacityLabel.pos = new Vector2(0, thumbs.size.y + 50); toolDialog.add(opacityLabel); opacityOverwriteBox = new GUICheckBox(editor.editorGui, editor.currentTile.opacityFlip != Mapfile.TileData.IGNOREBYTE, "Overwrite"); opacityOverwriteBox.pos = new Vector2(0, thumbs.size.y + 65); toolDialog.add(opacityOverwriteBox); opacityFlipCheckBox = new GUICheckBox(editor.editorGui, editor.currentValues.opacityFlip == 1, "Is inverted"); opacityFlipCheckBox.pos = new Vector2(0, thumbs.size.y + 80); toolDialog.add(opacityFlipCheckBox); GUILabel behaviorLabel = new GUILabel(editor.editorGui, text: "Behavior"); behaviorLabel.pos = new Vector2(0, thumbs.size.y + 100); toolDialog.add(behaviorLabel); behaviorOverwriteBox = new GUICheckBox(editor.editorGui, editor.currentTile.behavior != Mapfile.TileData.IGNORESTRING, "Overwrite"); behaviorOverwriteBox.pos = new Vector2(0, thumbs.size.y + 115); toolDialog.add(behaviorOverwriteBox); behaviorSetButton = new GUIButton(editor.editorGui, rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/019_buttBack.png"))), rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/018_buttBack.png"))), "Set"); behaviorSetButton.pos = new Vector2(0, thumbs.size.y + 135); toolDialog.add(behaviorSetButton); behaviorRemoveButton = new GUIButton(editor.editorGui, rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/019_buttBack.png"))), rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/018_buttBack.png"))), "Remove"); behaviorRemoveButton.pos = new Vector2(25, thumbs.size.y + 135); toolDialog.add(behaviorRemoveButton); addButton = new GUIButton(editor.editorGui, rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/019_buttBack.png"))), rc.get(Path.GetFullPath(Path.Combine(editor.editorGui.rootDirectory, "GUI/000_EngineGUI/018_buttBack.png"))), "Add custom tile"); addButton.pos = new Vector2(0, background.size.y - 25); toolDialog.add(addButton); }