72 lines
2.6 KiB
GDScript
72 lines
2.6 KiB
GDScript
class_name BattleLayout
|
|
## Feste Bildschirmaufteilung des Duells (1280x800), von unten nach oben: Laden mit Neuwürfeln
|
|
## und Zug beenden, Hand, eigenes Brett (mit eigener Leiste links), Feldband, oben der Gegner
|
|
## mit seinem Brett.
|
|
|
|
const B_GIVEUP := Rect2(10, 10, 96, 32)
|
|
const B_LOG := Rect2(112, 10, 96, 32)
|
|
const OPP_BOX := Rect2(330, 10, 620, 56)
|
|
const FIELD := Rect2(240, 226, 800, 32)
|
|
const MSG := Rect2(240, 262, 800, 22)
|
|
const OWN_PANEL := Rect2(240, 288, 800, 160)
|
|
const STATUS := Rect2(20, 288, 210, 160)
|
|
const B_FUSE := Rect2(1050, 298, 210, 40)
|
|
const B_UNDO := Rect2(1050, 346, 210, 40)
|
|
const OWN_X := 345
|
|
const HAND_W := 96
|
|
const HAND_H := 62
|
|
const HAND_GAP := 4
|
|
const HAND_Y := 458
|
|
const SHOP_Y := 532
|
|
const SHOP_W := 150
|
|
const SHOP_H := 205
|
|
const B_REROLL := Rect2(20, 606, 200, 52)
|
|
const B_END := Rect2(1060, 600, 200, 60)
|
|
const LOG_PANEL := Rect2(240, 60, 800, 560)
|
|
const PREVIEW_SIZE := Vector2(180, 252)
|
|
const CENTER_X := 240
|
|
const CENTER_W := 800
|
|
|
|
|
|
static func own_slot(j: int) -> Rect2:
|
|
return Rect2(OWN_X + j * 120, 298, 110, 140)
|
|
|
|
|
|
## Brett des Gegners unter seinem Kasten.
|
|
static func opp_slot(j: int) -> Rect2:
|
|
return Rect2(OWN_X + j * 120, 76, 110, 140)
|
|
|
|
|
|
## Laden: fünf große Angebote unten, wie in TFT.
|
|
static func shop_rect(i: int) -> Rect2:
|
|
return Rect2(245 + i * (SHOP_W + 10), SHOP_Y, SHOP_W, SHOP_H)
|
|
|
|
|
|
## Hand: flache Kacheln zwischen Brett und Laden (die Bank).
|
|
static func hand_rect(count: int, i: int) -> Rect2:
|
|
var total := count * HAND_W + maxi(0, count - 1) * HAND_GAP
|
|
var x := CENTER_X + (CENTER_W - total) / 2
|
|
return Rect2(x + i * (HAND_W + HAND_GAP), HAND_Y, HAND_W, HAND_H)
|
|
|
|
|
|
## Schwebende Vorschau neben der gezeigten Karte: über Hand- und Ladenkarten, sonst rechts
|
|
## davon (links, wenn rechts kein Platz ist); nie aus dem Bild.
|
|
static func preview_rect(anchor: Rect2) -> Rect2:
|
|
if anchor.position.y >= HAND_Y - 10:
|
|
var x := clampf(anchor.get_center().x - PREVIEW_SIZE.x / 2, 10, 1270 - PREVIEW_SIZE.x)
|
|
return Rect2(Vector2(x, anchor.position.y - 12 - PREVIEW_SIZE.y), PREVIEW_SIZE)
|
|
var x := anchor.end.x + 12
|
|
if x + PREVIEW_SIZE.x > 1270:
|
|
x = anchor.position.x - 12 - PREVIEW_SIZE.x
|
|
var y := clampf(anchor.get_center().y - PREVIEW_SIZE.y / 2, 10, 800 - PREVIEW_SIZE.y - 10)
|
|
return Rect2(Vector2(x, y), PREVIEW_SIZE)
|
|
|
|
|
|
## Zusatzzeile (Resonanz, Feld, Feldkombo) neben der Vorschau, rechts davon oder links.
|
|
static func info_rect(preview: Rect2) -> Rect2:
|
|
var w := 230.0
|
|
var x := preview.end.x + 8
|
|
if x + w > 1275:
|
|
x = preview.position.x - 8 - w
|
|
return Rect2(x, preview.position.y + preview.size.y / 2 - 40, w, 80)
|