Compare commits
7 Commits
99719f5b79
...
witch-quee
| Author | SHA256 | Date | |
|---|---|---|---|
| 858971d1db | |||
| 5aba0fc70a | |||
| afe82dbd2a | |||
| 1cc46a94fe | |||
| 4de5a8f88b | |||
| 89ff480c2e | |||
| c009746bc4 |
File diff suppressed because it is too large
Load Diff
@@ -1,21 +0,0 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Container
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||
import ktx.assets.toInternalFile
|
||||
|
||||
open class Button(val upTexturePath: String, val downTexturePath: String, val fontPath: String, val defaultText: String = "New Button", val useDefaultFont: Boolean = true, val fontScale: Float = 1f) {
|
||||
val buttonText = defaultText
|
||||
val buttonUp = TextureRegionDrawable(Texture(upTexturePath))
|
||||
val buttonDown = TextureRegionDrawable(Texture(downTexturePath))
|
||||
val buttonFont = (if (useDefaultFont) BitmapFont() else BitmapFont(fontPath.toInternalFile())).apply { data.scale(fontScale) }
|
||||
|
||||
val buttonStyle = TextButtonStyle().apply { up = buttonUp; down = buttonDown; font = buttonFont }
|
||||
|
||||
val button = TextButton(defaultText, buttonStyle)
|
||||
val container = Container<TextButton>(button)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
class Client(val hostAddress: String, val hostPort: Int, val playerProfile: PlayerProfile) {
|
||||
val preparedItems: MutableList<Int> = mutableListOf(0, 0, 0, 0) // Item ID. 0 for no item
|
||||
lateinit var map: Map
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
class Game(val clients: Array<Client>) {
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
import ktx.app.KtxScreen
|
||||
import ktx.app.clearScreen
|
||||
|
||||
class GameScreen(val players: List<Player>, val map: Map) : KtxScreen {
|
||||
override fun render(delta: Float) {
|
||||
super.render(delta)
|
||||
clearScreen(0.15f, 0.15f, 0.3f)
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Net
|
||||
|
||||
class Lobby {
|
||||
//val localServers: MutableSetOf<String> = setOf<String>() <-- HashSet?
|
||||
|
||||
//val localPlayer: Player = <-- Should be local player. Has all their items etc.
|
||||
//val lobby: MutableList<Player> = listOf<Player>(localPlayer) <-- Limit to lobby size (2)?
|
||||
|
||||
val serverSocket = Gdx.net.newServerSocket(
|
||||
Net.Protocol.TCP,
|
||||
"127.0.0.1",
|
||||
2864,
|
||||
null
|
||||
)
|
||||
|
||||
val clientSocket = Gdx.net.newClientSocket(
|
||||
Net.Protocol.TCP,
|
||||
"127.0.0.1", // <- This should be other servers address
|
||||
2864, // <- This should be other servers port
|
||||
null
|
||||
)
|
||||
|
||||
val inputStream = clientSocket.inputStream
|
||||
|
||||
private fun findLocalServer() {
|
||||
Gdx.app.log("Lobby", "Finding local server...")
|
||||
|
||||
}
|
||||
|
||||
private fun replayHasLocalServer(remoteAddress: String, remotePort: Int) {
|
||||
Gdx.app.log("Lobby", "Pinged by another client. Informing that we have an open lobby...")
|
||||
}
|
||||
|
||||
private fun connectToServer(ip: String, port: Int) { // String is the ideal type for ip because v6 uses letters too?
|
||||
Gdx.app.log("Lobby", "Connecting to $ip on port $port...")
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,9 @@ import ktx.graphics.use
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class Main : KtxGame<KtxScreen>() {
|
||||
//val mainMenu = MainMenu()
|
||||
//val screenManager = ScreenManager.apply { switchScreen(mainMenu) }
|
||||
|
||||
override fun create() {
|
||||
KtxAsync.initiate()
|
||||
|
||||
// addScreen(FirstScreen())
|
||||
// setScreen<FirstScreen>()
|
||||
addScreen(MainMenu())
|
||||
setScreen<MainMenu>()
|
||||
}
|
||||
|
||||
@@ -2,242 +2,57 @@ package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g3d.ModelCache
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Container
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Value
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||
import com.badlogic.gdx.utils.Logger
|
||||
import com.badlogic.gdx.utils.Scaling
|
||||
import com.badlogic.gdx.utils.viewport.ScreenViewport
|
||||
import com.badlogic.gdx.utils.viewport.StretchViewport
|
||||
import com.badlogic.gdx.utils.viewport.Viewport
|
||||
import ktx.actors.centerPosition
|
||||
import ktx.actors.setPosition
|
||||
import ktx.actors.stage
|
||||
import ktx.app.KtxScreen
|
||||
import ktx.app.clearScreen
|
||||
import javax.swing.text.View
|
||||
|
||||
class MainMenu : KtxScreen {
|
||||
val myTable = Table().apply {
|
||||
debug = true
|
||||
setFillParent(true)
|
||||
}
|
||||
val myStage = Stage().apply {
|
||||
Gdx.input.inputProcessor = this
|
||||
addActor(myTable)
|
||||
// We need this to get the size of the table later
|
||||
//myTable.setSize(viewport.screenWidth.toFloat(), viewport.screenHeight.toFloat())
|
||||
}
|
||||
val stage = Stage()
|
||||
|
||||
//region Map Button
|
||||
val mapButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val mapButton = ImageButton(mapButtonStyle).apply {
|
||||
myTable.add(this)
|
||||
myTable.getCell<ImageButton>(this)
|
||||
}
|
||||
//endregion
|
||||
val table = Table()
|
||||
var tableWidthPadAmount = 0.8f
|
||||
var tableHeightPadAmount = 0.8f
|
||||
|
||||
//endregion
|
||||
//region Player Buttons
|
||||
// Local Player
|
||||
// Remote Player
|
||||
val remotePlayerButton = PlayerButton().apply {
|
||||
myTable.row()
|
||||
myTable.add(this.playerGroup)
|
||||
myTable.getCell<HorizontalGroup>(this.playerGroup) // You've got to size the sub actors!
|
||||
}
|
||||
|
||||
//region Play Buttons
|
||||
val casualButtonStyle = TextButton.TextButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default_flipped.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
//region Buttons
|
||||
val defaultButtonTrd = TextureRegionDrawable(Texture("default.png"))
|
||||
val flippedDefaultButtonTrd = TextureRegionDrawable(Texture("default_flipped.png"))
|
||||
val defaultTextButtonStyle = TextButton.TextButtonStyle (
|
||||
defaultButtonTrd,
|
||||
flippedDefaultButtonTrd,
|
||||
defaultButtonTrd,
|
||||
BitmapFont()
|
||||
)
|
||||
val casualButton = TextButton("Casual", casualButtonStyle)
|
||||
|
||||
val competitiveButtonStyle = TextButton.TextButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
BitmapFont()
|
||||
)
|
||||
val competitiveButton = TextButton("Competitive", competitiveButtonStyle)
|
||||
|
||||
// We need to wrap the play buttons in a group so they only take up 1 column
|
||||
val playButtonGroup = HorizontalGroup().apply {
|
||||
addActor(casualButton)
|
||||
addActor(competitiveButton)
|
||||
myTable.row()
|
||||
myTable.add(this)
|
||||
myTable.getCell<HorizontalGroup>(this)
|
||||
}
|
||||
val defaultButton = TextButton("Default Button", defaultTextButtonStyle)
|
||||
//endregion
|
||||
|
||||
private fun update(delta: Float) {
|
||||
if (casualButton.isPressed) {
|
||||
Gdx.app.log("MainMenu", "Casual Button Pressed!")
|
||||
}
|
||||
}
|
||||
override fun show() {
|
||||
// Stage Setup
|
||||
Gdx.input.inputProcessor = stage
|
||||
stage.addActor(table)
|
||||
|
||||
// Table Setup
|
||||
table.debug = true
|
||||
table.setPosition(
|
||||
stage.width * ((1 - tableWidthPadAmount) / 2),
|
||||
stage.height * ((1 - tableHeightPadAmount) / 2)
|
||||
) // This centres the table
|
||||
table.setSize(stage.width * tableWidthPadAmount, stage.height * tableHeightPadAmount)
|
||||
|
||||
table.add(defaultButton).growX().height(Value.percentWidth(9f / 32f, table)) // We use a FreeTypeFontGenerator to do font sizing maybe?
|
||||
}
|
||||
override fun render(delta: Float) {
|
||||
clearScreen(0.3f, 0.3f, 0.3f)
|
||||
clearScreen(0f, 0f, 0f)
|
||||
|
||||
myStage.act(delta)
|
||||
myStage.draw()
|
||||
|
||||
update(delta)
|
||||
stage.act(delta)
|
||||
stage.draw()
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
myStage.dispose()
|
||||
stage.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
//class MainMenu : KtxScreen {
|
||||
// val viewport = ScreenViewport().apply {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// val table = Table().apply {
|
||||
// setFillParent(true)
|
||||
// debug = true
|
||||
// }
|
||||
// val stage = Stage(viewport).apply {
|
||||
// Gdx.app.log("WitchQueen", "Width: " + viewport.screenWidth.toString() + " Height: " + viewport.screenHeight.toString())
|
||||
//
|
||||
// Gdx.input.inputProcessor = this
|
||||
// addActor(table)
|
||||
// }
|
||||
//
|
||||
// // Map Selection Button
|
||||
//
|
||||
// // Player Table
|
||||
//// val inviteButton = Button(
|
||||
//// "default.png",
|
||||
//// "default_flipped.png",
|
||||
//// "",
|
||||
//// "Invite Player",
|
||||
//// true,
|
||||
//// 2f
|
||||
//// ).apply {
|
||||
//// table.add(this.button).size(1024f, 512f)
|
||||
//// table.row()
|
||||
//// }
|
||||
//
|
||||
// // Invite Player Button
|
||||
// val playerPlaceholderButtonUp = TextureRegionDrawable(Texture("player-frame-up.png"))
|
||||
// val playerPlaceholderButtonDown = TextureRegionDrawable(Texture("player-frame-down.png"))
|
||||
// val playerPlaceholderButtonChecked = TextureRegionDrawable(Texture("player-frame-up.png"))
|
||||
// val playerPlaceholderButtonStyle = ImageButton.ImageButtonStyle()
|
||||
// .apply { up = playerPlaceholderButtonUp; down = playerPlaceholderButtonDown; checked = playerPlaceholderButtonChecked }
|
||||
// val playerPlaceholderButton = ImageButton(playerPlaceholderButtonStyle)
|
||||
// val playerPlaceholderContainer = Container<ImageButton>(playerPlaceholderButton).apply {
|
||||
// width(viewport.screenWidth * 0.8f)
|
||||
// height(((viewport.screenWidth * 0.8f) * 9f) / 32f) // container.width is 0. We need to work out the width again.
|
||||
// padLeft(0f)
|
||||
// }
|
||||
//
|
||||
// val player1TableButton = PlayerTableButton().apply { // These should only be collections no t buttons?
|
||||
// container.width(viewport.screenWidth * 0.8f)
|
||||
// container.height(500f)
|
||||
// //container.height(((viewport.screenWidth * 0.8f) * 9f) / 32f) // container.width is 0. We need to work out the width again.
|
||||
// container.padLeft(0f)
|
||||
// }
|
||||
// val player2TableButton = PlayerTableButton() // Since the collection contains the buttons we need anyway?
|
||||
// val playerTableButtonCollection = VerticalGroup().apply {
|
||||
// addActor(player1TableButton.container)
|
||||
// addActor(playerPlaceholderContainer)
|
||||
// table.add(this)
|
||||
// table.row()
|
||||
// }
|
||||
//
|
||||
// // Casual Button
|
||||
// val casualButton = Button(
|
||||
// "default.png",
|
||||
// "default_flipped.png",
|
||||
// "",
|
||||
// "Casual",
|
||||
// true,
|
||||
// 2f
|
||||
// ).apply { // Could probably do this in Button. Just take in width and aspect ratio and padding?
|
||||
// container.width(viewport.screenWidth * 0.375f)
|
||||
// container.height(((viewport.screenWidth * 0.375f) * 3f) / 4) // container.width is 0. We need to work out the width again.
|
||||
// container.padLeft(viewport.screenWidth * 0.1f)
|
||||
// }
|
||||
//
|
||||
// // Competitive Button
|
||||
// val competitiveButton = Button(
|
||||
// "default.png",
|
||||
// "default_flipped.png",
|
||||
// "",
|
||||
// "Competitive",
|
||||
// true,
|
||||
// 2f
|
||||
// ).apply {
|
||||
// container.width(viewport.screenWidth * 0.375f)
|
||||
// container.height(((viewport.screenWidth * 0.375f) * 3f) / 4) // container.width is 0. We need to work out the width again.
|
||||
// container.padLeft(viewport.screenWidth * 0.05f)
|
||||
// }
|
||||
//
|
||||
// val playButtonGroup = HorizontalGroup().apply {
|
||||
// addActor(casualButton.container)
|
||||
// addActor(competitiveButton.container)
|
||||
//
|
||||
// table.add(this).width(viewport.screenWidth.toFloat())
|
||||
// }
|
||||
//
|
||||
// // Methods
|
||||
// private fun processInput() {
|
||||
// casualButton.button.addListener(object : ClickListener() {
|
||||
// override fun touchUp(
|
||||
// event: InputEvent?,
|
||||
// x: Float,
|
||||
// y: Float,
|
||||
// pointer: Int,
|
||||
// button: Int
|
||||
// ) {
|
||||
// Gdx.app.log("My Project", "Clicked!")
|
||||
// //setScreen()
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// override fun resize(width: Int, height: Int) {
|
||||
// super.resize(width, height)
|
||||
// stage.viewport.update(width, height, true)
|
||||
// }
|
||||
//
|
||||
// override fun render(delta: Float) {
|
||||
// super.render(delta)
|
||||
// clearScreen(0f, 255f, 0f)
|
||||
//
|
||||
// processInput()
|
||||
//
|
||||
// stage.act(delta)
|
||||
// stage.draw()
|
||||
// }
|
||||
//
|
||||
// override fun dispose() {
|
||||
// stage.dispose()
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
class Map {
|
||||
class Map(val mapType: MapType) {
|
||||
val rooms = Array(2) { Array<Room>(2) { Room(mapType) } } // We use an array instead of list i think
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
enum class MapType {
|
||||
DUNGEON, STREETS
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
class Player {
|
||||
val name = String()
|
||||
enum class PlayerState {
|
||||
IDLE, LOOTING, FIGHTING
|
||||
}
|
||||
|
||||
class Player(val map: Map) {
|
||||
var currentState = PlayerState.IDLE
|
||||
val currentRoom = arrayOf(0, 0) // Make this a spawn room or something
|
||||
}
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Container
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||
|
||||
class PlayerButton {
|
||||
enum class STATE { EMPTY, CONNECTING, FILLED }
|
||||
|
||||
// Player Profile
|
||||
val profileButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val profileButton = ImageButton(profileButtonStyle)
|
||||
|
||||
// Player Username
|
||||
val usernameStyle = Label.LabelStyle(BitmapFont(), Color.BLACK)
|
||||
val username = Label("default", usernameStyle)
|
||||
|
||||
//region Player Items
|
||||
val item1ButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val item1Button = ImageButton(item1ButtonStyle)
|
||||
val item2ButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val item2Button = ImageButton(item2ButtonStyle)
|
||||
val item3ButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val item3Button = ImageButton(item3ButtonStyle)
|
||||
val item4ButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val item4Button = ImageButton(item4ButtonStyle)
|
||||
//endregion
|
||||
|
||||
// Leave Lobby - Only shows for local player on local player's button
|
||||
val leaveButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val leaveButton = ImageButton(leaveButtonStyle)
|
||||
|
||||
// Kick Player - Only shows for local player on remote player's button
|
||||
val kickButtonStyle = ImageButton.ImageButtonStyle(
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png")),
|
||||
TextureRegionDrawable(Texture("default.png"))
|
||||
)
|
||||
val kickButton = ImageButton(kickButtonStyle)
|
||||
|
||||
val itemGroup = HorizontalGroup().apply {
|
||||
addActor(item1Button)
|
||||
addActor(item2Button)
|
||||
addActor(item3Button)
|
||||
addActor(item4Button)
|
||||
}
|
||||
|
||||
val nameAndItemGroup = VerticalGroup().apply {
|
||||
addActor(username)
|
||||
addActor(itemGroup)
|
||||
}
|
||||
|
||||
val playerGroup = HorizontalGroup().apply {
|
||||
addActor(profileButton)
|
||||
addActor(nameAndItemGroup)
|
||||
addActor(kickButton)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
class PlayerProfile {
|
||||
var iconPath = "default.png"
|
||||
var username = "Default"
|
||||
val availableItems: MutableList<Int> = mutableListOf() // Use Item IDs?
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Container
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||
import ktx.assets.toInternalFile
|
||||
|
||||
class PlayerTableButton(val playerIconPath: String = "default.png", val newPlayerName: String = "PLAYER"):
|
||||
Table() {
|
||||
val playerIcon = Image(Texture(playerIconPath))
|
||||
val playerNameStyle = Label.LabelStyle(BitmapFont("default.fnt".toInternalFile()), Color.WHITE)
|
||||
val playerName = Label(newPlayerName, playerNameStyle)
|
||||
// Change preparedItems and kickButton into actual buttons
|
||||
var preparedItems: MutableList<Image> = mutableListOf( // We should use libGDX scene2d.ui List?
|
||||
Image(Texture("prepared-item-frame.png")),
|
||||
Image(Texture("prepared-item-frame.png")),
|
||||
Image(Texture("prepared-item-frame.png")),
|
||||
Image(Texture("prepared-item-frame.png"))
|
||||
)
|
||||
val preparedItemsGroup = HorizontalGroup().apply {
|
||||
for (item in preparedItems) addActor(item)
|
||||
}
|
||||
val kickButton = Image(Texture("red-x.png"))
|
||||
|
||||
// Sub-table for Player/Items stack - Use VerticalGroup instead
|
||||
// val playerPlusItemsStack = Table().apply {
|
||||
// add(playerName)
|
||||
// row()
|
||||
// for (item in preparedItems) add(item)
|
||||
// }
|
||||
val playerLabelPlusItemsGroup = VerticalGroup().apply {
|
||||
addActor(playerName)
|
||||
addActor(preparedItemsGroup)
|
||||
}
|
||||
|
||||
// Sub-table for the contents of the PlayerTableButton - Use HorizontalGroup instead
|
||||
// val subTable = Table().apply {
|
||||
// add(playerName, playerPlusItemsStack, kickButton)
|
||||
// }
|
||||
val componentCollection = HorizontalGroup().apply {
|
||||
addActor(playerIcon)
|
||||
addActor(playerLabelPlusItemsGroup)
|
||||
addActor(kickButton)
|
||||
}
|
||||
|
||||
// Base Button stuff
|
||||
val buttonUp = TextureRegionDrawable(Texture("transparent.png"))
|
||||
val buttonDown = TextureRegionDrawable(Texture("transparent.png"))
|
||||
val buttonChecked = TextureRegionDrawable(Texture("transparent.png"))
|
||||
|
||||
val buttonStyle = ButtonStyle().apply { up = buttonUp; down = buttonDown; checked = buttonChecked }
|
||||
|
||||
val button = Button(componentCollection, buttonStyle)
|
||||
|
||||
val container = Container<HorizontalGroup>(componentCollection)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
class PlayerTablePlaceholderButton {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
enum class RoomActivity {
|
||||
EMPTY, LOOT, FIGHT
|
||||
}
|
||||
|
||||
class Room(val mapType: MapType) {
|
||||
var availableActivities: MutableList<RoomActivity> = mutableListOf()
|
||||
init {
|
||||
// Generate Room in this init block!
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.iofferyoutea.WitchQueen
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import kotlinx.coroutines.*
|
||||
import ktx.app.KtxScreen
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
object ScreenManager {
|
||||
var currentScreen: WeakReference<KtxScreen>? = null
|
||||
val screens: MutableSet<WeakReference<KtxScreen>> = mutableSetOf<WeakReference<KtxScreen>>() // Does this need to be mutable?
|
||||
|
||||
fun switchScreen(newScreen: WeakReference<KtxScreen>): Boolean {
|
||||
if (!screens.contains(newScreen)) {
|
||||
Gdx.app.log("ScreenManager", "newScreen not found in screens. Adding...")
|
||||
screens.add(newScreen)
|
||||
}
|
||||
|
||||
currentScreen = screens.find { it == newScreen }
|
||||
|
||||
return currentScreen != null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user