streamer mode wip

This commit is contained in:
minjaesong
2021-10-06 00:18:39 +09:00
parent 907dc9a936
commit 2c6dc8750a
19 changed files with 82 additions and 57 deletions

View File

@@ -10,18 +10,19 @@ import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_HO
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_VRT
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_X
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.internalWidth
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.controlHelpHeight
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.internalWidth
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.createInvCellGenericKeyDownFun
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.createInvCellGenericTouchDownFun
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
internal class UIInventoryCells(
val full: UIInventoryFull
) : UICanvas() {
override var width: Int = App.scr.width
override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height
override var openCloseTime: Second = 0.0f
@@ -52,7 +53,7 @@ internal class UIInventoryCells(
private val equipped: UIItemInventoryEquippedView =
UIItemInventoryEquippedView(
full,
internalWidth - UIItemInventoryEquippedView.WIDTH + (App.scr.width - internalWidth) / 2,
internalWidth - UIItemInventoryEquippedView.WIDTH + (width - internalWidth) / 2,
INVENTORY_CELLS_OFFSET_Y,
{ rebuildList() }
)

View File

@@ -9,6 +9,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_UI_HEIGHT
import net.torvald.terrarum.serialise.WriteSavegame
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItem
import net.torvald.terrarum.ui.UIItemTextButtonList
@@ -17,7 +18,7 @@ import java.io.File
class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
override var width: Int = App.scr.width
override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height
override var openCloseTime = 0.0f
@@ -32,7 +33,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
private val gameMenuListWidth = 400
private val gameMenuButtons = UIItemTextButtonList(
this, DEFAULT_LINE_HEIGHT, gameMenu,
(App.scr.width - gameMenuListWidth) / 2,
(width - gameMenuListWidth) / 2,
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2,
gameMenuListWidth, gameMenuListHeight,
readFromLang = true,
@@ -45,7 +46,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
)
private val areYouSureMainMenuButtons = UIItemTextButtonList(
this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_RETURN_MAIN_QUESTION", "MENU_LABEL_RETURN_MAIN", "MENU_LABEL_CANCEL"),
(App.scr.width - gameMenuListWidth) / 2,
(width - gameMenuListWidth) / 2,
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3,
readFromLang = true,
@@ -58,7 +59,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
)
private val areYouSureQuitButtons = UIItemTextButtonList(
this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_DESKTOP_QUESTION", "MENU_LABEL_DESKTOP", "MENU_LABEL_CANCEL"),
(App.scr.width - gameMenuListWidth) / 2,
(width - gameMenuListWidth) / 2,
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3,
readFromLang = true,

View File

@@ -11,6 +11,7 @@ import net.torvald.terrarum.App.*
import net.torvald.terrarum.blockstats.MinimapComposer
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemHorizontalFadeSlide
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
@@ -28,7 +29,7 @@ class UIInventoryFull(
val actor: ActorHumanoid
get() = INGAME.actorNowPlaying!!
override var width: Int = App.scr.width
override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height
override var openCloseTime: Second = 0.0f
@@ -48,7 +49,7 @@ class UIInventoryFull(
val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.listGap
val INVENTORY_CELLS_UI_HEIGHT: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryItemGrid.listGap
val INVENTORY_CELLS_OFFSET_X = 0 + (App.scr.width - internalWidth) / 2
val INVENTORY_CELLS_OFFSET_X = 0 + (Toolkit.drawWidth - internalWidth) / 2
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (App.scr.height - internalHeight) / 2
val catBarWidth = 330
@@ -148,7 +149,7 @@ class UIInventoryFull(
val catBar = UIItemInventoryCatBar(
this,
(App.scr.width - catBarWidth) / 2,
(width - catBarWidth) / 2,
42 + (App.scr.height - internalHeight) / 2,
internalWidth,
catBarWidth,
@@ -162,9 +163,9 @@ class UIInventoryFull(
private val transitionalEscMenu = UIInventoryEscMenu(this)
private val transitionPanel = UIItemHorizontalFadeSlide(
this,
(App.scr.width - internalWidth) / 2,
(width - internalWidth) / 2,
INVENTORY_CELLS_OFFSET_Y,
App.scr.width,
width,
App.scr.height,
1f,
transitionalMinimap, transitionalItemCells, transitionalEscMenu
@@ -213,7 +214,7 @@ class UIInventoryFull(
}
internal var offsetX = ((App.scr.width - internalWidth) / 2).toFloat()
internal var offsetX = ((width - internalWidth) / 2).toFloat()
private set
internal var offsetY = ((App.scr.height - internalHeight) / 2).toFloat()
private set
@@ -234,7 +235,7 @@ class UIInventoryFull(
//private val gradHeight = 48f
private val shapeRenderer = ShapeRenderer()
internal var xEnd = (App.scr.width + internalWidth).div(2).toFloat()
internal var xEnd = (width + internalWidth).div(2).toFloat()
private set
internal var yEnd = (App.scr.height + internalHeight).div(2).toFloat()
private set
@@ -299,10 +300,10 @@ class UIInventoryFull(
override fun resize(width: Int, height: Int) {
super.resize(width, height)
offsetX = ((App.scr.width - internalWidth) / 2).toFloat()
offsetX = ((width - internalWidth) / 2).toFloat()
offsetY = ((App.scr.height - internalHeight) / 2).toFloat()
xEnd = (App.scr.width + internalWidth).div(2).toFloat()
xEnd = (width + internalWidth).div(2).toFloat()
yEnd = (App.scr.height + internalHeight).div(2).toFloat()
}
}

View File

@@ -9,13 +9,14 @@ import net.torvald.terrarum.*
import net.torvald.terrarum.blockstats.MinimapComposer
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_UI_HEIGHT
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
private val debugvals = true
override var width: Int = App.scr.width
override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height
override var openCloseTime = 0.0f
@@ -115,23 +116,23 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
batch.begin()
if (debugvals) {
App.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (App.scr.width - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
App.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (width - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
}
batch.projectionMatrix = camera.combined
// 1px stroke
batch.color = Color.WHITE
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
batch.fillRect(-1 + (App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
batch.fillRect((width - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
batch.fillRect((width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
batch.fillRect(-1 + (width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
batch.fillRect((width - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
// control hints
batch.color = Color.WHITE
App.fontGame.draw(batch, full.minimapControlHelp, full.offsetX, full.yEnd - 20)
// the minimap
batch.draw(minimapFBO.colorBufferTexture, (App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
batch.draw(minimapFBO.colorBufferTexture, (width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
}
override fun doOpening(delta: Float) {}

View File

@@ -31,7 +31,7 @@ class UIKeyboardControlPanel : UICanvas() {
override var height = 600
override var openCloseTime = 0f
private val drawX = (App.scr.width - width) / 2
private val drawX = (Toolkit.drawWidth - width) / 2
private val drawY = (App.scr.height - height) / 2
internal val kbx = drawX + 61
@@ -128,7 +128,7 @@ class UIKeyboardControlPanel : UICanvas() {
private val symbolGrapplingHook = labels.get(5,1)
private val symbolGamemenu = labels.get(6,2)
private val controlPalette = UIItemControlPaletteBaloon(this, (App.scr.width - 480) / 2, kby + 219)
private val controlPalette = UIItemControlPaletteBaloon(this, (Toolkit.drawWidth - 480) / 2, kby + 219)
init {
keycaps.values.forEach { addUIitem(it) }

View File

@@ -44,7 +44,7 @@ class UILoadDemoSavefiles : UICanvas() {
}
override var width: Int
get() = App.scr.width
get() = Toolkit.drawWidth
set(value) {}
override var height: Int
get() = App.scr.height
@@ -107,7 +107,7 @@ class UILoadDemoSavefiles : UICanvas() {
// read savegames
var savegamesCount = 0
App.savegames.forEach { skimmer ->
val x = uiX
val x = uiX + if (App.getConfigBoolean("fx_streamerslayout")) App.scr.chatWidth / 2 else 0
val y = titleTopGradEnd + cellInterval * savegamesCount
try {
addUIitem(UIItemDemoSaveCells(this, x, y, skimmer))

View File

@@ -5,15 +5,16 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.jme3.math.FastMath
import net.torvald.terrarum.App
import net.torvald.terrarum.ItemCodex
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.COMMON_OPEN_CLOSE
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.SLOT_COUNT
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import org.dyn4j.geometry.Vector2
import net.torvald.terrarum.*
/**
* The Sims styled pie representation of the Quickslot.
@@ -49,7 +50,7 @@ class UIQuickslotPie : UICanvas() {
// update controls
if (handler.isOpened || handler.isOpening) {
val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble())
val centre = Vector2(App.scr.halfw.toDouble(), App.scr.halfh.toDouble())
val centre = Vector2(Toolkit.drawWidth / 2.0, App.scr.halfh.toDouble())
val deg = -(centre - cursorPos).direction.toFloat()
selection = Math.round(deg * slotCount / FastMath.TWO_PI)

View File

@@ -11,6 +11,7 @@ import net.torvald.terrarum.QNDTreeNode
import net.torvald.terrarum.TitleScreen
import net.torvald.terrarum.Yaml
import net.torvald.terrarum.serialise.WriteConfig
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextButton
import net.torvald.terrarum.ui.UIItemTextButtonList
@@ -309,7 +310,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
val remoConWidth = 160
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
val menubarOffX: Int; get() = (0.11 * App.scr.width).toInt()
val menubarOffX: Int; get() = (0.11 * Toolkit.drawWidth).toInt()
val menubarOffY: Int; get() = (0.82 * App.scr.height).toInt()
}
}

View File

@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.App
import net.torvald.terrarum.Second
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextButtonList
@@ -32,7 +33,7 @@ class UITitleLanguage : UICanvas() {
private val textArea1 = UIItemTextButtonList(this,
textButtonLineHeight,
localeFirstHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(),
(App.scr.width - width) / 2, (App.scr.height - height) / 2,
(Toolkit.drawWidth - width) / 2, (App.scr.height - height) / 2,
width / 2, height,
textAreaWidth = width / 2,
readFromLang = false,
@@ -45,7 +46,7 @@ class UITitleLanguage : UICanvas() {
private val textArea2 = UIItemTextButtonList(this,
textButtonLineHeight,
localeSecondHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(),
(App.scr.width - width) / 2 + (width / 2), (App.scr.height - height) / 2,
(Toolkit.drawWidth - width) / 2 + (width / 2), (App.scr.height - height) / 2,
width / 2, height,
textAreaWidth = width / 2,
readFromLang = false,