summaryrefslogtreecommitdiff
path: root/UI
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2020-12-31 11:33:12 +0100
committerDaniel Weipert <code@drogueronin.de>2020-12-31 11:33:12 +0100
commitfb64f15e22acfc1c03c7c5357dd66077454adbcf (patch)
tree96cdbb8f59bd65609aa76276dfba94f9cdad33d4 /UI
Initial commit
Diffstat (limited to 'UI')
-rw-r--r--UI/HUD/Timer.tscn13
-rw-r--r--UI/LevelSelect.gd23
-rw-r--r--UI/LevelSelect.tscn11
-rw-r--r--UI/LevelSelectCell.gd23
-rw-r--r--UI/LevelSelectCell.tscn58
5 files changed, 128 insertions, 0 deletions
diff --git a/UI/HUD/Timer.tscn b/UI/HUD/Timer.tscn
new file mode 100644
index 0000000..93a3512
--- /dev/null
+++ b/UI/HUD/Timer.tscn
@@ -0,0 +1,13 @@
+[gd_scene format=2]
+
+[node name="Timer" type="Label"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 10.0
+margin_top = 10.0
+margin_right = 10.0
+margin_bottom = 10.0
+text = "0.00s"
+__meta__ = {
+"_edit_use_anchors_": false
+}
diff --git a/UI/LevelSelect.gd b/UI/LevelSelect.gd
new file mode 100644
index 0000000..c173a7b
--- /dev/null
+++ b/UI/LevelSelect.gd
@@ -0,0 +1,23 @@
+extends Control
+
+
+func _ready():
+ 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)
+ 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
+ cell.connect("gui_input", self, '_button_pressed', [idx])
+ self.add_child(cell)
+
+
+func _button_pressed(event, idx):
+ if event is InputEventMouseButton or event is InputEventKey:
+ if event.pressed:
+ Global.start_level(idx)
diff --git a/UI/LevelSelect.tscn b/UI/LevelSelect.tscn
new file mode 100644
index 0000000..ef31cde
--- /dev/null
+++ b/UI/LevelSelect.tscn
@@ -0,0 +1,11 @@
+[gd_scene load_steps=2 format=2]
+
+[ext_resource path="res://UI/LevelSelect.gd" type="Script" id=1]
+
+[node name="LevelSelect" type="Control"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
diff --git a/UI/LevelSelectCell.gd b/UI/LevelSelectCell.gd
new file mode 100644
index 0000000..1bd1366
--- /dev/null
+++ b/UI/LevelSelectCell.gd
@@ -0,0 +1,23 @@
+extends Panel
+
+
+var level_idx = 0
+
+
+func _ready():
+ var level = Global.get_level(self.level_idx)
+
+ $ClearMark.text = ""
+ if level.cleared_by == Enum.PLAYER.FIRST:
+ $ClearMark.text = "X"
+ elif level.cleared_by == Enum.PLAYER.SECOND:
+ $ClearMark.text = "O"
+
+ $Time.text = String(level.time) + "s"
+
+
+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/LevelSelectCell.tscn b/UI/LevelSelectCell.tscn
new file mode 100644
index 0000000..968e913
--- /dev/null
+++ b/UI/LevelSelectCell.tscn
@@ -0,0 +1,58 @@
+[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 = 120
+font_data = ExtResource( 3 )
+
+[sub_resource type="DynamicFont" id=3]
+size = 20
+outline_size = 2
+outline_color = Color( 0, 0, 0, 1 )
+font_data = ExtResource( 2 )
+
+[node name="LevelSelectCell" type="Panel"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_right = -683.0
+margin_bottom = -400.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_top = 1.0
+margin_right = 341.0
+margin_bottom = 201.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 = 7.0
+margin_top = 3.0
+margin_right = 54.0
+margin_bottom = 24.0
+custom_fonts/font = SubResource( 3 )
+text = "0.00s"
+valign = 1
+__meta__ = {
+"_edit_use_anchors_": false
+}