Created
December 31, 2018 16:43
-
-
Save Trivaxy/a8a7f9c1789414f145176d1ffce61b84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.trivaxy.offlinemodgen | |
import javafx.geometry.Pos | |
import javafx.scene.control.Button | |
import javafx.scene.control.Label | |
import javafx.scene.control.TextField | |
import javafx.scene.layout.VBox | |
import javafx.scene.paint.Color | |
import javafx.stage.DirectoryChooser | |
import tornadofx.* | |
import java.io.File | |
class MainView : View() { | |
var directoryLabel: Label = Label("Chosen directory: None") | |
var statusLabel: Label = Label("") | |
var nameField: TextField = TextField(Controller.MOD_NAME) | |
var versionField: TextField = TextField(Controller.MOD_VERSION) | |
var authorField: TextField = TextField(Controller.MOD_AUTHOR) | |
var displayNameField: TextField = TextField(Controller.MOD_DISPLAY_NAME) | |
override val root = VBox() | |
init { | |
title = "tModLoader Offline Mod Skeleton Generator" | |
with(root) { | |
this.alignment = Pos.BASELINE_CENTER | |
this += directoryLabel | |
this += Button("Choose directory").apply { | |
action { | |
val chooser = DirectoryChooser() | |
val dir: File? = chooser.showDialog(currentStage) | |
if (dir == null) { | |
directoryLabel.text = "Chosen directory: None" | |
Controller.DIRECTORY = "" | |
} | |
else { | |
Controller.DIRECTORY = dir.absolutePath | |
directoryLabel.text = "Chosen directory: " + Controller.DIRECTORY | |
} | |
} | |
} | |
this += hbox { | |
paddingTop = 3 | |
alignment = Pos.BASELINE_CENTER | |
label("Mod name: ") | |
this += nameField | |
label(" Mod version: ") | |
this += versionField | |
} | |
this += hbox { | |
alignment = Pos.BASELINE_CENTER | |
paddingTop = 3 | |
paddingRight = 25 | |
label("Mod display name: ") | |
this += displayNameField | |
label(" Mod author: ") | |
this += authorField | |
} | |
this += label("(Mod name/version cannot have spaces or special symbols!)").apply { | |
paddingTop = 4 | |
textFill = Color.web("#ff0303") | |
} | |
this += Button("Generate mod skeleton").apply { | |
action { | |
Controller.MOD_NAME = nameField.text | |
Controller.MOD_VERSION = versionField.text | |
Controller.MOD_AUTHOR = authorField.text | |
Controller.MOD_DISPLAY_NAME = displayNameField.text | |
statusLabel.text = Controller.getStatusMessage() | |
Controller.generateModSkeleton() | |
} | |
} | |
this += statusLabel.apply { | |
paddingTop = 3 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment