This makes more sense as a control

This commit is contained in:
Hamcha 2019-05-28 01:14:57 +02:00
parent aca5b1c72f
commit ac9ac164f9
Signed by: hamcha
GPG key ID: A40413D21021EAEE
3 changed files with 69 additions and 30 deletions

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://Scenes/Scripts/BoardUI.gd" type="Script" id=1] [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=2]
[ext_resource path="res://Scenes/UI/PhaseIcon.tscn" type="PackedScene" id=3] [ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=3]
[sub_resource type="Animation" id=1] [sub_resource type="Animation" id=1]
resource_name = "fade ui card" resource_name = "fade ui card"
@ -66,6 +66,51 @@ script = ExtResource( 1 )
[node name="Panel" type="Panel" parent="."] [node name="Panel" type="Panel" parent="."]
anchor_right = 1.0 anchor_right = 1.0
margin_bottom = 40.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="."] [node name="CardZoom" type="TextureRect" parent="."]
visible = false visible = false
@ -79,24 +124,9 @@ rect_scale = Vector2( 0.8, 0.8 )
mouse_filter = 2 mouse_filter = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
texture = ExtResource( 2 ) texture = ExtResource( 3 )
expand = true expand = true
stretch_mode = 5 stretch_mode = 5
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
"anims/fade ui card" = SubResource( 1 ) "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

View file

@ -1,8 +1,10 @@
extends Node2D extends TextureRect
export var phaseID = 0 export var phaseID = 0
const iconSize = 80 const iconSize = 80
func _ready(): func _ready():
$Icon.region_rect.position.x = phaseID * iconSize var atlas := (texture as AtlasTexture).duplicate()
atlas.region.position.x = phaseID * iconSize
texture = atlas

View file

@ -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=1]
[ext_resource path="res://UIAssets/GameBar/phase-icons.png" type="Texture" id=2] [ext_resource path="res://Scenes/UI/PhaseIcon.gd" type="Script" id=2]
[node name="PhaseIcon" type="Node2D"] [sub_resource type="AtlasTexture" id=1]
script = ExtResource( 1 ) flags = 4
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 80, 80 )
[node name="Icon" type="Sprite" parent="."] [node name="PhaseIcon" type="TextureRect"]
scale = Vector2( 0.65, 0.65 ) margin_left = -40.0
texture = ExtResource( 2 ) margin_top = -40.0
region_enabled = true margin_right = 40.0
region_rect = Rect2( 0, 0, 80, 80 ) 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 )