53 lines
1.5 KiB
GDScript
53 lines
1.5 KiB
GDScript
extends Button
|
|
|
|
onready var ExplanationControl = preload("res://resources/customControls/DifficultySelector/Explanation.tscn");
|
|
onready var NormalBackground = preload("res://resources/graphics/GUI/Menu/Difficulties/normal_background.webp");
|
|
onready var HardBackground = preload("res://resources/graphics/GUI/Menu/Difficulties/hard_background.webp");
|
|
|
|
|
|
|
|
func Init(type:String):
|
|
if type == "Normal":
|
|
InitNormal();
|
|
elif type == "Hard":
|
|
InitHard();
|
|
|
|
var normalExplanations = [
|
|
"ui_difficulty_normal_explanation_1",
|
|
"ui_difficulty_normal_explanation_2",
|
|
"ui_difficulty_normal_explanation_3",
|
|
"ui_difficulty_normal_explanation_4",
|
|
];
|
|
|
|
func InitNormal():
|
|
$Background.texture = NormalBackground;
|
|
$Header.text = tr("ui_difficulty_normal_header");
|
|
$Title.text = tr("ui_difficulty_normal_title");
|
|
for i in normalExplanations:
|
|
var control = ExplanationControl.instance();
|
|
control.Init(i);
|
|
$Explanations.add_child(control);
|
|
|
|
|
|
var hardExplanations = [
|
|
"ui_difficulty_hard_explanation_1",
|
|
"ui_difficulty_hard_explanation_2",
|
|
"ui_difficulty_hard_explanation_3",
|
|
"ui_difficulty_hard_explanation_4",
|
|
];
|
|
|
|
func InitHard():
|
|
$Background.texture = HardBackground;
|
|
$Header.text = tr("ui_difficulty_hard_header");
|
|
$Title.text = tr("ui_difficulty_hard_title");
|
|
for i in hardExplanations:
|
|
var control = ExplanationControl.instance();
|
|
control.Init(i);
|
|
$Explanations.add_child(control);
|
|
|
|
|
|
func _on_Control_mouse_entered():
|
|
$Background.modulate.a = 0.85;
|
|
|
|
func _on_Control_mouse_exited():
|
|
$Background.modulate.a = 1;
|