-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Derek Smart <derek@grindaga.com>
- Loading branch information
Showing
6 changed files
with
85 additions
and
15 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.grindaga.crissaegrim.objects | ||
|
||
import tornadofx.* | ||
|
||
data class Stats ( | ||
val HP: Int, | ||
val HPMax: Int, | ||
val Hearts: Int, | ||
val HeartsMax: Int, | ||
val MP: Int, | ||
val MPMax: Int, | ||
val STR: Int, | ||
val CON: Int, | ||
val INT: Int, | ||
val LCK: Int, | ||
val ATTBonus: Int | ||
): ViewModel() |
40 changes: 40 additions & 0 deletions
40
src/main/kotlin/com/grindaga/crissaegrim/service/FileService.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.grindaga.crissaegrim.service | ||
|
||
import com.grindaga.crissaegrim.objects.Card | ||
import javafx.stage.FileChooser | ||
import tornadofx.* | ||
import java.io.File | ||
|
||
object FileService { | ||
private val mcrFilter = FileChooser.ExtensionFilter("mednafen files (*.mcr)", "*.mcr") | ||
private val allFilter = FileChooser.ExtensionFilter("all files (*.*)", "*.*") | ||
|
||
fun openFile(targetFile: File? = null) { | ||
val file: File | ||
|
||
if (targetFile == null) { | ||
// If the user didn't select, then finish this method. | ||
file = getFile() ?: return | ||
} else { | ||
file = targetFile | ||
} | ||
|
||
try { | ||
val saveFile = File(file.toString()).inputStream() | ||
val card = Card.load(file.toString(), saveFile) | ||
println(card.slots[1]) | ||
//ModelManager.textModel.textProperty.set(text) | ||
//ModelManager.fileModel.fileProperty.set(file) | ||
} catch (e: Exception) { | ||
println(e) | ||
} | ||
} | ||
|
||
private fun getFile(): File? { | ||
val fileList = chooseFile("Select PS1 Memory Card", arrayOf(mcrFilter, allFilter), FileChooserMode.Single) | ||
return when (fileList.isEmpty()) { | ||
true -> null | ||
else -> fileList.first() | ||
} | ||
} | ||
} |
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
9 changes: 6 additions & 3 deletions
9
src/main/kotlin/com/grindaga/crissaegrim/views/CharacterView.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package com.grindaga.crissaegrim.views | ||
|
||
import tornadofx.* | ||
import tornadofx.Form | ||
|
||
class CharacterView : View("My View") { | ||
override val root = form { | ||
|
||
override val root = form { | ||
fieldset("Character Stats") { | ||
field("HP") { | ||
textfield() | ||
} | ||
} | ||
} | ||
|
||
} |
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