More work on draft page
This commit is contained in:
parent
64eb3a8995
commit
c8cc26cbce
19 changed files with 486 additions and 170 deletions
|
@ -2,26 +2,23 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.s3tc.stex"
|
||||
path.etc2="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc2.stex"
|
||||
path.etc="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc.stex"
|
||||
path="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "bptc", "s3tc", "etc2", "etc" ],
|
||||
"vram_texture": true
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MLPAssets/Background/boardbg.jpg"
|
||||
dest_files=[ "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.s3tc.stex", "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc2.stex", "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc.stex" ]
|
||||
dest_files=[ "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/mode=1
|
||||
compress/lossy_quality=0.8
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
|
|
|
@ -14,11 +14,11 @@ dest_files=[ "res://.import/deckbuilderbg.png-68f7a3ffd5ce19875a051fc28635d04a.s
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=1
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
|
|
|
@ -14,11 +14,11 @@ dest_files=[ "res://.import/hall.png-ab06c7a881e71434043816d73db7a17c.stex" ]
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=1
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
|
|
|
@ -14,11 +14,11 @@ dest_files=[ "res://.import/library.webp-ce7da1a8796349bdd0765298e794a99f.stex"
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=1
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
|
|
|
@ -14,11 +14,11 @@ dest_files=[ "res://.import/menubg.webp-efa045427b363071ed65b7b82df60ac9.stex" ]
|
|||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=1
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
|
|
|
@ -2,22 +2,19 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.s3tc.stex"
|
||||
path.etc2="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc2.stex"
|
||||
path.etc="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc.stex"
|
||||
path="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "bptc", "s3tc", "etc2", "etc" ],
|
||||
"vram_texture": true
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MLPAssets/Placeholders/unknowncard.jpg"
|
||||
dest_files=[ "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.s3tc.stex", "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc2.stex", "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc.stex" ]
|
||||
dest_files=[ "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/mode=1
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
|
|
|
@ -2,29 +2,26 @@
|
|||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.s3tc.stex"
|
||||
path.etc2="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc2.stex"
|
||||
path.etc="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc.stex"
|
||||
path="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "bptc", "s3tc", "etc2", "etc" ],
|
||||
"vram_texture": true
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MLPAssets/Textures/CardBack.png"
|
||||
dest_files=[ "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.s3tc.stex", "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc2.stex", "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc.stex" ]
|
||||
dest_files=[ "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/mode=1
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
|
|
|
@ -32,11 +32,12 @@ onready var texture: Texture = cardImage.get_surface_material(0)
|
|||
|
||||
func set_cardid(val: String):
|
||||
cardID = val
|
||||
if ready:
|
||||
if ready and cardID != "":
|
||||
Resources.get_card(val, self, "_card_fetched")
|
||||
|
||||
func _ready():
|
||||
Resources.get_card(cardID, self, "_card_fetched")
|
||||
if cardID != "":
|
||||
Resources.get_card(cardID, self, "_card_fetched")
|
||||
ready = true
|
||||
|
||||
func _mouse_hover():
|
||||
|
|
|
@ -263,7 +263,6 @@ transform = Transform( 1, 0, 0, 0, 1.17955, 0, 0, 0, 1, 0, 0.000197917, 0 )
|
|||
shape = SubResource( 1 )
|
||||
|
||||
[node name="CardModel" type="Spatial" parent="."]
|
||||
transform = Transform( 0.999409, 0.0343663, 0, -0.0343663, 0.999409, 0, 0, 0, 1, 0, 0.0986242, 0 )
|
||||
|
||||
[node name="Border" type="MeshInstance" parent="CardModel"]
|
||||
mesh = ExtResource( 2 )
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/Draft/CardListItem.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Scenes/DeckBuilder/CardListItem.gd" type="Script" id=1]
|
||||
[ext_resource path="res://UIAssets/Fonts/Catamaran-Bold.ttf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://UIAssets/Fonts/Catamaran-Light.ttf" type="DynamicFontData" id=3]
|
||||
[ext_resource path="res://MLPAssets/Icons/flat-cost.png" type="Texture" id=4]
|
||||
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 12
|
||||
use_mipmaps = true
|
31
Scenes/DeckBuilder/CardZoom.gd
Normal file
31
Scenes/DeckBuilder/CardZoom.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
extends Control
|
||||
|
||||
var cardID := "" setget set_cardid
|
||||
var ready = false
|
||||
|
||||
func set_cardid(val: String):
|
||||
cardID = val
|
||||
if cardID != "":
|
||||
Resources.get_card(val, self, "_card_fetched")
|
||||
|
||||
# warning-ignore:unused_argument
|
||||
func _card_fetched(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray):
|
||||
assert(result == HTTPRequest.RESULT_SUCCESS)
|
||||
var img = Image.new()
|
||||
var err = img.load_webp_from_buffer(body)
|
||||
assert(err == OK)
|
||||
if img.get_width() > img.get_height():
|
||||
rect_min_size = Vector2(480,344)
|
||||
rect_size = Vector2(480,344)
|
||||
else:
|
||||
rect_min_size = Vector2(344,480)
|
||||
rect_size = Vector2(344,480)
|
||||
var texture := ImageTexture.new()
|
||||
texture.create_from_image(img)
|
||||
$TextureRect.texture = texture
|
||||
|
||||
func fadein():
|
||||
$AnimationPlayer.play("zoom-fadein")
|
||||
|
||||
func fadeout():
|
||||
$AnimationPlayer.play("zoom-fadeout")
|
156
Scenes/DeckBuilder/CardZoom.tscn
Normal file
156
Scenes/DeckBuilder/CardZoom.tscn
Normal file
|
@ -0,0 +1,156 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/DeckBuilder/CardZoom.gd" type="Script" id=1]
|
||||
[ext_resource path="res://UIAssets/Effects/FadeBorder.shader" type="Shader" id=2]
|
||||
[ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=1]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource( 2 )
|
||||
shader_param/effect_color = Color( 0.262745, 0.72549, 0.976471, 0.537255 )
|
||||
shader_param/effect_width = 0.05
|
||||
shader_param/effect_offset = 0.01
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "zoom-fadein"
|
||||
length = 0.2
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0.05, 0.15 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.05 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ false, true ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("TextureRect:rect_position")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0.05, 0.15 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 38.9606, 101.817 ), Vector2( 0, 0 ) ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("TextureRect:rect_scale")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0.05, 0.15 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0.9, 0.9 ), Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "zoom-fadeout"
|
||||
length = 0.2
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0.1, 0.15 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ true, false ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("TextureRect:rect_position")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( 30, 0 ) ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("TextureRect:rect_scale")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="CardZoom" type="Control"]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_right = -936.0
|
||||
margin_bottom = -320.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
mouse_filter = 2
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
material = SubResource( 1 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -20.0
|
||||
margin_top = -20.0
|
||||
margin_right = 20.0
|
||||
margin_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 30.0
|
||||
margin_right = 30.0
|
||||
margin_bottom = -0.00012207
|
||||
mouse_filter = 2
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/zoom-fadein = SubResource( 2 )
|
||||
anims/zoom-fadeout = SubResource( 3 )
|
46
Scenes/DeckBuilder/UICard.gd
Normal file
46
Scenes/DeckBuilder/UICard.gd
Normal file
|
@ -0,0 +1,46 @@
|
|||
extends Control
|
||||
|
||||
signal card_selected()
|
||||
signal card_unselected()
|
||||
signal card_hover(position)
|
||||
signal card_clicked()
|
||||
signal loaded()
|
||||
|
||||
var cardID := "" setget set_cardid
|
||||
var ready = false
|
||||
|
||||
func set_cardid(val: String):
|
||||
cardID = val
|
||||
if ready and cardID != "":
|
||||
Resources.get_card(val, self, "_card_fetched")
|
||||
|
||||
func _ready():
|
||||
if cardID != "":
|
||||
Resources.get_card(cardID, self, "_card_fetched")
|
||||
ready = true
|
||||
|
||||
func _gui_input(event):
|
||||
# Left click
|
||||
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
|
||||
emit_signal("card_clicked")
|
||||
if event is InputEventMouseMotion:
|
||||
emit_signal("card_hover", event.position)
|
||||
|
||||
func _mouse_entered():
|
||||
$AnimationPlayer.play("glow")
|
||||
emit_signal("card_selected")
|
||||
|
||||
func _mouse_exited():
|
||||
$AnimationPlayer.play_backwards("glow")
|
||||
emit_signal("card_unselected")
|
||||
|
||||
# warning-ignore:unused_argument
|
||||
func _card_fetched(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray):
|
||||
assert(result == HTTPRequest.RESULT_SUCCESS)
|
||||
var img = Image.new()
|
||||
var err = img.load_webp_from_buffer(body)
|
||||
assert(err == OK)
|
||||
var texture := ImageTexture.new()
|
||||
texture.create_from_image(img)
|
||||
$TextureRect.texture = texture
|
||||
emit_signal("loaded")
|
70
Scenes/DeckBuilder/UICard.tscn
Normal file
70
Scenes/DeckBuilder/UICard.tscn
Normal file
|
@ -0,0 +1,70 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/DeckBuilder/UICard.gd" type="Script" id=1]
|
||||
[ext_resource path="res://UIAssets/Effects/FadeBorder.shader" type="Shader" id=2]
|
||||
[ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=4]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource( 2 )
|
||||
shader_param/effect_color = Color( 0.0117647, 0.768627, 1, 0 )
|
||||
shader_param/effect_width = 0.1
|
||||
shader_param/effect_offset = 0.0
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "glow"
|
||||
length = 0.1
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("ColorRect:material:shader_param/effect_color")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 0.0117647, 0.768627, 1, 0 ), Color( 0.0117647, 0.768627, 1, 1 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("ColorRect:material:shader_param/effect_width")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ 0.1, 0.05 ]
|
||||
}
|
||||
|
||||
[node name="UICard" type="Control"]
|
||||
margin_right = 344.0
|
||||
margin_bottom = 480.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
rect_pivot_offset = Vector2( 172, 240 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
material = SubResource( 4 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -20.0
|
||||
margin_top = -20.0
|
||||
margin_right = 20.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/glow = SubResource( 3 )
|
||||
[connection signal="gui_input" from="." to="." method="_gui_input"]
|
||||
[connection signal="mouse_entered" from="." to="." method="_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="_mouse_exited"]
|
|
@ -2,11 +2,16 @@
|
|||
|
||||
[ext_resource path="res://Scenes/Scripts/Draft.gd" type="Script" id=1]
|
||||
[ext_resource path="res://MLPAssets/Background/hall.png" type="Texture" id=2]
|
||||
[ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=3]
|
||||
[ext_resource path="res://Scenes/DeckBuilder/CardZoom.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="hall" type="TextureRect" parent="."]
|
||||
|
@ -18,6 +23,7 @@ expand = true
|
|||
stretch_mode = 6
|
||||
|
||||
[node name="PickedCardListScroll" type="ScrollContainer" parent="."]
|
||||
editor/display_folded = true
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -30,7 +36,7 @@ scroll_horizontal_enabled = false
|
|||
|
||||
[node name="PickedCardList" type="VBoxContainer" parent="PickedCardListScroll"]
|
||||
margin_right = 220.0
|
||||
margin_bottom = 760.0
|
||||
margin_bottom = 761.0
|
||||
rect_min_size = Vector2( 220, 0 )
|
||||
size_flags_vertical = 3
|
||||
|
||||
|
@ -47,9 +53,9 @@ margin_right = 220.0
|
|||
|
||||
[node name="EntryLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
|
||||
visible = false
|
||||
margin_top = 31.0
|
||||
margin_top = 4.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 54.0
|
||||
margin_bottom = 27.0
|
||||
rect_min_size = Vector2( 0, 23 )
|
||||
text = "Entry"
|
||||
valign = 1
|
||||
|
@ -61,9 +67,9 @@ margin_bottom = 4.0
|
|||
|
||||
[node name="FriendsLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
|
||||
visible = false
|
||||
margin_top = 62.0
|
||||
margin_top = 8.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 85.0
|
||||
margin_bottom = 31.0
|
||||
rect_min_size = Vector2( 0, 23 )
|
||||
text = "Friends"
|
||||
valign = 1
|
||||
|
@ -75,9 +81,9 @@ margin_bottom = 8.0
|
|||
|
||||
[node name="ResourcesLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
|
||||
visible = false
|
||||
margin_top = 93.0
|
||||
margin_top = 12.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 116.0
|
||||
margin_bottom = 35.0
|
||||
rect_min_size = Vector2( 0, 23 )
|
||||
text = "Resources"
|
||||
valign = 1
|
||||
|
@ -89,9 +95,9 @@ margin_bottom = 12.0
|
|||
|
||||
[node name="EventsLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
|
||||
visible = false
|
||||
margin_top = 124.0
|
||||
margin_top = 16.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 147.0
|
||||
margin_bottom = 39.0
|
||||
rect_min_size = Vector2( 0, 23 )
|
||||
text = "Events"
|
||||
valign = 1
|
||||
|
@ -103,9 +109,9 @@ margin_bottom = 16.0
|
|||
|
||||
[node name="TroublemakersLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
|
||||
visible = false
|
||||
margin_top = 155.0
|
||||
margin_top = 20.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 178.0
|
||||
margin_bottom = 43.0
|
||||
rect_min_size = Vector2( 0, 23 )
|
||||
text = "Troublemakers"
|
||||
valign = 1
|
||||
|
@ -117,9 +123,9 @@ margin_bottom = 20.0
|
|||
|
||||
[node name="ProblemsLabel" type="Label" parent="PickedCardListScroll/PickedCardList"]
|
||||
visible = false
|
||||
margin_top = 186.0
|
||||
margin_top = 24.0
|
||||
margin_right = 220.0
|
||||
margin_bottom = 209.0
|
||||
margin_bottom = 47.0
|
||||
rect_min_size = Vector2( 0, 23 )
|
||||
text = "Problems"
|
||||
valign = 1
|
||||
|
@ -130,127 +136,20 @@ margin_right = 220.0
|
|||
margin_bottom = 24.0
|
||||
|
||||
[node name="Cards" type="GridContainer" parent="."]
|
||||
editor/display_folded = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 234.076
|
||||
margin_top = 40.1522
|
||||
margin_right = 400.0
|
||||
margin_bottom = 688.152
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -350.0
|
||||
margin_top = -376.0
|
||||
margin_right = 1056.0
|
||||
margin_bottom = 1084.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rect_scale = Vector2( 0.5, 0.5 )
|
||||
custom_constants/vseparation = 10
|
||||
custom_constants/hseparation = 10
|
||||
columns = 4
|
||||
|
||||
[node name="unknowncard" type="TextureRect" parent="Cards"]
|
||||
margin_right = 344.0
|
||||
margin_bottom = 480.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard8" type="TextureRect" parent="Cards"]
|
||||
margin_left = 348.0
|
||||
margin_right = 692.0
|
||||
margin_bottom = 480.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard4" type="TextureRect" parent="Cards"]
|
||||
margin_left = 696.0
|
||||
margin_right = 1040.0
|
||||
margin_bottom = 480.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard10" type="TextureRect" parent="Cards"]
|
||||
margin_left = 1044.0
|
||||
margin_right = 1388.0
|
||||
margin_bottom = 480.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard2" type="TextureRect" parent="Cards"]
|
||||
margin_top = 484.0
|
||||
margin_right = 344.0
|
||||
margin_bottom = 964.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard7" type="TextureRect" parent="Cards"]
|
||||
margin_left = 348.0
|
||||
margin_top = 484.0
|
||||
margin_right = 692.0
|
||||
margin_bottom = 964.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard5" type="TextureRect" parent="Cards"]
|
||||
margin_left = 696.0
|
||||
margin_top = 484.0
|
||||
margin_right = 1040.0
|
||||
margin_bottom = 964.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard12" type="TextureRect" parent="Cards"]
|
||||
margin_left = 1044.0
|
||||
margin_top = 484.0
|
||||
margin_right = 1388.0
|
||||
margin_bottom = 964.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard3" type="TextureRect" parent="Cards"]
|
||||
margin_top = 968.0
|
||||
margin_right = 344.0
|
||||
margin_bottom = 1448.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard9" type="TextureRect" parent="Cards"]
|
||||
margin_left = 348.0
|
||||
margin_top = 968.0
|
||||
margin_right = 692.0
|
||||
margin_bottom = 1448.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard6" type="TextureRect" parent="Cards"]
|
||||
margin_left = 696.0
|
||||
margin_top = 968.0
|
||||
margin_right = 1040.0
|
||||
margin_bottom = 1448.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="unknowncard11" type="TextureRect" parent="Cards"]
|
||||
margin_left = 1044.0
|
||||
margin_top = 968.0
|
||||
margin_right = 1388.0
|
||||
margin_bottom = 1448.0
|
||||
rect_min_size = Vector2( 344, 480 )
|
||||
texture = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
[node name="CardZoom" parent="." instance=ExtResource( 3 )]
|
||||
rect_scale = Vector2( 0.8, 0.8 )
|
||||
|
|
|
@ -18,4 +18,56 @@ var labels = {
|
|||
"event": $PickedCardListScroll/PickedCardList/EventsLabel,
|
||||
"troublemaker": $PickedCardListScroll/PickedCardList/TroublemakersLabel,
|
||||
"problem": $PickedCardListScroll/PickedCardList/ProblemsLabel
|
||||
}
|
||||
}
|
||||
|
||||
var CardUI := preload("res://Scenes/DeckBuilder/UICard.tscn")
|
||||
|
||||
func _ready():
|
||||
add_card("pr1")
|
||||
add_card("pr10")
|
||||
add_card("pr20")
|
||||
add_card("pr30")
|
||||
add_card("pr166")
|
||||
add_card("pr171")
|
||||
add_card("pr16")
|
||||
add_card("pr171")
|
||||
add_card("pr1")
|
||||
add_card("pr10")
|
||||
add_card("pr20")
|
||||
add_card("pr30")
|
||||
|
||||
func add_card(cardID: String):
|
||||
var card := CardUI.instance()
|
||||
card.cardID = cardID
|
||||
card.connect("card_selected", self, "_card_selected", [cardID])
|
||||
card.connect("card_unselected", self, "_card_unselected")
|
||||
card.connect("card_hover", self, "_mouse_on_card", [card])
|
||||
$Cards.add_child(card)
|
||||
|
||||
func _card_selected(cardID: String):
|
||||
$CardZoom.cardID = cardID
|
||||
$CardZoom.fadein()
|
||||
|
||||
func _card_unselected():
|
||||
$CardZoom.fadeout()
|
||||
|
||||
const yMargin = 5
|
||||
const xEdge = 200
|
||||
const yEdge = 10
|
||||
|
||||
func _mouse_on_card(position: Vector2, card: Control):
|
||||
# THIS IS A MESS
|
||||
# Should be cleaned but there are way too many scaling things to keep track of
|
||||
# and it's midnight right now
|
||||
var pos: Vector2 = card.rect_position * $Cards.rect_scale
|
||||
var cardpos: Vector2 = $Cards.rect_position + card.rect_position * $Cards.rect_scale
|
||||
if $CardZoom.rect_size.x > rect_size.x - cardpos.x - xEdge:
|
||||
pos.x -= $CardZoom.rect_size.x * $CardZoom.rect_scale.x
|
||||
else:
|
||||
pos.x += card.rect_size.x * $Cards.rect_scale.x
|
||||
pos.y -= ($CardZoom.rect_size.y * $CardZoom.rect_scale.y)/4
|
||||
if pos.y < yMargin:
|
||||
pos.y = yMargin
|
||||
elif $CardZoom.rect_size.y > rect_size.y - cardpos.y - yEdge:
|
||||
pos.y = rect_size.y - $CardZoom.rect_size.y - yMargin
|
||||
$CardZoom.rect_position = $Cards.rect_position + pos
|
34
UIAssets/Effects/FadeBorder.shader
Normal file
34
UIAssets/Effects/FadeBorder.shader
Normal file
|
@ -0,0 +1,34 @@
|
|||
shader_type canvas_item;
|
||||
render_mode blend_mix,unshaded;
|
||||
|
||||
uniform vec4 effect_color : hint_color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
uniform float effect_width : hint_range(0, 0.5) = 0.1;
|
||||
uniform float effect_offset : hint_range(0, 0.5) = 0;
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = UV;
|
||||
// Apply offset
|
||||
if (uv.x < 0.5) {
|
||||
uv.x -= effect_offset;
|
||||
} else {
|
||||
uv.x += effect_offset;
|
||||
}
|
||||
if (uv.y < 0.5) {
|
||||
uv.y -= effect_offset;
|
||||
} else {
|
||||
uv.y += effect_offset;
|
||||
}
|
||||
uv = clamp(uv, 0, 1);
|
||||
|
||||
COLOR = effect_color;
|
||||
if (uv.x < effect_width) {
|
||||
COLOR.a *= uv.x / effect_width;
|
||||
} else if (uv.x > 1.0-effect_width) {
|
||||
COLOR.a *= ((1.0 - uv.x) / effect_width);
|
||||
}
|
||||
if (uv.y < effect_width) {
|
||||
COLOR.a *= uv.y / effect_width;
|
||||
} else if (uv.y > 1.0-effect_width) {
|
||||
COLOR.a *= ((1.0 - uv.y) / effect_width);
|
||||
}
|
||||
}
|
36
UIAssets/Effects/Shiny.shader
Normal file
36
UIAssets/Effects/Shiny.shader
Normal file
|
@ -0,0 +1,36 @@
|
|||
shader_type canvas_item;
|
||||
render_mode blend_mix,unshaded;
|
||||
|
||||
uniform vec4 effect_color : hint_color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
uniform float effect_strength : hint_range(0, 1) = 0.5;
|
||||
uniform float effect_offset : hint_range(-0.7, 0.7) = 0;
|
||||
uniform float rotation : hint_range(-90, 90) = 0;
|
||||
uniform float width : hint_range(0, 0.5) = 0.2;
|
||||
uniform float softness : hint_range(0, 1) = 0.5;
|
||||
|
||||
void fragment() {
|
||||
float a, b, c, powsum;
|
||||
float rad = radians(rotation);
|
||||
if (rotation < 45f && rotation > -45f) {
|
||||
a = 1.0;
|
||||
b = tan(rad);
|
||||
c = -0.5f - 0.5f * b - effect_offset / cos(rad);
|
||||
} else {
|
||||
b =1.0;
|
||||
a = 1.0 / tan(rad);
|
||||
c = -0.5 - 0.5f * a - effect_offset / sin(rad);
|
||||
}
|
||||
float d = abs(a * UV.x + b * UV.y + c) / sqrt(a * a + b * b);
|
||||
float edge = (1.0 - softness) * width;
|
||||
if ( d < edge) {
|
||||
vec4 color = texture(TEXTURE, UV);
|
||||
COLOR = effect_color * effect_strength + color;
|
||||
COLOR.a = color.a;
|
||||
} else if (d > width) {
|
||||
COLOR = texture(TEXTURE, UV);
|
||||
} else {
|
||||
vec4 color = texture(TEXTURE, UV);
|
||||
COLOR = (width - d) / (width - edge) * effect_color * effect_strength + color;
|
||||
COLOR.a = color.a;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue