aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-12-07 23:45:19 +0100
committer hop311 <hop3114@gmail.com>2023-12-11 10:51:01 +0100
commitfd375bdb35d8a7b2ac9cf3dd02cdb0f197451a0b (patch)
treeb22d464dbf8e0e2569b9be5aa130e4def2e51207 /game/src/Game
parenta6952efba078e49d6555b0586230986a2cb7ed40 (diff)
Big UI commit - GUINode, MaskedFlag, PieChart, etc
Diffstat (limited to 'game/src/Game')
-rw-r--r--game/src/Game/Autoload/Events.gd2
-rw-r--r--game/src/Game/Autoload/Events/Loader.gd6
-rw-r--r--game/src/Game/GameSession/GameSession.gd6
-rw-r--r--game/src/Game/GameSession/GameSession.tscn15
-rw-r--r--game/src/Game/GameSession/GameSpeedPanel.gd43
-rw-r--r--game/src/Game/GameSession/GameSpeedPanel.tscn67
-rw-r--r--game/src/Game/GameSession/ProvinceOverviewPanel.gd237
-rw-r--r--game/src/Game/GameSession/Topbar.gd84
-rw-r--r--game/src/Game/LoadingScreen.gd6
9 files changed, 265 insertions, 201 deletions
diff --git a/game/src/Game/Autoload/Events.gd b/game/src/Game/Autoload/Events.gd
index da12bf6..da29adb 100644
--- a/game/src/Game/Autoload/Events.gd
+++ b/game/src/Game/Autoload/Events.gd
@@ -3,9 +3,7 @@
## It does such by providing a global interface of signals that are connected to and emitted by that are garunteed to exist.
extends Node
-var Loader: LoaderEventsObject
var Options: OptionsEventsObject
func _init():
- Loader = LoaderEventsObject.new()
Options = OptionsEventsObject.new()
diff --git a/game/src/Game/Autoload/Events/Loader.gd b/game/src/Game/Autoload/Events/Loader.gd
deleted file mode 100644
index c17dc6f..0000000
--- a/game/src/Game/Autoload/Events/Loader.gd
+++ /dev/null
@@ -1,6 +0,0 @@
-class_name LoaderEventsObject
-extends RefCounted
-
-signal startup_load_begun()
-signal startup_load_changed(percentage : float)
-signal startup_load_ended()
diff --git a/game/src/Game/GameSession/GameSession.gd b/game/src/Game/GameSession/GameSession.gd
index afff820..2a27e3d 100644
--- a/game/src/Game/GameSession/GameSession.gd
+++ b/game/src/Game/GameSession/GameSession.gd
@@ -7,12 +7,6 @@ func _ready():
if GameSingleton.setup_game() != OK:
push_error("Failed to setup game")
- # Temporarily here for cosmetic reasons, will be moved to its
- # own child node later, similar to ProvinceOverviewPanel
- add_child(GameSingleton.generate_gui("topbar.gui", "topbar"))
- $topbar/topbar_outlinerbutton_bg.visible = false
- $topbar/topbar_outlinerbutton.visible = false
-
func _process(_delta : float):
GameSingleton.try_tick()
diff --git a/game/src/Game/GameSession/GameSession.tscn b/game/src/Game/GameSession/GameSession.tscn
index 755139e..2dd0e16 100644
--- a/game/src/Game/GameSession/GameSession.tscn
+++ b/game/src/Game/GameSession/GameSession.tscn
@@ -4,10 +4,10 @@
[ext_resource type="PackedScene" uid="uid://cvl76duuym1wq" path="res://src/Game/MusicConductor/MusicPlayer.tscn" id="2_kt6aa"]
[ext_resource type="PackedScene" uid="uid://g524p8lr574w" path="res://src/Game/GameSession/MapControlPanel/MapControlPanel.tscn" id="3_afh6d"]
[ext_resource type="PackedScene" uid="uid://dvdynl6eir40o" path="res://src/Game/GameSession/GameSessionMenu.tscn" id="3_bvmqh"]
+[ext_resource type="Script" path="res://src/Game/GameSession/Topbar.gd" id="4_2kbih"]
[ext_resource type="PackedScene" uid="uid://dkehmdnuxih2r" path="res://src/Game/GameSession/MapView.tscn" id="4_xkg5j"]
[ext_resource type="Script" path="res://src/Game/GameSession/ProvinceOverviewPanel.gd" id="5_lfv8l"]
[ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/Game/Menu/OptionMenu/OptionsMenu.tscn" id="6_p5mnx"]
-[ext_resource type="PackedScene" uid="uid://dd8k3p7r3huwc" path="res://src/Game/GameSession/GameSpeedPanel.tscn" id="7_myy4q"]
[ext_resource type="PackedScene" uid="uid://d3g6wbvwflmyk" path="res://src/Game/Menu/SaveLoadMenu/SaveLoadMenu.tscn" id="8_4g7ko"]
[node name="GameSession" type="Control" node_paths=PackedStringArray("_game_session_menu")]
@@ -24,7 +24,7 @@ _game_session_menu = NodePath("GameSessionMenu")
[node name="MapView" parent="." instance=ExtResource("4_xkg5j")]
-[node name="ProvinceOverviewPanel" type="Control" parent="."]
+[node name="ProvinceOverviewPanel" type="GUINode" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@@ -34,6 +34,12 @@ grow_vertical = 2
mouse_filter = 1
script = ExtResource("5_lfv8l")
+[node name="Topbar" type="GUINode" parent="."]
+layout_mode = 0
+offset_right = 40.0
+offset_bottom = 40.0
+script = ExtResource("4_2kbih")
+
[node name="MapControlPanel" parent="." instance=ExtResource("3_afh6d")]
layout_mode = 1
anchors_preset = 3
@@ -44,11 +50,6 @@ anchor_bottom = 1.0
grow_horizontal = 0
grow_vertical = 0
-[node name="GameSpeedPanel" parent="." instance=ExtResource("7_myy4q")]
-layout_mode = 0
-offset_right = 302.0
-offset_bottom = 31.0
-
[node name="GameSessionMenu" parent="." instance=ExtResource("3_bvmqh")]
visible = false
layout_mode = 1
diff --git a/game/src/Game/GameSession/GameSpeedPanel.gd b/game/src/Game/GameSession/GameSpeedPanel.gd
deleted file mode 100644
index 6a4b4de..0000000
--- a/game/src/Game/GameSession/GameSpeedPanel.gd
+++ /dev/null
@@ -1,43 +0,0 @@
-extends PanelContainer
-
-# REQUIREMENTS:
-# * SS-37, SS-38, SS-39
-
-@export var _longform_date_button : Button
-@export var _play_pause_display_button : Button
-@export var _decrease_speed_button : Button
-@export var _increase_speed_button : Button
-
-func _ready():
- GameSingleton.state_updated.connect(_update_buttons)
- _update_buttons()
-
-func _update_buttons():
- _play_pause_display_button.text = "⏸ " if GameSingleton.is_paused() else "▶"
-
- _increase_speed_button.disabled = not GameSingleton.can_increase_speed()
- _decrease_speed_button.disabled = not GameSingleton.can_decrease_speed()
-
- _longform_date_button.text = GameSingleton.get_longform_date()
-
-# REQUIREMENTS:
-# * UIFUN-73
-func _on_decrease_speed_button_pressed():
- GameSingleton.decrease_speed()
- _update_buttons()
-
-# REQUIREMENTS:
-# * UIFUN-72
-func _on_increase_speed_button_pressed():
- GameSingleton.increase_speed()
- _update_buttons()
-
-# REQUIREMENTS:
-# * UIFUN-71
-func _on_play_pause_display_button_pressed():
- GameSingleton.toggle_paused()
- _update_buttons()
-
-func _on_longform_date_label_pressed():
- GameSingleton.toggle_paused()
- _update_buttons()
diff --git a/game/src/Game/GameSession/GameSpeedPanel.tscn b/game/src/Game/GameSession/GameSpeedPanel.tscn
deleted file mode 100644
index 5526427..0000000
--- a/game/src/Game/GameSession/GameSpeedPanel.tscn
+++ /dev/null
@@ -1,67 +0,0 @@
-[gd_scene load_steps=8 format=3 uid="uid://dd8k3p7r3huwc"]
-
-[ext_resource type="Script" path="res://src/Game/GameSession/GameSpeedPanel.gd" id="1_pfs8t"]
-
-[sub_resource type="InputEventAction" id="InputEventAction_3k1tl"]
-action = &"time_pause"
-
-[sub_resource type="Shortcut" id="Shortcut_cg5xm"]
-events = [SubResource("InputEventAction_3k1tl")]
-
-[sub_resource type="InputEventAction" id="InputEventAction_w2rkb"]
-action = &"time_speed_decrease"
-
-[sub_resource type="Shortcut" id="Shortcut_ocrfe"]
-events = [SubResource("InputEventAction_w2rkb")]
-
-[sub_resource type="InputEventAction" id="InputEventAction_7sdhp"]
-action = &"time_speed_increase"
-
-[sub_resource type="Shortcut" id="Shortcut_gwofc"]
-events = [SubResource("InputEventAction_7sdhp")]
-
-[node name="GameSpeedPanel" type="PanelContainer" node_paths=PackedStringArray("_longform_date_button", "_play_pause_display_button", "_decrease_speed_button", "_increase_speed_button")]
-script = ExtResource("1_pfs8t")
-_longform_date_button = NodePath("ButtonList/LongformDateButton")
-_play_pause_display_button = NodePath("ButtonList/PlayPauseDisplayButton")
-_decrease_speed_button = NodePath("ButtonList/DecreaseSpeedButton")
-_increase_speed_button = NodePath("ButtonList/IncreaseSpeedButton")
-
-[node name="ButtonList" type="HBoxContainer" parent="."]
-layout_mode = 2
-
-[node name="LongformDateButton" type="Button" parent="ButtonList"]
-editor_description = "UI-74"
-custom_minimum_size = Vector2(200, 0)
-layout_mode = 2
-focus_mode = 0
-text = "LONGFORM DATE"
-
-[node name="PlayPauseDisplayButton" type="Button" parent="ButtonList"]
-editor_description = "UI-75, UIFUN-90"
-custom_minimum_size = Vector2(30, 0)
-layout_mode = 2
-focus_mode = 0
-shortcut = SubResource("Shortcut_cg5xm")
-text = "⏸ "
-
-[node name="DecreaseSpeedButton" type="Button" parent="ButtonList"]
-editor_description = "UI-77"
-custom_minimum_size = Vector2(30, 0)
-layout_mode = 2
-focus_mode = 0
-shortcut = SubResource("Shortcut_ocrfe")
-text = "-"
-
-[node name="IncreaseSpeedButton" type="Button" parent="ButtonList"]
-editor_description = "UI-76"
-custom_minimum_size = Vector2(30, 0)
-layout_mode = 2
-focus_mode = 0
-shortcut = SubResource("Shortcut_gwofc")
-text = "+"
-
-[connection signal="pressed" from="ButtonList/LongformDateButton" to="." method="_on_longform_date_label_pressed"]
-[connection signal="pressed" from="ButtonList/PlayPauseDisplayButton" to="." method="_on_play_pause_display_button_pressed"]
-[connection signal="pressed" from="ButtonList/DecreaseSpeedButton" to="." method="_on_decrease_speed_button_pressed"]
-[connection signal="pressed" from="ButtonList/IncreaseSpeedButton" to="." method="_on_increase_speed_button_pressed"]
diff --git a/game/src/Game/GameSession/ProvinceOverviewPanel.gd b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
index 1292eb4..6c183fb 100644
--- a/game/src/Game/GameSession/ProvinceOverviewPanel.gd
+++ b/game/src/Game/GameSession/ProvinceOverviewPanel.gd
@@ -1,22 +1,54 @@
-extends Control
+extends GUINode
+# Header
var _province_name_label : Label
var _region_name_label : Label
+var _slave_status_icon : TextureRect
+var _colony_status_button : Button
+var _colony_status_button_texture : GFXIconTexture
+var _administrative_percentage_label : Label
+var _owner_percentage_label : Label
+var _terrain_type_texture : GFXIconTexture
var _life_rating_bar : TextureProgressBar
+var _controller_flag_texture : GFXMaskedFlagTexture
+# state and province modifiers
+
+# Statistics
+var _rgo_icon_texture : GFXIconTexture
+var _rgo_produced_label : Label
+var _rgo_income_label : Label
+# rgo employment progress bar (execpt it isn't a progress bar?)
+var _rgo_employment_population_label : Label
+var _rgo_employment_percentage_label : Label
+var _crime_name_label : Label
+var _crime_icon_texture : GFXIconTexture
+# crime fighting
var _total_population_label : Label
-var _rgo_icon_texture : AtlasTexture
+var _migration_label : Label
+var _population_growth_label : Label
+var _pop_types_piechart : GFXPieChartTexture
+var _pop_ideologies_piechart : GFXPieChartTexture
+var _pop_cultures_piechart : GFXPieChartTexture
+# supply_limit_label
+# cores
const _missing_suffix : String = "_MISSING"
const _province_info_province_key : StringName = &"province"
const _province_info_region_key : StringName = &"region"
+const _province_info_controller_key : StringName = &"controller"
const _province_info_life_rating_key : StringName = &"life_rating"
const _province_info_terrain_type_key : StringName = &"terrain_type"
+const _province_info_crime_name_key : StringName = &"crime_name"
+const _province_info_crime_icon_key : StringName = &"crime_icon"
const _province_info_total_population_key : StringName = &"total_population"
const _province_info_pop_types_key : StringName = &"pop_types"
const _province_info_pop_ideologies_key : StringName = &"pop_ideologies"
const _province_info_pop_cultures_key : StringName = &"pop_cultures"
-const _province_info_rgo_key : StringName = &"rgo"
+const _province_info_rgo_name_key : StringName = &"rgo_name"
+const _province_info_rgo_icon_key : StringName = &"rgo_icon"
+const _province_info_colony_status_key : StringName = &"colony_status"
+const _province_info_slave_status_key : StringName = &"slave_status"
const _province_info_buildings_key : StringName = &"buildings"
const _building_info_building_key : StringName = &"building"
@@ -36,67 +68,79 @@ var _selected_index : int:
_update_info()
var _province_info : Dictionary
-func _check_class(object : Object, klass : String, name : String) -> bool:
- if object.get_class() == klass:
- return true
- else:
- push_error("Invalid ", name, " class: ", object.get_class(), " (expected ", klass, ")")
- return false
-
-func _try_get_node(path : NodePath, klass : String) -> Node:
- var node : Node = get_node(path)
- if node != null:
- if _check_class(node, klass, path):
- return node
- else:
- push_error("Failed to get node: ", path, " (returned null)")
- return null
-
func _ready():
GameSingleton.province_selected.connect(_on_province_selected)
GameSingleton.state_updated.connect(_update_info)
- add_child(GameSingleton.generate_gui("province_interface.gui", "province_view"))
+ add_gui_element("province_interface.gui", "province_view")
- var close_button : Button = _try_get_node(^"./province_view/close_button", "Button")
- if close_button != null:
+ var close_button : Button = get_button_node(^"./province_view/close_button")
+ if close_button:
close_button.pressed.connect(_on_close_button_pressed)
- _region_name_label = _try_get_node(^"./province_view/province_view_header/state_name", "Label")
-
- _province_name_label = _try_get_node(^"./province_view/province_view_header/province_name", "Label")
-
- _life_rating_bar = _try_get_node(^"./province_view/province_view_header/liferating", "TextureProgressBar")
-
- var goods_icon : TextureRect = _try_get_node(^"./province_view/province_statistics/goods_type", "TextureRect")
- if goods_icon != null:
- var texture := goods_icon.texture
- if _check_class(texture, "GFXIconTexture", "good_texture"):
- _rgo_icon_texture = texture
-
-
- var rgo_population_label : Label = _try_get_node(^"./province_view/province_statistics/rgo_population", "Label")
- if rgo_population_label != null:
- rgo_population_label.text = "0"
-
- #^"./province_view/province_statistics/crime_icon"
-
- _total_population_label = _try_get_node(^"./province_view/province_statistics/total_population", "Label")
-
- #^"./province_view/province_statistics/growth"
- #^"./province_view/province_statistics/workforce_chart"
- #^"./province_view/province_statistics/ideology_chart"
- #^"./province_view/province_statistics/culture_chart"
-
- $province_view/province_view_header/occupation_progress.visible = false
- $province_view/province_view_header/occupation_icon.visible = false
- $province_view/province_view_header/occupation_flag.visible = false
- $province_view/province_colony.visible = false
- $province_view/province_other.visible = false
- $province_view/province_buildings/army_size.visible = false
- $province_view/province_buildings/army_text.visible = false
- $province_view/province_buildings/navy_text.visible = false
- $province_view/national_focus_window.visible = false
+ # Header
+ _province_name_label = get_label_node(^"./province_view/province_view_header/province_name")
+ _region_name_label = get_label_node(^"./province_view/province_view_header/state_name")
+ _slave_status_icon = get_texture_rect_node(^"./province_view/province_view_header/slave_state_icon")
+ var slave_status_icon_texture : GFXIconTexture = get_gfx_icon_texture_from_node(^"./province_view/province_view_header/slave_state_icon")
+ if slave_status_icon_texture:
+ slave_status_icon_texture.set_icon_index(GameSingleton.get_slave_pop_icon_index())
+ _colony_status_button = get_button_node(^"./province_view/province_view_header/colony_button")
+ _colony_status_button_texture = get_gfx_icon_texture_from_node(^"./province_view/province_view_header/colony_button")
+ var admin_icon_texture : GFXIconTexture = get_gfx_icon_texture_from_node(^"./province_view/province_view_header/admin_icon")
+ if admin_icon_texture:
+ admin_icon_texture.set_icon_index(GameSingleton.get_administrative_pop_icon_index())
+ _administrative_percentage_label = get_label_node(^"./province_view/province_view_header/admin_efficiency")
+ _owner_percentage_label = get_label_node(^"./province_view/province_view_header/owner_presence")
+ _terrain_type_texture = get_gfx_icon_texture_from_node(^"./province_view/province_view_header/prov_terrain")
+ _life_rating_bar = get_progress_bar_node(^"./province_view/province_view_header/liferating")
+ _controller_flag_texture = get_gfx_masked_flag_texture_from_node(^"./province_view/province_view_header/controller_flag")
+
+ # Statistics
+ _rgo_icon_texture = get_gfx_icon_texture_from_node(^"./province_view/province_statistics/goods_type")
+ _rgo_produced_label = get_label_node(^"./province_view/province_statistics/produced")
+ _rgo_income_label = get_label_node(^"./province_view/province_statistics/income")
+ _rgo_employment_population_label = get_label_node(^"./province_view/province_statistics/rgo_population")
+ _rgo_employment_percentage_label = get_label_node(^"./province_view/province_statistics/rgo_percent")
+ _crime_name_label = get_label_node(^"./province_view/province_statistics/crime_name")
+ _crime_icon_texture = get_gfx_icon_texture_from_node(^"./province_view/province_statistics/crime_icon")
+ _total_population_label = get_label_node(^"./province_view/province_statistics/total_population")
+ _migration_label = get_label_node(^"./province_view/province_statistics/migration")
+ _population_growth_label = get_label_node(^"./province_view/province_statistics/growth")
+ _pop_types_piechart = get_gfx_pie_chart_texture_from_node(^"./province_view/province_statistics/workforce_chart")
+ _pop_ideologies_piechart = get_gfx_pie_chart_texture_from_node(^"./province_view/province_statistics/ideology_chart")
+ _pop_cultures_piechart = get_gfx_pie_chart_texture_from_node(^"./province_view/province_statistics/culture_chart")
+
+ #^"./province_view/building"
+ #^"./province_view/province_core"
+ #^"./province_view/prov_state_modifier"
+
+ #add_gui_element("province_interface.gui", "building", "building0")
+ #var building0 : Panel = get_panel_node(^"./building0")
+ #building0.set_anchors_and_offsets_preset(Control.PRESET_BOTTOM_LEFT)
+ #building0.set_position(pop_cultures_piechart_icon.get_position())
+
+ # TODO - fix checkbox positions
+ for path in [
+ ^"./province_view/province_buildings/rallypoint_checkbox",
+ ^"./province_view/province_buildings/rallypoint_merge_checkbox",
+ ^"./province_view/province_buildings/rallypoint_checkbox_naval",
+ ^"./province_view/province_buildings/rallypoint_merge_checkbox_naval"
+ ]:
+ var rally_checkbox : CheckBox = get_check_box_node(path)
+ rally_checkbox.set_position(rally_checkbox.get_position() - Vector2(3, 3))
+
+ hide_nodes([
+ ^"./province_view/province_view_header/occupation_progress",
+ ^"./province_view/province_view_header/occupation_icon",
+ ^"./province_view/province_view_header/occupation_flag",
+ ^"./province_view/province_colony",
+ ^"./province_view/province_other",
+ ^"./province_view/province_buildings/army_size",
+ ^"./province_view/province_buildings/army_text",
+ ^"./province_view/province_buildings/navy_text",
+ ^"./province_view/national_focus_window",
+ ])
_update_info()
@@ -177,27 +221,92 @@ func _set_building_row(index : int, building : Dictionary) -> void:
row.button.disabled = expansion_state != CAN_EXPAND
row.button.visible = not show_progress_bar
"""
+
+enum { STATE, PROTECTORATE, COLONY }
func _update_info() -> void:
_province_info = GameSingleton.get_province_info_from_index(_selected_index)
if _province_info:
+ # Header
if _province_name_label:
_province_name_label.text = "PROV" + _province_info.get(_province_info_province_key,
_province_info_province_key + _missing_suffix)
+
if _region_name_label:
_region_name_label.text = _province_info.get(_province_info_region_key,
_province_info_region_key + _missing_suffix)
+
+ if _slave_status_icon:
+ _slave_status_icon.visible = _province_info.get(_province_info_slave_status_key, false)
+
+ var colony_status : int = _province_info.get(_province_info_colony_status_key, 0)
+ if _colony_status_button:
+ if colony_status == STATE:
+ _colony_status_button.hide()
+ else:
+ if _colony_status_button_texture:
+ _colony_status_button_texture.set_icon_index(colony_status)
+ _colony_status_button.show()
+
+ if _administrative_percentage_label:
+ pass
+
+ if _owner_percentage_label:
+ pass
+
+ if _terrain_type_texture:
+ var terrain_type : String = _province_info.get(_province_info_terrain_type_key, "")
+ if terrain_type:
+ const _terrain_type_prefix : String = "GFX_terrainimg_"
+ if _terrain_type_texture.set_gfx_texture_sprite_name(_terrain_type_prefix + terrain_type) != OK:
+ push_error("Failed to set terrain type texture: ", terrain_type)
+
if _life_rating_bar:
- _life_rating_bar.value = _province_info.get(_province_info_life_rating_key, 0) * 0
+ _life_rating_bar.value = _province_info.get(_province_info_life_rating_key, 0)
+
+ if _controller_flag_texture:
+ var controller : String = _province_info.get(_province_info_controller_key, "REB")
+ _controller_flag_texture.set_flag_country_name_and_type(controller, &"")
+
+ # Statistics
+ if _rgo_icon_texture:
+ _rgo_icon_texture.set_icon_index(_province_info.get(_province_info_rgo_icon_key, -1) + 2)
+
+ if _rgo_produced_label:
+ _rgo_produced_label.text = _province_info.get(_province_info_rgo_name_key, _province_info_rgo_name_key + _missing_suffix)
+
+ if _rgo_income_label:
+ _rgo_income_label.text = GameSingleton.float_to_formatted_string(12.34567)
+ # TODO - add £ sign
+
+ if _rgo_employment_population_label:
+ _rgo_employment_population_label.text = GameSingleton.int_to_formatted_string(_province_info.get(_province_info_total_population_key, 0) / 10)
+
+ if _rgo_employment_percentage_label:
+ pass
+
+ if _crime_name_label:
+ _crime_name_label.text = _province_info.get(_province_info_crime_name_key, "")
+
+ if _crime_icon_texture:
+ _crime_icon_texture.set_icon_index(_province_info.get(_province_info_crime_icon_key, 0) + 1)
if _total_population_label:
- _total_population_label.text = Localisation.tr_number(_province_info.get(_province_info_total_population_key, 0))
+ _total_population_label.text = GameSingleton.int_to_formatted_string(_province_info.get(_province_info_total_population_key, 0))
- #_pop_type_chart.set_to_distribution(_province_info.get(_province_info_pop_types_key, {}))
- #_pop_ideology_chart.set_to_distribution(_province_info.get(_province_info_pop_ideologies_key, {}))
- #_pop_culture_chart.set_to_distribution(_province_info.get(_province_info_pop_cultures_key, {}))
+ if _migration_label:
+ pass
- if _rgo_icon_texture:
- _rgo_icon_texture.set_icon_index((_selected_index % 40) + 1)
+ if _population_growth_label:
+ pass
+
+ if _pop_types_piechart:
+ _pop_types_piechart.set_slices(_province_info.get(_province_info_pop_types_key, []))
+
+ if _pop_ideologies_piechart:
+ _pop_ideologies_piechart.set_slices(_province_info.get(_province_info_pop_ideologies_key, []))
+
+ if _pop_cultures_piechart:
+ _pop_cultures_piechart.set_slices(_province_info.get(_province_info_pop_cultures_key, []))
#var buildings : Array = _province_info.get(_province_info_buildings_key, [])
#for i in max(buildings.size(), _building_rows.size()):
diff --git a/game/src/Game/GameSession/Topbar.gd b/game/src/Game/GameSession/Topbar.gd
new file mode 100644
index 0000000..6cc710f
--- /dev/null
+++ b/game/src/Game/GameSession/Topbar.gd
@@ -0,0 +1,84 @@
+extends GUINode
+
+var _speed_up_button : Button
+var _speed_down_button : Button
+var _speed_indicator_button : Button
+var _speed_indicator_texture : GFXIconTexture
+var _date_label : Label
+var _country_name_label : Label
+
+func _ready():
+ GameSingleton.state_updated.connect(_update_info)
+
+ add_gui_element("topbar.gui", "topbar")
+
+ hide_nodes([
+ ^"./topbar/topbar_outlinerbutton_bg",
+ ^"./topbar/topbar_outlinerbutton"
+ ])
+
+ const player_country : String = "SLV"
+
+ var player_flag_texture : GFXMaskedFlagTexture = get_gfx_masked_flag_texture_from_node(^"./topbar/player_flag")
+ if player_flag_texture:
+ player_flag_texture.set_flag_country_name_and_type(player_country, &"")
+
+ _speed_up_button = get_button_node(^"./topbar/button_speedup")
+ if _speed_up_button:
+ _speed_up_button.pressed.connect(_on_increase_speed_button_pressed)
+
+ _speed_down_button = get_button_node(^"./topbar/button_speeddown")
+ if _speed_down_button:
+ _speed_down_button.pressed.connect(_on_decrease_speed_button_pressed)
+
+ var pause_bg_button : Button = get_button_node(^"./topbar/pause_bg")
+ if pause_bg_button:
+ pause_bg_button.pressed.connect(_on_play_pause_button_pressed)
+
+ _date_label = get_label_node(^"./topbar/DateText")
+
+ _country_name_label = get_label_node(^"./topbar/CountryName")
+ if _country_name_label:
+ _country_name_label.text = player_country
+
+ _speed_indicator_button = get_button_node(^"./topbar/speed_indicator")
+ _speed_indicator_texture = get_gfx_icon_texture_from_node(^"./topbar/speed_indicator")
+
+func _update_info() -> void:
+ if _date_label:
+ _date_label.text = GameSingleton.get_longform_date()
+
+ # TODO - add disabled state textures so this doesn't hide the buttons
+ #if _speed_up_button:
+ # _speed_up_button.disabled = not GameSingleton.can_increase_speed()
+
+ #if _speed_down_button:
+ # _speed_down_button.disabled = not GameSingleton.can_decrease_speed()
+
+ if _speed_indicator_button and _speed_indicator_texture:
+ var index : int = 1
+ if not GameSingleton.is_paused():
+ index += GameSingleton.get_speed() + 1
+ _speed_indicator_texture.set_icon_index(index)
+ _speed_indicator_button.queue_redraw()
+
+# REQUIREMENTS:
+# * UIFUN-71
+func _on_play_pause_button_pressed():
+ print("Toggling pause!")
+ GameSingleton.toggle_paused()
+ _update_info()
+
+# REQUIREMENTS:
+# * UIFUN-72
+func _on_increase_speed_button_pressed():
+ print("Speed up!")
+ GameSingleton.increase_speed()
+ _update_info()
+
+# REQUIREMENTS:
+# * UIFUN-73
+func _on_decrease_speed_button_pressed():
+ print("Speed down!")
+ GameSingleton.decrease_speed()
+ _update_info()
diff --git a/game/src/Game/LoadingScreen.gd b/game/src/Game/LoadingScreen.gd
index c7dad9c..08cd2a8 100644
--- a/game/src/Game/LoadingScreen.gd
+++ b/game/src/Game/LoadingScreen.gd
@@ -21,7 +21,6 @@ func start_loading_screen(thread_safe_function : Callable) -> void:
thread.wait_to_finish()
thread.start(thread_safe_function)
- Events.Loader.startup_load_begun.emit()
func try_update_loading_screen(percent_complete: float, quote_should_change = false):
# forces the function to behave as if deferred
@@ -29,11 +28,6 @@ func try_update_loading_screen(percent_complete: float, quote_should_change = fa
progress_bar.value = percent_complete
if quote_should_change:
quote_label.text = quotes[randi() % quotes.size()]
- if is_equal_approx(percent_complete, 100):
- thread.wait_to_finish()
- Events.Loader.startup_load_ended.emit()
- else:
- Events.Loader.startup_load_changed.emit(percent_complete)
func _ready():
if Engine.is_editor_hint(): return