From ac9ac164f9dcb64c7010e441aeafeb3124006e2d Mon Sep 17 00:00:00 2001 From: Hamcha Date: Tue, 28 May 2019 01:14:57 +0200 Subject: [PATCH] This makes more sense as a control --- Scenes/BoardUI.tscn | 66 +++++++++++++++++++++++++++++----------- Scenes/UI/PhaseIcon.gd | 6 ++-- Scenes/UI/PhaseIcon.tscn | 27 ++++++++++------ 3 files changed, 69 insertions(+), 30 deletions(-) diff --git a/Scenes/BoardUI.tscn b/Scenes/BoardUI.tscn index 0c4f6a2..9f989d7 100644 --- a/Scenes/BoardUI.tscn +++ b/Scenes/BoardUI.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://Scenes/Scripts/BoardUI.gd" type="Script" id=1] -[ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=2] -[ext_resource path="res://Scenes/UI/PhaseIcon.tscn" type="PackedScene" id=3] +[ext_resource path="res://Scenes/UI/PhaseIcon.tscn" type="PackedScene" id=2] +[ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=3] [sub_resource type="Animation" id=1] resource_name = "fade ui card" @@ -66,6 +66,51 @@ script = ExtResource( 1 ) [node name="Panel" type="Panel" parent="."] anchor_right = 1.0 margin_bottom = 40.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="HBoxContainer" type="HBoxContainer" parent="Panel"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -640.0 +margin_top = 10.0 +margin_right = 1330.0 +margin_bottom = 90.0 +rect_scale = Vector2( 0.65, 0.65 ) +size_flags_horizontal = 3 +size_flags_vertical = 3 +alignment = 1 + +[node name="ReadyPhase" parent="Panel/HBoxContainer" instance=ExtResource( 2 )] +margin_left = 819.0 +margin_top = 0.0 +margin_right = 899.0 +margin_bottom = 80.0 +rect_scale = Vector2( 1, 1 ) + +[node name="ScorePhase" parent="Panel/HBoxContainer" instance=ExtResource( 2 )] +margin_left = 903.0 +margin_top = 0.0 +margin_right = 983.0 +margin_bottom = 80.0 +rect_scale = Vector2( 1, 1 ) +phaseID = 3 + +[node name="MainPhase" parent="Panel/HBoxContainer" instance=ExtResource( 2 )] +margin_left = 987.0 +margin_top = 0.0 +margin_right = 1067.0 +margin_bottom = 80.0 +rect_scale = Vector2( 1, 1 ) +phaseID = 2 + +[node name="TroublePhase" parent="Panel/HBoxContainer" instance=ExtResource( 2 )] +margin_left = 1071.0 +margin_top = 0.0 +margin_right = 1151.0 +margin_bottom = 80.0 +rect_scale = Vector2( 1, 1 ) +phaseID = 1 [node name="CardZoom" type="TextureRect" parent="."] visible = false @@ -79,24 +124,9 @@ rect_scale = Vector2( 0.8, 0.8 ) mouse_filter = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -texture = ExtResource( 2 ) +texture = ExtResource( 3 ) expand = true stretch_mode = 5 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] "anims/fade ui card" = SubResource( 1 ) - -[node name="ReadyPhase" parent="." instance=ExtResource( 3 )] -position = Vector2( 565, 40 ) - -[node name="TroublePhase" parent="." instance=ExtResource( 3 )] -position = Vector2( 615, 40 ) -phaseID = 1 - -[node name="MainPhase" parent="." instance=ExtResource( 3 )] -position = Vector2( 665, 40 ) -phaseID = 2 - -[node name="ScorePhase" parent="." instance=ExtResource( 3 )] -position = Vector2( 715, 40 ) -phaseID = 3 diff --git a/Scenes/UI/PhaseIcon.gd b/Scenes/UI/PhaseIcon.gd index 41f3ac1..66759f5 100644 --- a/Scenes/UI/PhaseIcon.gd +++ b/Scenes/UI/PhaseIcon.gd @@ -1,8 +1,10 @@ -extends Node2D +extends TextureRect export var phaseID = 0 const iconSize = 80 func _ready(): - $Icon.region_rect.position.x = phaseID * iconSize \ No newline at end of file + var atlas := (texture as AtlasTexture).duplicate() + atlas.region.position.x = phaseID * iconSize + texture = atlas \ No newline at end of file diff --git a/Scenes/UI/PhaseIcon.tscn b/Scenes/UI/PhaseIcon.tscn index 9bd3cff..58cb0f2 100644 --- a/Scenes/UI/PhaseIcon.tscn +++ b/Scenes/UI/PhaseIcon.tscn @@ -1,13 +1,20 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] -[ext_resource path="res://Scenes/UI/PhaseIcon.gd" type="Script" id=1] -[ext_resource path="res://UIAssets/GameBar/phase-icons.png" type="Texture" id=2] +[ext_resource path="res://UIAssets/GameBar/phase-icons.png" type="Texture" id=1] +[ext_resource path="res://Scenes/UI/PhaseIcon.gd" type="Script" id=2] -[node name="PhaseIcon" type="Node2D"] -script = ExtResource( 1 ) +[sub_resource type="AtlasTexture" id=1] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 80, 80 ) -[node name="Icon" type="Sprite" parent="."] -scale = Vector2( 0.65, 0.65 ) -texture = ExtResource( 2 ) -region_enabled = true -region_rect = Rect2( 0, 0, 80, 80 ) +[node name="PhaseIcon" type="TextureRect"] +margin_left = -40.0 +margin_top = -40.0 +margin_right = 40.0 +margin_bottom = 40.0 +rect_scale = Vector2( 0.65, 0.65 ) +rect_pivot_offset = Vector2( 40, 40 ) +texture = SubResource( 1 ) +stretch_mode = 5 +script = ExtResource( 2 )