72 lines
2.8 KiB
GDScript
72 lines
2.8 KiB
GDScript
class_name BattleLayout
|
|
## Feste Bildschirmaufteilung des Duells (1280x800). Mitte von oben nach unten: Hand des Gegners
|
|
## (Rückseiten), sein Brett, seine Elementleiste, die eigene Elementleiste (die Naht liegt auf halber
|
|
## Höhe), eigenes Brett, eigene Hand. Links: Kasten des Gegners, die drei offenen Karten des
|
|
## Stapels (mittig), eigener Kasten. Rechts oben die Knöpfe, rechts mittig die Vorschau, darunter Meldungen.
|
|
|
|
const B_GIVEUP := Rect2(1070, 10, 96, 32)
|
|
const B_LOG := Rect2(1172, 10, 96, 32)
|
|
const B_END := Rect2(1070, 48, 198, 32)
|
|
const OPP_BOX := Rect2(20, 11, 210, 96)
|
|
const OPP_HAND_Y := 11
|
|
const FIELD_OPP := Rect2(240, 364, 800, 32)
|
|
const FIELD := Rect2(240, 404, 800, 32)
|
|
const MSG := Rect2(1040, 630, 220, 60)
|
|
const STATUS := Rect2(20, 694, 210, 96)
|
|
const B_UNDO := Rect2(1070, 86, 198, 32)
|
|
const OWN_X := 345
|
|
const HAND_W := 110 # Handkarten so groß wie die Wesen auf dem Feld
|
|
const HAND_H := 140
|
|
const HAND_GAP := 10
|
|
const HAND_Y := 610
|
|
const HAND_ARC := 3.0 # Grad Neigung und Pixel Absenkung je Platz von der Mitte (leichter Bogen)
|
|
const OFFER_X := 70 # die drei offenen Karten des Stapels, links übereinander um die Mitte
|
|
const OFFER_Y := 180
|
|
const OFFER_GAP := 10
|
|
const DECK_LABEL := Rect2(20, 632, 210, 22)
|
|
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, 440, 110, 140)
|
|
|
|
|
|
## Brett des Gegners über seiner Elementleiste.
|
|
static func opp_slot(j: int) -> Rect2:
|
|
return Rect2(OWN_X + j * 120, 220, 110, 140)
|
|
|
|
|
|
## Hand: bis zu fünf Karten unten, mittig; den Bogen legt hand_arc dazu.
|
|
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)
|
|
|
|
|
|
## Hand des Gegners oben, gleich groß, nur die Rückseiten.
|
|
static func opp_hand_rect(count: int, i: int) -> Rect2:
|
|
var r := hand_rect(count, i)
|
|
r.position.y = OPP_HAND_Y
|
|
return r
|
|
|
|
|
|
## Leichter Bogen: Karte i von count dreht sich um ihre Mitte und sinkt zum Rand hin ab
|
|
## (mirrored: für den Gegner oben spiegelverkehrt). Liefert [Grad, y-Versatz].
|
|
static func hand_arc(count: int, i: int, mirrored: bool = false) -> Array:
|
|
var t := i - (count - 1) / 2.0
|
|
var sign := -1.0 if mirrored else 1.0
|
|
return [t * HAND_ARC * sign, t * t * HAND_ARC * sign]
|
|
|
|
|
|
## Vorschau der gezeigten Karte: fest rechts auf halber Höhe.
|
|
static func preview_rect(_anchor: Rect2) -> Rect2:
|
|
return Rect2(Vector2(1050, 400 - PREVIEW_SIZE.y / 2), PREVIEW_SIZE)
|
|
|
|
|
|
## Zusatzzeile (Elementbonus, Eigenschaften) unter der Vorschau.
|
|
static func info_rect(preview: Rect2) -> Rect2:
|
|
return Rect2(1030, preview.end.y + 8, 230, 80)
|