diff --git a/AssetSrc/playerboticons.afdesign b/AssetSrc/playerboticons.afdesign new file mode 100644 index 0000000..69c3847 Binary files /dev/null and b/AssetSrc/playerboticons.afdesign differ diff --git a/Scenes/Draft.tscn b/Scenes/Draft.tscn index 631579f..77c7a2d 100644 --- a/Scenes/Draft.tscn +++ b/Scenes/Draft.tscn @@ -36,12 +36,12 @@ scroll_horizontal_enabled = false [node name="PickedCardList" parent="PickedCardListScroll" instance=ExtResource( 3 )] -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="PlayerList" type="VBoxContainer" parent="."] anchor_bottom = 1.0 margin_left = 20.0 margin_top = 20.0 margin_right = 220.0 -margin_bottom = 20.0 +margin_bottom = -20.0 [node name="Cards" type="GridContainer" parent="."] anchor_left = 0.5 diff --git a/Scenes/Draft/PlayerItem.gd b/Scenes/Draft/PlayerItem.gd new file mode 100644 index 0000000..c0e975d --- /dev/null +++ b/Scenes/Draft/PlayerItem.gd @@ -0,0 +1,23 @@ +extends Panel + +export var isBot: bool = false +export var playerName: String = "Nobody" + +export var pickedColor: Color +export var pickingColor: Color + +onready var playerIcon := $PlayerIcon +onready var playerNameLabel := $PlayerName + +func _ready(): + if isBot: + var atl := (playerIcon.texture as AtlasTexture).duplicate() + atl.region.position.x = 0 + playerIcon.texture = atl + playerNameLabel.text = playerName + +func set_picked(picked: bool): + if picked: + playerNameLabel.add_color_override("font_color", pickedColor) + else: + playerNameLabel.add_color_override("font_color", pickingColor) \ No newline at end of file diff --git a/Scenes/Draft/PlayerItem.tscn b/Scenes/Draft/PlayerItem.tscn new file mode 100644 index 0000000..b9cf76d --- /dev/null +++ b/Scenes/Draft/PlayerItem.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://Scenes/Draft/PlayerItem.gd" type="Script" id=1] +[ext_resource path="res://UIAssets/Draft/playericons.png" type="Texture" id=2] +[ext_resource path="res://UIAssets/Fonts/Catamaran-Bold.ttf" type="DynamicFontData" id=3] + +[sub_resource type="AtlasTexture" id=1] +flags = 13 +atlas = ExtResource( 2 ) +region = Rect2( 64, 0, 64, 64 ) + +[sub_resource type="DynamicFont" id=2] +size = 12 +extra_spacing_top = 2 +font_data = ExtResource( 3 ) + +[node name="PlayerItem" type="Panel"] +margin_right = 150.0 +margin_bottom = 23.0 +rect_min_size = Vector2( 150, 23 ) +size_flags_horizontal = 3 +script = ExtResource( 1 ) +pickedColor = Color( 0.380392, 0.984314, 0.372549, 1 ) +pickingColor = Color( 1, 0.243137, 0.278431, 1 ) + +[node name="PlayerIcon" type="TextureRect" parent="."] +anchor_bottom = 1.0 +margin_top = 2.0 +margin_right = 30.0 +margin_bottom = -2.0 +texture = SubResource( 1 ) +expand = true +stretch_mode = 6 + +[node name="PlayerName" type="Label" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 30.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_fonts/font = SubResource( 2 ) +text = "Nobody" +valign = 1 diff --git a/Scenes/Scripts/Draft.gd b/Scenes/Scripts/Draft.gd index 1fb8b6c..ce7c7ab 100644 --- a/Scenes/Scripts/Draft.gd +++ b/Scenes/Scripts/Draft.gd @@ -1,8 +1,12 @@ extends Control onready var CardList = $PickedCardListScroll/PickedCardList +onready var PlayerList = $PlayerList + +var players = {} var CardUI := preload("res://Scenes/DeckBuilder/UICard.tscn") +var PlayerItem := preload("res://Scenes/Draft/PlayerItem.tscn") func _ready(): add_card("pr1") @@ -17,6 +21,8 @@ func _ready(): add_card("pr10") add_card("pr20") add_card("pr30") + add_player("Player 1", false) + add_player("Bot 1", true) func add_card(cardID: String): var card := CardUI.instance() @@ -40,9 +46,18 @@ func _card_unselected(): func _card_picked(cardID: String): CardList.add_card(cardID) + players["Player 1"].set_picked(true) $CardZoom.fadeout() #clear_cards() +func add_player(playerName: String, isBot: bool): + var item := PlayerItem.instance() + item.playerName = playerName + item.isBot = isBot + players[playerName] = item + $PlayerList.add_child(item) + item.set_picked(false) + const yMargin = 5 const xEdge = 200 const yEdge = 10 diff --git a/UIAssets/Draft/playericons.png b/UIAssets/Draft/playericons.png new file mode 100644 index 0000000..0c090d9 Binary files /dev/null and b/UIAssets/Draft/playericons.png differ diff --git a/UIAssets/Draft/playericons.png.import b/UIAssets/Draft/playericons.png.import new file mode 100644 index 0000000..0e07076 --- /dev/null +++ b/UIAssets/Draft/playericons.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/playericons.png-eeeb153289558a7b4ae89e3caa9a0b44.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UIAssets/Draft/playericons.png" +dest_files=[ "res://.import/playericons.png-eeeb153289558a7b4ae89e3caa9a0b44.stex" ] + +[params] + +compress/mode=1 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=true +flags/anisotropic=true +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/project.godot b/project.godot index 912be54..c30f9fc 100644 --- a/project.godot +++ b/project.godot @@ -77,6 +77,7 @@ gdscript/warnings/unsafe_call_argument=true window/size/width=1280 window/size/height=800 +window/dpi/allow_hidpi=true window/stretch/mode="2d" window/stretch/aspect="expand"