Redesign Klassenauswahl mit Portraits und Klassen-Lore
- class_selection_menu.tscn: Vollbild-Layout mit dunklem Hintergrund - class_selection_menu.gd: Karten dynamisch per Code erzeugt mit Portrait, Lore-Text, Gameplay-Beschreibung, Flavor-Zitat, Stats und Auswahl-Button - Drei Klassen-Portraits hinzugefügt: Warrior.png, Schurke.png, Magier.png - Hover- und Auswahl-Highlighting per StyleBoxFlat Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
48bfe1a83f
commit
cbf50b56bf
11 changed files with 491 additions and 114 deletions
40
assets/Icons/Autoattack.png.import
Normal file
40
assets/Icons/Autoattack.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cgpdfdoqlec10"
|
||||
path="res://.godot/imported/Autoattack.png-4bc4c7527331a60eb77c8d50fdd7ec4e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Icons/Autoattack.png"
|
||||
dest_files=["res://.godot/imported/Autoattack.png-4bc4c7527331a60eb77c8d50fdd7ec4e.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/Icons/Magier.png
Normal file
BIN
assets/Icons/Magier.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
40
assets/Icons/Magier.png.import
Normal file
40
assets/Icons/Magier.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d06as1sqtp0c6"
|
||||
path="res://.godot/imported/Magier.png-0f1ce4da3459f56e43fe05c8d71878fb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Icons/Magier.png"
|
||||
dest_files=["res://.godot/imported/Magier.png-0f1ce4da3459f56e43fe05c8d71878fb.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/Icons/Schurke.png
Normal file
BIN
assets/Icons/Schurke.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
40
assets/Icons/Schurke.png.import
Normal file
40
assets/Icons/Schurke.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://di4tlwg0hnkar"
|
||||
path="res://.godot/imported/Schurke.png-c039d2b91ac40580c6dc788d7bbb7816.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Icons/Schurke.png"
|
||||
dest_files=["res://.godot/imported/Schurke.png-c039d2b91ac40580c6dc788d7bbb7816.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/Icons/Warrior.png
Normal file
BIN
assets/Icons/Warrior.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
40
assets/Icons/Warrior.png.import
Normal file
40
assets/Icons/Warrior.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b5upy45wtmumd"
|
||||
path="res://.godot/imported/Warrior.png-57a8586fcc075ca35a4537860e016225.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Icons/Warrior.png"
|
||||
dest_files=["res://.godot/imported/Warrior.png-57a8586fcc075ca35a4537860e016225.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
40
assets/Icons/Wirbelwind.png.import
Normal file
40
assets/Icons/Wirbelwind.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://juiajrk402ye"
|
||||
path="res://.godot/imported/Wirbelwind.png-f8dae31041496d23cc2aede76dd7676d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Icons/Wirbelwind.png"
|
||||
dest_files=["res://.godot/imported/Wirbelwind.png-f8dae31041496d23cc2aede76dd7676d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
40
assets/Icons/Zornfesseln.png.import
Normal file
40
assets/Icons/Zornfesseln.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dllxvv2q12nq7"
|
||||
path="res://.godot/imported/Zornfesseln.png-2c29a39671eeddf6b2c05790a0b6a72c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Icons/Zornfesseln.png"
|
||||
dest_files=["res://.godot/imported/Zornfesseln.png-2c29a39671eeddf6b2c05790a0b6a72c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
|
@ -5,77 +5,214 @@ extends CanvasLayer
|
|||
signal class_selected(character_class: CharacterClass)
|
||||
|
||||
const WARRIOR_CLASS = preload("res://classes/warrior.tres")
|
||||
const ROGUE_CLASS = preload("res://classes/rogue.tres")
|
||||
const MAGE_CLASS = preload("res://classes/mage.tres")
|
||||
const ROGUE_CLASS = preload("res://classes/rogue.tres")
|
||||
const MAGE_CLASS = preload("res://classes/mage.tres")
|
||||
|
||||
const WARRIOR_PORTRAIT = preload("res://assets/Icons/Warrior.png")
|
||||
const ROGUE_PORTRAIT = preload("res://assets/Icons/Schurke.png")
|
||||
const MAGE_PORTRAIT = preload("res://assets/Icons/Magier.png")
|
||||
|
||||
const CLASS_DATA = [
|
||||
{
|
||||
"key": "warrior",
|
||||
"name": "Krieger",
|
||||
"res": null, # filled in _ready
|
||||
"portrait": null,
|
||||
"description": "Meister des Nahkampfs.\nHohe Rüstung und rohe Stärke.\nNutzt Wut als Ressource.",
|
||||
"lore": "Einst ein einfacher Söldner, der die falschen Leute bestahl. Er überlebte das Massaker an seiner Kompanie als Einziger — nicht durch Glück, sondern weil er zu wütend war, um zu sterben. Seitdem trägt er die Narben seiner Gefallenen auf der Haut und ihre Namen auf der Klinge.",
|
||||
"flavor": "\"Die Toten schreien nicht. Ich schreie für sie.\""
|
||||
},
|
||||
{
|
||||
"key": "rogue",
|
||||
"name": "Schurke",
|
||||
"res": null,
|
||||
"portrait": null,
|
||||
"description": "Schnell und tödlich.\nNah- und Fernkampf.\nNutzt Energie als Ressource.",
|
||||
"lore": "Aufgewachsen in den Kanalrohren der Unterstadt, lernte sie früh: Wer zuerst gesehen wird, verliert. Die Gilde der Stille formte sie zur Waffe — bis sie erkannte, dass sie selbst das Ziel war. Seitdem arbeitet sie für sich. Und für einen sehr hohen Preis.",
|
||||
"flavor": "\"Ich war schon hier, bevor du mich bemerkt hast.\""
|
||||
},
|
||||
{
|
||||
"key": "mage",
|
||||
"name": "Magier",
|
||||
"res": null,
|
||||
"portrait": null,
|
||||
"description": "Meister der Arkanen Künste.\nElementarmagie und Kontrolle.\nNutzt Mana als Ressource.",
|
||||
"lore": "Er war Hofgelehrter, bis er in verbotenen Archiven Worte las, die nicht für Sterbliche bestimmt waren. Die Akademie verbrannte seine Bücher. Das Feuer übernahm er — und alles andere, was sie ihm zu nehmen versuchten. Wissen hat seinen Preis. Er zahlt ihn gerne.",
|
||||
"flavor": "\"Das Universum ist Text. Ich lerne noch, es umzuschreiben.\""
|
||||
}
|
||||
]
|
||||
|
||||
var selected_class: CharacterClass = null
|
||||
var _cards: Array = []
|
||||
|
||||
@onready var panel = $Panel
|
||||
@onready var warrior_btn = $Panel/VBoxContainer/ClassButtons/WarriorBtn
|
||||
@onready var rogue_btn = $Panel/VBoxContainer/ClassButtons/RogueBtn
|
||||
@onready var mage_btn = $Panel/VBoxContainer/ClassButtons/MageBtn
|
||||
@onready var start_btn = $Panel/VBoxContainer/StartBtn
|
||||
@onready var class_info = $Panel/VBoxContainer/ClassInfo
|
||||
@onready var stats_label = $Panel/VBoxContainer/StatsLabel
|
||||
@onready var card_container = $Background/CardContainer
|
||||
@onready var start_btn = $Background/BottomBar/StartBtn
|
||||
|
||||
# Farben für Karten-Zustände
|
||||
const COLOR_CARD_DEFAULT = Color(0.10, 0.08, 0.13, 1.0)
|
||||
const COLOR_CARD_HOVER = Color(0.14, 0.11, 0.18, 1.0)
|
||||
const COLOR_CARD_SELECTED = Color(0.18, 0.13, 0.25, 1.0)
|
||||
const COLOR_BORDER_DEFAULT = Color(0.25, 0.20, 0.35, 1.0)
|
||||
const COLOR_BORDER_SELECTED = Color(0.85, 0.65, 0.10, 1.0)
|
||||
|
||||
func _ready():
|
||||
# Spiel pausieren während Menü offen
|
||||
get_tree().paused = true
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
|
||||
# Buttons verbinden
|
||||
warrior_btn.pressed.connect(_on_warrior_selected)
|
||||
rogue_btn.pressed.connect(_on_rogue_selected)
|
||||
mage_btn.pressed.connect(_on_mage_selected)
|
||||
CLASS_DATA[0]["res"] = WARRIOR_CLASS
|
||||
CLASS_DATA[0]["portrait"] = WARRIOR_PORTRAIT
|
||||
CLASS_DATA[1]["res"] = ROGUE_CLASS
|
||||
CLASS_DATA[1]["portrait"] = ROGUE_PORTRAIT
|
||||
CLASS_DATA[2]["res"] = MAGE_CLASS
|
||||
CLASS_DATA[2]["portrait"] = MAGE_PORTRAIT
|
||||
|
||||
for i in CLASS_DATA.size():
|
||||
var card = _build_card(CLASS_DATA[i], i)
|
||||
card_container.add_child(card)
|
||||
_cards.append(card)
|
||||
|
||||
start_btn.pressed.connect(_on_start_pressed)
|
||||
|
||||
# Start-Button deaktiviert bis Klasse gewählt
|
||||
start_btn.disabled = true
|
||||
class_info.text = "Wähle eine Klasse!"
|
||||
stats_label.text = ""
|
||||
|
||||
func _on_warrior_selected():
|
||||
selected_class = WARRIOR_CLASS
|
||||
_update_selection("Krieger", WARRIOR_CLASS)
|
||||
_highlight_button(warrior_btn)
|
||||
|
||||
func _on_rogue_selected():
|
||||
selected_class = ROGUE_CLASS
|
||||
_update_selection("Schurke", ROGUE_CLASS)
|
||||
_highlight_button(rogue_btn)
|
||||
func _build_card(data: Dictionary, idx: int) -> Panel:
|
||||
var card = Panel.new()
|
||||
card.custom_minimum_size = Vector2(340, 580)
|
||||
card.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
|
||||
func _on_mage_selected():
|
||||
selected_class = MAGE_CLASS
|
||||
_update_selection("Magier", MAGE_CLASS)
|
||||
_highlight_button(mage_btn)
|
||||
var style = StyleBoxFlat.new()
|
||||
style.bg_color = COLOR_CARD_DEFAULT
|
||||
style.border_width_left = 2
|
||||
style.border_width_top = 2
|
||||
style.border_width_right = 2
|
||||
style.border_width_bottom = 2
|
||||
style.border_color = COLOR_BORDER_DEFAULT
|
||||
style.corner_radius_top_left = 10
|
||||
style.corner_radius_top_right = 10
|
||||
style.corner_radius_bottom_right = 10
|
||||
style.corner_radius_bottom_left = 10
|
||||
card.add_theme_stylebox_override("panel", style)
|
||||
card.set_meta("style", style)
|
||||
card.set_meta("idx", idx)
|
||||
|
||||
func _update_selection(cls_name: String, char_class: CharacterClass):
|
||||
var main_stat_name = ""
|
||||
match char_class.main_stat:
|
||||
CharacterClass.MainStat.STRENGTH:
|
||||
main_stat_name = "Stärke"
|
||||
CharacterClass.MainStat.AGILITY:
|
||||
main_stat_name = "Beweglichkeit"
|
||||
CharacterClass.MainStat.INTELLIGENCE:
|
||||
main_stat_name = "Intelligenz"
|
||||
var vbox = VBoxContainer.new()
|
||||
vbox.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT, Control.PRESET_MODE_MINSIZE, 16)
|
||||
vbox.add_theme_constant_override("separation", 14)
|
||||
card.add_child(vbox)
|
||||
|
||||
class_info.text = cls_name + " - Haupt-Stat: " + main_stat_name
|
||||
stats_label.text = "STR: " + str(char_class.base_strength) + " AGI: " + str(char_class.base_agility) + " INT: " + str(char_class.base_intelligence) + " STA: " + str(char_class.base_stamina)
|
||||
# Portrait
|
||||
var portrait = TextureRect.new()
|
||||
portrait.texture = data["portrait"]
|
||||
portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
portrait.custom_minimum_size = Vector2(0, 280)
|
||||
portrait.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
portrait.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
vbox.add_child(portrait)
|
||||
|
||||
# Klassenname
|
||||
var name_label = Label.new()
|
||||
name_label.text = data["name"]
|
||||
name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
name_label.add_theme_font_size_override("font_size", 26)
|
||||
vbox.add_child(name_label)
|
||||
|
||||
# Trennlinie
|
||||
var sep = HSeparator.new()
|
||||
vbox.add_child(sep)
|
||||
|
||||
# Lore
|
||||
var lore = Label.new()
|
||||
lore.text = data["lore"]
|
||||
lore.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
lore.add_theme_font_size_override("font_size", 12)
|
||||
lore.modulate = Color(0.85, 0.82, 0.75, 1.0)
|
||||
lore.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
lore.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
vbox.add_child(lore)
|
||||
|
||||
# Trennlinie 2
|
||||
var sep2 = HSeparator.new()
|
||||
vbox.add_child(sep2)
|
||||
|
||||
# Gameplay Beschreibung
|
||||
var desc = Label.new()
|
||||
desc.text = data["description"]
|
||||
desc.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
desc.add_theme_font_size_override("font_size", 13)
|
||||
desc.modulate = Color(0.7, 0.85, 0.7, 1.0)
|
||||
desc.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
vbox.add_child(desc)
|
||||
|
||||
# Flavor Text
|
||||
var flavor = Label.new()
|
||||
flavor.text = data["flavor"]
|
||||
flavor.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
flavor.add_theme_font_size_override("font_size", 11)
|
||||
flavor.modulate = Color(0.7, 0.6, 0.4, 1.0)
|
||||
flavor.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
vbox.add_child(flavor)
|
||||
|
||||
# Stats
|
||||
var stats = Label.new()
|
||||
var char_class: CharacterClass = data["res"]
|
||||
stats.text = "STR %d | AGI %d | INT %d | STA %d" % [
|
||||
char_class.base_strength, char_class.base_agility,
|
||||
char_class.base_intelligence, char_class.base_stamina
|
||||
]
|
||||
stats.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
stats.add_theme_font_size_override("font_size", 12)
|
||||
stats.modulate = Color(0.8, 0.8, 0.8, 1.0)
|
||||
vbox.add_child(stats)
|
||||
|
||||
# Auswählen-Button
|
||||
var btn = Button.new()
|
||||
btn.text = "Auswählen"
|
||||
btn.add_theme_font_size_override("font_size", 16)
|
||||
btn.pressed.connect(_on_card_selected.bind(idx))
|
||||
vbox.add_child(btn)
|
||||
|
||||
# Hover
|
||||
card.mouse_entered.connect(_on_card_hover.bind(idx, true))
|
||||
card.mouse_exited.connect(_on_card_hover.bind(idx, false))
|
||||
card.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
|
||||
return card
|
||||
|
||||
|
||||
func _on_card_selected(idx: int):
|
||||
selected_class = CLASS_DATA[idx]["res"]
|
||||
for i in _cards.size():
|
||||
var s: StyleBoxFlat = _cards[i].get_meta("style")
|
||||
if i == idx:
|
||||
s.bg_color = COLOR_CARD_SELECTED
|
||||
s.border_color = COLOR_BORDER_SELECTED
|
||||
s.border_width_left = 3
|
||||
s.border_width_top = 3
|
||||
s.border_width_right = 3
|
||||
s.border_width_bottom = 3
|
||||
else:
|
||||
s.bg_color = COLOR_CARD_DEFAULT
|
||||
s.border_color = COLOR_BORDER_DEFAULT
|
||||
s.border_width_left = 2
|
||||
s.border_width_top = 2
|
||||
s.border_width_right = 2
|
||||
s.border_width_bottom = 2
|
||||
start_btn.disabled = false
|
||||
|
||||
func _highlight_button(active_btn: Button):
|
||||
# Alle Buttons zurücksetzen
|
||||
warrior_btn.modulate = Color(1, 1, 1)
|
||||
rogue_btn.modulate = Color(1, 1, 1)
|
||||
mage_btn.modulate = Color(1, 1, 1)
|
||||
# Aktiven Button hervorheben
|
||||
active_btn.modulate = Color(1, 0.8, 0.2)
|
||||
|
||||
func _on_card_hover(idx: int, hovering: bool):
|
||||
var card = _cards[idx]
|
||||
var s: StyleBoxFlat = card.get_meta("style")
|
||||
var is_selected = (selected_class == CLASS_DATA[idx]["res"])
|
||||
if is_selected:
|
||||
return
|
||||
s.bg_color = COLOR_CARD_HOVER if hovering else COLOR_CARD_DEFAULT
|
||||
|
||||
|
||||
func _on_start_pressed():
|
||||
if selected_class == null:
|
||||
return
|
||||
|
||||
# Signal senden und Menü schließen
|
||||
class_selected.emit(selected_class)
|
||||
get_tree().paused = false
|
||||
queue_free()
|
||||
|
|
|
|||
|
|
@ -2,79 +2,79 @@
|
|||
|
||||
[ext_resource type="Script" path="res://class_selection_menu.gd" id="1_menu"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bg"]
|
||||
bg_color = Color(0.04, 0.04, 0.07, 1.0)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bottom"]
|
||||
bg_color = Color(0.06, 0.05, 0.10, 0.9)
|
||||
|
||||
[node name="ClassSelectionMenu" type="CanvasLayer"]
|
||||
script = ExtResource("1_menu")
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
[node name="Background" type="Panel" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_bg")
|
||||
|
||||
[node name="Title" type="Label" parent="Background"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.0
|
||||
offset_top = 40.0
|
||||
offset_bottom = 100.0
|
||||
theme_override_font_sizes/font_size = 52
|
||||
text = "Wähle deine Klasse"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CardContainer" type="HBoxContainer" parent="Background"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.1
|
||||
anchor_top = 0.12
|
||||
anchor_right = 0.9
|
||||
anchor_bottom = 0.88
|
||||
offset_left = 0.0
|
||||
offset_top = 0.0
|
||||
offset_right = 0.0
|
||||
offset_bottom = 0.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 40
|
||||
alignment = 1
|
||||
|
||||
[node name="BottomBar" type="Panel" parent="Background"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.88
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 0.0
|
||||
offset_top = 0.0
|
||||
offset_right = 0.0
|
||||
offset_bottom = 0.0
|
||||
grow_vertical = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_bottom")
|
||||
|
||||
[node name="StartBtn" type="Button" parent="Background/BottomBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -200.0
|
||||
offset_top = -180.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 180.0
|
||||
offset_left = -150.0
|
||||
offset_top = -30.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = 30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = -20.0
|
||||
offset_bottom = -20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 15
|
||||
|
||||
[node name="Title" type="Label" parent="Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 28
|
||||
text = "Wähle deine Klasse"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="ClassButtons" type="HBoxContainer" parent="Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
alignment = 1
|
||||
|
||||
[node name="WarriorBtn" type="Button" parent="Panel/VBoxContainer/ClassButtons"]
|
||||
custom_minimum_size = Vector2(100, 80)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "Krieger"
|
||||
|
||||
[node name="RogueBtn" type="Button" parent="Panel/VBoxContainer/ClassButtons"]
|
||||
custom_minimum_size = Vector2(100, 80)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "Schurke"
|
||||
|
||||
[node name="MageBtn" type="Button" parent="Panel/VBoxContainer/ClassButtons"]
|
||||
custom_minimum_size = Vector2(100, 80)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "Magier"
|
||||
|
||||
[node name="ClassInfo" type="Label" parent="Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 18
|
||||
text = "Wähle eine Klasse!"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="StatsLabel" type="Label" parent="Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
text = ""
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="StartBtn" type="Button" parent="Panel/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 50)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 20
|
||||
theme_override_font_sizes/font_size = 22
|
||||
disabled = true
|
||||
text = "Spiel starten"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue