Skip to content

Commit

Permalink
Improve ui, fix bugs with launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Atlinx committed Jul 27, 2023
1 parent 74ba3c3 commit 04863e3
Show file tree
Hide file tree
Showing 15 changed files with 185 additions and 40 deletions.
1 change: 1 addition & 0 deletions CogsPartyLauncher/assets/icon_add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions CogsPartyLauncher/assets/icon_add.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://c27ucuw3vtgn6"
path="res://.godot/imported/icon_add.svg-c7fda2bfb8ff6d6baa27b09a81576c16.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/icon_add.svg"
dest_files=["res://.godot/imported/icon_add.svg-c7fda2bfb8ff6d6baa27b09a81576c16.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
1 change: 1 addition & 0 deletions CogsPartyLauncher/assets/icon_close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions CogsPartyLauncher/assets/icon_close.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bnna1b7hu12k"
path="res://.godot/imported/icon_close.svg-f6a0d84d2b71f33aa20260176384f21b.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/icon_close.svg"
dest_files=["res://.godot/imported/icon_close.svg-f6a0d84d2b71f33aa20260176384f21b.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
1 change: 0 additions & 1 deletion CogsPartyLauncher/assets/theme.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

[resource]
default_font = ExtResource("2_of4dy")
default_font_size = 18
RichTextLabel/fonts/bold_font = ExtResource("1_4qjdl")
45 changes: 28 additions & 17 deletions CogsPartyLauncher/prefabs/game_entry.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://b3fh8hsqlpcp2"]
[gd_scene load_steps=7 format=3 uid="uid://b3fh8hsqlpcp2"]

[ext_resource type="Texture2D" uid="uid://86474c6ugxyg" path="res://assets/sgj_poster.png" id="1_asex0"]
[ext_resource type="Theme" uid="uid://036n6qd3ik2g" path="res://assets/theme.tres" id="1_lafwr"]
[ext_resource type="Script" path="res://scripts/game_entry.gd" id="1_y8fwy"]
[ext_resource type="FontFile" uid="uid://bg4kldgugtb2r" path="res://assets/urbanist/static/Urbanist-Black.ttf" id="2_o3hcj"]
[ext_resource type="Script" path="res://scripts/crossout.gd" id="5_a1qsc"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_km0gx"]
content_margin_left = 8.0
Expand All @@ -14,64 +15,74 @@ bg_color = Color(0.996078, 0.372549, 0.372549, 1)
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8

[node name="GameEntry" type="VBoxContainer" node_paths=PackedStringArray("banner_rect", "title_label", "description_label", "error_panel", "error_panel_label", "content_container", "enabled_checkbox", "player_count_label")]
[node name="GameEntry" type="VBoxContainer" node_paths=PackedStringArray("banner_rect", "title_label", "description_label", "error_panel", "error_panel_label", "content_container", "enabled_checkbox", "player_count_label", "crossout")]
offset_right = 410.0
offset_bottom = 146.0
size_flags_horizontal = 3
theme = ExtResource("1_lafwr")
theme_override_constants/separation = 0
script = ExtResource("1_y8fwy")
banner_rect = NodePath("ContentContainer/BannerRect")
title_label = NodePath("ContentContainer/VBoxContainer/TitleLabel")
description_label = NodePath("ContentContainer/VBoxContainer/DescriptionLabel")
banner_rect = NodePath("MarginContainer/ContentContainer/BannerRect")
title_label = NodePath("MarginContainer/ContentContainer/VBoxContainer/TitleLabel")
description_label = NodePath("MarginContainer/ContentContainer/VBoxContainer/DescriptionLabel")
error_panel = NodePath("ErrorPanel")
error_panel_label = NodePath("ErrorPanel/ErrorPanelLabel")
content_container = NodePath("ContentContainer")
enabled_checkbox = NodePath("ContentContainer/VBoxContainer2/EnabledCheckbox")
player_count_label = NodePath("ContentContainer/VBoxContainer/PlayerCountLabel")
content_container = NodePath("MarginContainer/ContentContainer")
enabled_checkbox = NodePath("MarginContainer/ContentContainer/VBoxContainer2/EnabledCheckbox")
player_count_label = NodePath("MarginContainer/ContentContainer/VBoxContainer/PlayerCountLabel")
crossout = NodePath("MarginContainer/Crossout")

[node name="ContentContainer" type="HBoxContainer" parent="."]
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2

[node name="ContentContainer" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 18

[node name="BannerRect" type="TextureRect" parent="ContentContainer"]
[node name="BannerRect" type="TextureRect" parent="MarginContainer/ContentContainer"]
custom_minimum_size = Vector2(105, 140)
layout_mode = 2
texture = ExtResource("1_asex0")
expand_mode = 1
stretch_mode = 6

[node name="VBoxContainer" type="VBoxContainer" parent="ContentContainer"]
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ContentContainer"]
layout_mode = 2
size_flags_horizontal = 3

[node name="TitleLabel" type="Label" parent="ContentContainer/VBoxContainer"]
[node name="TitleLabel" type="Label" parent="MarginContainer/ContentContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 1
theme_override_fonts/font = ExtResource("2_o3hcj")
text = "Cool Game"

[node name="DescriptionLabel" type="Label" parent="ContentContainer/VBoxContainer"]
[node name="DescriptionLabel" type="Label" parent="MarginContainer/ContentContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/font_color = Color(1, 1, 1, 0.784314)
text = "the quick brown fox jumps over the lazy dog. the quick brown fox jumps over the lazy dog. the quick brown fox jumps over the lazy dog."
autowrap_mode = 2
text_overrun_behavior = 3

[node name="PlayerCountLabel" type="Label" parent="ContentContainer/VBoxContainer"]
[node name="PlayerCountLabel" type="Label" parent="MarginContainer/ContentContainer/VBoxContainer"]
layout_mode = 2
text = "4 - 8 Players"

[node name="Control" type="Control" parent="ContentContainer/VBoxContainer"]
[node name="Control" type="Control" parent="MarginContainer/ContentContainer/VBoxContainer"]
layout_mode = 2

[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer/ContentContainer"]
layout_mode = 2

[node name="VBoxContainer2" type="VBoxContainer" parent="ContentContainer"]
[node name="EnabledCheckbox" type="CheckBox" parent="MarginContainer/ContentContainer/VBoxContainer2"]
layout_mode = 2

[node name="EnabledCheckbox" type="CheckBox" parent="ContentContainer/VBoxContainer2"]
[node name="Crossout" type="Control" parent="MarginContainer"]
visible = false
self_modulate = Color(1, 0.34902, 0.34902, 1)
layout_mode = 2
script = ExtResource("5_a1qsc")

[node name="ErrorPanel" type="PanelContainer" parent="."]
layout_mode = 2
Expand Down
6 changes: 5 additions & 1 deletion CogsPartyLauncher/prefabs/game_library_display.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[gd_scene load_steps=5 format=3 uid="uid://bp0606lonchki"]
[gd_scene load_steps=6 format=3 uid="uid://bp0606lonchki"]

[ext_resource type="Theme" uid="uid://036n6qd3ik2g" path="res://assets/theme.tres" id="1_7e4nq"]
[ext_resource type="Script" path="res://scripts/game_library_display.gd" id="1_y4w2o"]
[ext_resource type="PackedScene" uid="uid://b3fh8hsqlpcp2" path="res://prefabs/game_entry.tscn" id="2_vypkx"]
[ext_resource type="FontFile" uid="uid://bg4kldgugtb2r" path="res://assets/urbanist/static/Urbanist-Black.ttf" id="3_jyrsh"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_t3e3d"]
content_margin_right = 8.0

[node name="GameLibraryDisplay" type="VBoxContainer" node_paths=PackedStringArray("game_entry_container", "games_label")]
theme = ExtResource("1_7e4nq")
script = ExtResource("1_y4w2o")
Expand Down Expand Up @@ -37,6 +40,7 @@ text = "G A M E S (1/2)"
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxEmpty_t3e3d")
horizontal_scroll_mode = 0

[node name="GameEntryContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer"]
Expand Down
6 changes: 4 additions & 2 deletions CogsPartyLauncher/prefabs/player_setting.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://c24hlo57mf44p"]
[gd_scene load_steps=7 format=3 uid="uid://c24hlo57mf44p"]

[ext_resource type="Script" path="res://scripts/player_setting.gd" id="1_6lld3"]
[ext_resource type="Theme" uid="uid://036n6qd3ik2g" path="res://assets/theme.tres" id="1_cghqm"]
[ext_resource type="Texture2D" uid="uid://cvnj8l4lspw3d" path="res://assets/icon_arrow_left.svg" id="2_ajqs2"]
[ext_resource type="Texture2D" uid="uid://dt0bslhmu3sfq" path="res://assets/icon_arrow_right.svg" id="3_pocyf"]
[ext_resource type="Texture2D" uid="uid://bnna1b7hu12k" path="res://assets/icon_close.svg" id="5_5fgrl"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tcaly"]
content_margin_left = 16.0
Expand Down Expand Up @@ -60,4 +61,5 @@ icon = ExtResource("3_pocyf")
[node name="RemoveButton" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
text = "Remove"
icon = ExtResource("5_5fgrl")
icon_alignment = 1
2 changes: 1 addition & 1 deletion CogsPartyLauncher/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ project/assembly_name="CogsPartyLauncher"

[editor_plugins]

enabled=PackedStringArray("res://addons/max_size_container/plugin.cfg")
enabled=PackedStringArray("res://addons/editor_icon_previewer/plugin.cfg", "res://addons/max_size_container/plugin.cfg")

[rendering]

Expand Down
12 changes: 8 additions & 4 deletions CogsPartyLauncher/scenes/main.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://k31chn02rvs2"]
[gd_scene load_steps=22 format=3 uid="uid://k31chn02rvs2"]

[ext_resource type="Theme" uid="uid://036n6qd3ik2g" path="res://assets/theme.tres" id="1_erdau"]
[ext_resource type="Script" path="res://scripts/main_menu.gd" id="2_6njpl"]
Expand All @@ -11,6 +11,7 @@
[ext_resource type="Script" path="res://scripts/game_library.gd" id="7_afary"]
[ext_resource type="Texture2D" uid="uid://uc8pxnfjvsmj" path="res://assets/icon_reload.svg" id="7_ywnar"]
[ext_resource type="PackedScene" uid="uid://c24hlo57mf44p" path="res://prefabs/player_setting.tscn" id="8_g7i7g"]
[ext_resource type="Texture2D" uid="uid://c27ucuw3vtgn6" path="res://assets/icon_add.svg" id="9_f0lwm"]
[ext_resource type="Script" path="res://scripts/lobby_menu.gd" id="9_iaqec"]
[ext_resource type="PackedScene" uid="uid://ccybwxdqx3qi7" path="res://prefabs/lobby_player.tscn" id="10_ewmxw"]
[ext_resource type="PackedScene" uid="uid://bp0606lonchki" path="res://prefabs/game_library_display.tscn" id="11_gn2ub"]
Expand Down Expand Up @@ -132,7 +133,6 @@ theme_override_constants/margin_right = 30
theme_override_constants/margin_bottom = 30

[node name="PlayerSelectMenu" type="VBoxContainer" parent="Menus" node_paths=PackedStringArray("player_setting_container", "add_player_button", "play_button", "back_button", "game_library", "menu_navigator", "game_library_display")]
visible = false
layout_mode = 2
theme_override_constants/separation = 32
alignment = 1
Expand All @@ -150,6 +150,7 @@ game_library_display = NodePath("HBoxContainer2/GameLibraryDisplay")
[node name="HBoxContainer2" type="HBoxContainer" parent="Menus/PlayerSelectMenu"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 16

[node name="PanelContainer" type="PanelContainer" parent="Menus/PlayerSelectMenu/HBoxContainer2"]
layout_mode = 2
Expand Down Expand Up @@ -194,7 +195,8 @@ theme_override_fonts/font = ExtResource("4_jhk8j")
theme_override_styles/normal = SubResource("StyleBoxFlat_5ytcv")
theme_override_styles/hover = SubResource("StyleBoxFlat_5cgwq")
theme_override_styles/pressed = SubResource("StyleBoxFlat_5ytcv")
text = "A D D"
icon = ExtResource("9_f0lwm")
icon_alignment = 1

[node name="GameLibraryDisplay" parent="Menus/PlayerSelectMenu/HBoxContainer2" instance=ExtResource("11_gn2ub")]
layout_mode = 2
Expand Down Expand Up @@ -225,6 +227,7 @@ theme_override_styles/pressed = SubResource("StyleBoxFlat_55hvc")
text = "P L A Y"

[node name="LobbyMenu" type="MarginContainer" parent="Menus" node_paths=PackedStringArray("menu_navigator", "game_library", "game_library_display", "quit_button", "next_button", "lobby_player_container", "lobby_view", "running_game_playing_label", "running_view", "running_game_entry")]
visible = false
layout_mode = 2
script = ExtResource("9_iaqec")
menu_navigator = NodePath("../../MenuNavigator")
Expand All @@ -240,12 +243,12 @@ running_view = NodePath("RunningView")
running_game_entry = NodePath("RunningView/MarginContainer/VBoxContainer/RunningGameEntry")

[node name="LobbyView" type="VBoxContainer" parent="Menus/LobbyMenu"]
visible = false
layout_mode = 2

[node name="HBoxContainer2" type="HBoxContainer" parent="Menus/LobbyMenu/LobbyView"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 16

[node name="PanelContainer" type="PanelContainer" parent="Menus/LobbyMenu/LobbyView/HBoxContainer2"]
layout_mode = 2
Expand Down Expand Up @@ -437,3 +440,4 @@ fit_content = true

[node name="GameLibraryDisplay" parent="Menus/MainMenu" instance=ExtResource("11_gn2ub")]
layout_mode = 2
display_mode = true
17 changes: 17 additions & 0 deletions CogsPartyLauncher/scripts/crossout.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@tool
extends Control


func _draw():
var rect = self.get_rect()
var width = 4;
var radius = width / 2.0
var color = Color.WHITE
rect.position += Vector2.ONE * radius
rect.size -= 2 * Vector2.ONE * radius
draw_line(rect.position, rect.position + rect.size, color, width)
draw_line(rect.position + Vector2(rect.size.x, 0), rect.position + Vector2(0, rect.size.y), color, width)
draw_circle(rect.position, radius, color)
draw_circle(rect.position + Vector2(rect.size.x, 0), radius, color)
draw_circle(rect.position + Vector2(0, rect.size.y), radius, color)
draw_circle(rect.position + rect.size, radius, color)
3 changes: 3 additions & 0 deletions CogsPartyLauncher/scripts/game_entry.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ signal changed()
@export var content_container: Control
@export var enabled_checkbox: CheckBox
@export var player_count_label: Label
@export var crossout: Control


const SUPPORTED_BUILDS = [
Expand Down Expand Up @@ -106,6 +107,8 @@ func _update_ui():
else:
error_panel.visible = false

crossout.visible = not allowed
crossout.queue_redraw()
if not allowed:
content_container.modulate = Color("#b4b4b4")
enabled_checkbox.disabled = true
Expand Down
4 changes: 2 additions & 2 deletions CogsPartyLauncher/scripts/game_library.gd
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ func get_playable_games(player_count: int = save_data.players.size()) -> Array[D
return playable_games


func get_enabled_playable_games() -> Array[Dictionary]:
func get_enabled_playable_games(player_count: int = save_data.players.size()) -> Array[Dictionary]:
var playable_games: Array[Dictionary] = []
for game in get_playable_games():
for game in get_playable_games(player_count):
if game.enabled:
playable_games.append(game)
return playable_games
Expand Down
10 changes: 9 additions & 1 deletion CogsPartyLauncher/scripts/game_library_display.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ extends VBoxContainer
class_name GameLibraryDisplay


signal changed()


@export var game_entry_prefab: PackedScene
@export var game_entry_container: VBoxContainer
@export var games_label: Label
Expand All @@ -23,7 +26,7 @@ func update(_games: Array[Dictionary], _allowed_games = null,):
for entry in _games:
var inst = game_entry_prefab.instantiate() as GameEntry
game_entry_container.add_child(inst)
inst.changed.connect(_update_games_label)
inst.changed.connect(_on_entry_changed)
inst.construct(entry)
if allowed_games != null and not entry in allowed_games:
inst.allowed = false
Expand Down Expand Up @@ -75,3 +78,8 @@ func _update_games_label():
games_label.text = "G A M E S ( %d / %d )" % [allowed_and_enabled_game_count, allowed_game_count]
else:
games_label.text = "G A M E S ( %d )" % allowed_and_enabled_game_count


func _on_entry_changed():
_update_games_label()
changed.emit()
Loading

0 comments on commit 04863e3

Please sign in to comment.