mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
replaced a hack that starts random game on title screen
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.LoadScreen
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2018-12-08.
|
||||
*/
|
||||
class UIProxyNewBuildingMaker : UICanvas() {
|
||||
|
||||
override var width: Int = 0
|
||||
override var height: Int = 0
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
val ingame = BuildingMaker(Terrarum.batch)
|
||||
|
||||
Terrarum.ingame = ingame
|
||||
LoadScreen.screenToLoad = ingame
|
||||
Terrarum.setScreen(LoadScreen)
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
return super.mouseMoved(screenX, screenY)
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
return super.touchDragged(screenX, screenY, pointer)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchUp(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
return super.scrolled(amount)
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
return super.keyDown(keycode)
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
return super.keyUp(keycode)
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
return super.keyTyped(character)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.LoadScreen
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2018-12-08.
|
||||
*/
|
||||
class UIProxyNewRandomGame : UICanvas() {
|
||||
|
||||
override var width: Int = 0
|
||||
override var height: Int = 0
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
}
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
val ingame = Ingame(Terrarum.batch)
|
||||
ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(2400, 800, HQRNG().nextLong())
|
||||
//ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(8192, 2048, 0x51621DL)
|
||||
ingame.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
||||
|
||||
Terrarum.ingame = ingame
|
||||
LoadScreen.screenToLoad = ingame
|
||||
Terrarum.setScreen(LoadScreen)
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
return super.mouseMoved(screenX, screenY)
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
return super.touchDragged(screenX, screenY, pointer)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchUp(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
return super.scrolled(amount)
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
return super.keyDown(keycode)
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
return super.keyUp(keycode)
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
return super.keyTyped(character)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
@@ -108,27 +108,6 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
|
||||
throw NullPointerException("No parent node to return")
|
||||
}
|
||||
}
|
||||
else if (it.labelText.contains("Start New Random Game")) {
|
||||
if (!startNewGameCalled) {
|
||||
startNewGameCalled = true
|
||||
|
||||
|
||||
printdbg(this, 1)
|
||||
|
||||
val ingame = Ingame(Terrarum.batch)
|
||||
ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(2400, 800, HQRNG().nextLong())
|
||||
//ingame.gameLoadInfoPayload = Ingame.NewWorldParameters(8192, 2048, 0x51621DL)
|
||||
ingame.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
||||
|
||||
printdbg(this, 2)
|
||||
|
||||
Terrarum.ingame = ingame
|
||||
LoadScreen.screenToLoad = ingame
|
||||
Terrarum.setScreen(LoadScreen)
|
||||
|
||||
printdbg(this, 3)
|
||||
}
|
||||
}
|
||||
else {
|
||||
// check if target exists
|
||||
//println("current node: ${currentRemoConContents.data}")
|
||||
|
||||
@@ -7,8 +7,11 @@ import java.util.*
|
||||
|
||||
object UITitleRemoConYaml {
|
||||
|
||||
// YAML indent with a space, separate label and class with " : " (\x20\x3A\x20)
|
||||
|
||||
/**
|
||||
* YAML indent with a space, separate label and class with " : " (\x20\x3A\x20)
|
||||
*
|
||||
* The class must be the UICanvas
|
||||
*/
|
||||
val menus = """
|
||||
- MENU_MODE_SINGLEPLAYER : net.torvald.terrarum.modulebasegame.ui.UITitleCharactersList
|
||||
- CONTEXT_CHARACTER_NEW
|
||||
@@ -34,8 +37,8 @@ object UITitleRemoConYaml {
|
||||
|
||||
val debugTools = """
|
||||
- Development Tools $
|
||||
- Building Maker
|
||||
- Start New Random Game
|
||||
- Building Maker : net.torvald.terrarum.modulebasegame.ui.UIProxyNewBuildingMaker
|
||||
- Start New Random Game : net.torvald.terrarum.modulebasegame.ui.UIProxyNewRandomGame
|
||||
- MENU_LABEL_RETURN
|
||||
""".trimIndent()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user