From ebae6d04ffc95c6648e863d3de71835f6cd4be96 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 2 Jan 2021 14:54:57 +0100 Subject: Initial working commit --- UI/LevelSelect.gd | 6 +++++- UI/LevelSelectCell.gd | 7 ++++--- UI/LevelSelectCell.tscn | 12 ++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) (limited to 'UI') diff --git a/UI/LevelSelect.gd b/UI/LevelSelect.gd index c173a7b..7abc5f2 100644 --- a/UI/LevelSelect.gd +++ b/UI/LevelSelect.gd @@ -2,10 +2,14 @@ extends Control func _ready(): + Global.connect("level_map_updated", self, "draw") + draw() + + +func draw(): var Cell = load("res://UI/LevelSelectCell.tscn") for idx in range(9): - var level = Global.get_level(idx) var cell = Cell.instance() cell.level_idx = idx cell.set_rect_size(1024/3, 600/3) diff --git a/UI/LevelSelectCell.gd b/UI/LevelSelectCell.gd index 1bd1366..16ff961 100644 --- a/UI/LevelSelectCell.gd +++ b/UI/LevelSelectCell.gd @@ -8,12 +8,13 @@ func _ready(): var level = Global.get_level(self.level_idx) $ClearMark.text = "" - if level.cleared_by == Enum.PLAYER.FIRST: + if level.cleared_by.idx == Enum.PLAYER.FIRST: $ClearMark.text = "X" - elif level.cleared_by == Enum.PLAYER.SECOND: + elif level.cleared_by.idx == Enum.PLAYER.SECOND: $ClearMark.text = "O" - $Time.text = String(level.time) + "s" + $Time.text = str(level.time) + "s" + $Name.text = level.cleared_by.name func set_rect_size(x, y): diff --git a/UI/LevelSelectCell.tscn b/UI/LevelSelectCell.tscn index 968e913..3660cef 100644 --- a/UI/LevelSelectCell.tscn +++ b/UI/LevelSelectCell.tscn @@ -56,3 +56,15 @@ valign = 1 __meta__ = { "_edit_use_anchors_": false } + +[node name="Name" type="Label" parent="."] +margin_left = 8.0 +margin_top = 176.0 +margin_right = 66.0 +margin_bottom = 197.0 +custom_fonts/font = SubResource( 3 ) +text = "Player" +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} -- cgit v1.2.3