summaryrefslogtreecommitdiff
path: root/UI/LevelSelectCell.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2023-12-25 13:10:22 +0100
committerDaniel Weipert <git@mail.dweipert.de>2023-12-25 13:10:22 +0100
commitc1f30a2905d7a44439c2c0797ddd87b58f79d724 (patch)
treeae973c30d87c3f24b0e778206a501a8dcd12ff73 /UI/LevelSelectCell.gd
parentd74263a17e98159b2e3176a5f8e1ff361909c210 (diff)
level select input supportv2.1.0
Diffstat (limited to 'UI/LevelSelectCell.gd')
-rw-r--r--UI/LevelSelectCell.gd17
1 files changed, 17 insertions, 0 deletions
diff --git a/UI/LevelSelectCell.gd b/UI/LevelSelectCell.gd
index a756210..cd59593 100644
--- a/UI/LevelSelectCell.gd
+++ b/UI/LevelSelectCell.gd
@@ -3,10 +3,16 @@ extends Panel
var level_idx = 0
+var stylebox = StyleBoxFlat.new()
+var background_color = "#225f30"
+var background_color_selected = "#3c9f54"
+
func _ready():
var level = Global.get_level(self.level_idx)
+ stylebox = self.get("theme_override_styles/panel")
+
$ClearMark.text = ""
if level.cleared_by.idx == Enum.PLAYER.FIRST:
$ClearMark.text = "X"
@@ -31,3 +37,14 @@ func set_rect_size(x, y):
$Time.position = Vector2(3, 3)
$Name.position = Vector2(3, y - $Name.size.y)
+
+
+func set_selected(is_selected = true):
+ if is_selected:
+ var box = stylebox.duplicate()
+ box.bg_color = Color.from_string(self.background_color_selected, self.background_color)
+ self.set("theme_override_styles/panel", box)
+ else:
+ var box = stylebox.duplicate()
+ box.bg_color = Color.from_string(self.background_color, self.background_color)
+ self.set("theme_override_styles/panel", box)