summaryrefslogtreecommitdiff
path: root/UI/HUD
diff options
context:
space:
mode:
Diffstat (limited to 'UI/HUD')
-rw-r--r--UI/HUD/LevelMap.gd25
-rw-r--r--UI/HUD/LevelMap.tscn18
-rw-r--r--UI/HUD/LevelMapCell.gd24
-rw-r--r--UI/HUD/LevelMapCell.tscn71
4 files changed, 138 insertions, 0 deletions
diff --git a/UI/HUD/LevelMap.gd b/UI/HUD/LevelMap.gd
new file mode 100644
index 0000000..8de38fa
--- /dev/null
+++ b/UI/HUD/LevelMap.gd
@@ -0,0 +1,25 @@
+extends Panel
+
+
+func _ready():
+ Global.connect("level_map_updated", self, "draw")
+ self.draw()
+
+
+func draw():
+ var Cell = load("res://UI/HUD/LevelMapCell.tscn")
+ var Level = get_parent().get_parent() # HUD > Level
+
+ for idx in range(Global.Level_Map.size()):
+ var cell = Cell.instance()
+ cell.level_idx = idx
+ cell.set_rect_size(150/3, 150/3)
+ var column = idx % 3
+ var row = idx / 3
+ cell.rect_position.x = cell.rect_size.x*column
+ cell.rect_position.y = cell.rect_size.y*row
+
+ #if idx == Level.idx:
+ #cell.set_border_width_all(3)
+
+ self.add_child(cell)
diff --git a/UI/HUD/LevelMap.tscn b/UI/HUD/LevelMap.tscn
new file mode 100644
index 0000000..646c96a
--- /dev/null
+++ b/UI/HUD/LevelMap.tscn
@@ -0,0 +1,18 @@
+[gd_scene load_steps=3 format=2]
+
+[ext_resource path="res://UI/HUD/LevelMap.gd" type="Script" id=1]
+
+[sub_resource type="StyleBoxFlat" id=1]
+bg_color = Color( 0, 0, 0, 0.117647 )
+
+[node name="LevelMap" type="Panel"]
+margin_left = 864.0
+margin_top = 8.0
+margin_right = 1014.0
+margin_bottom = 158.0
+rect_clip_content = true
+custom_styles/panel = SubResource( 1 )
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
diff --git a/UI/HUD/LevelMapCell.gd b/UI/HUD/LevelMapCell.gd
new file mode 100644
index 0000000..16ff961
--- /dev/null
+++ b/UI/HUD/LevelMapCell.gd
@@ -0,0 +1,24 @@
+extends Panel
+
+
+var level_idx = 0
+
+
+func _ready():
+ var level = Global.get_level(self.level_idx)
+
+ $ClearMark.text = ""
+ if level.cleared_by.idx == Enum.PLAYER.FIRST:
+ $ClearMark.text = "X"
+ elif level.cleared_by.idx == Enum.PLAYER.SECOND:
+ $ClearMark.text = "O"
+
+ $Time.text = str(level.time) + "s"
+ $Name.text = level.cleared_by.name
+
+
+func set_rect_size(x, y):
+ self.rect_size.x = x
+ self.rect_size.y = y
+ $ClearMark.rect_size.x = x
+ $ClearMark.rect_size.y = y
diff --git a/UI/HUD/LevelMapCell.tscn b/UI/HUD/LevelMapCell.tscn
new file mode 100644
index 0000000..d933d4f
--- /dev/null
+++ b/UI/HUD/LevelMapCell.tscn
@@ -0,0 +1,71 @@
+[gd_scene load_steps=7 format=2]
+
+[ext_resource path="res://UI/LevelSelectCell.gd" type="Script" id=1]
+[ext_resource path="res://Assets/Fonts/geometry-soft-pro/Geometry_Soft_Pro-Bold_N.otf" type="DynamicFontData" id=2]
+[ext_resource path="res://Assets/Fonts/impact-label/Impact_Label_Reversed.ttf" type="DynamicFontData" id=3]
+
+[sub_resource type="StyleBoxFlat" id=1]
+bg_color = Color( 0.133333, 0.372549, 0.188235, 1 )
+border_width_left = 1
+border_width_top = 1
+border_width_right = 1
+border_width_bottom = 1
+
+[sub_resource type="DynamicFont" id=2]
+size = 32
+font_data = ExtResource( 3 )
+
+[sub_resource type="DynamicFont" id=3]
+size = 8
+outline_size = 2
+outline_color = Color( 0, 0, 0, 1 )
+font_data = ExtResource( 2 )
+
+[node name="LevelMapCell" type="Panel"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_right = -974.0
+margin_bottom = -550.0
+hint_tooltip = "Select Level"
+custom_styles/panel = SubResource( 1 )
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="ClearMark" type="Label" parent="."]
+margin_left = 1.0
+margin_top = 1.0
+margin_right = 50.0
+margin_bottom = 50.0
+custom_fonts/font = SubResource( 2 )
+text = "X"
+align = 1
+valign = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Time" type="Label" parent="."]
+margin_left = 3.72449
+margin_top = 2.01899
+margin_right = 32.7245
+margin_bottom = 15.019
+custom_fonts/font = SubResource( 3 )
+text = "0.00s"
+valign = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Name" type="Label" parent="."]
+margin_left = 3.95238
+margin_top = 31.297
+margin_right = 61.9524
+margin_bottom = 52.297
+custom_fonts/font = SubResource( 3 )
+text = "Player"
+valign = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}