From 365bd884888e5aafa52cc1ff8631be7760a484d1 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 22 Mar 2025 19:25:19 +0000 Subject: [PATCH 01/14] Creating scene and hex grid layout for sponsor edit scene. This will allow me to choose different arrangements of hexes for each sponsor map. Eventually. --- gdj/hexgrid/map/editor/HexMapGridEditor.gdj | 29 +++ gdj/hexgrid/map/editor/SponsorEditor.gdj | 25 ++ gdj/screens/MainMenu/MainMenu.gdj | 1 + .../kuiper/confirm_action/ConfirmAction.kt | 5 +- src/main/kuiper/hexgrid/Hex.kt | 14 +- src/main/kuiper/hexgrid/HexGrid.kt | 1 - .../hexgrid/map/editor/HexMapGridEditor.kt | 62 +++++ .../hexgrid/map/editor/SponsorEditor.kt | 20 ++ .../hexgrid/map/editor/hex_map_editor.tscn | 93 +++++++ src/main/kuiper/screens/mainMenu/MainMenu.kt | 239 +++++++++--------- .../kuiper/screens/mainMenu/main_menu.tscn | 5 + .../kuiper/technology/editor/tech_editor.tscn | 4 +- .../technology/editor/tech_web_editor.tscn | 4 +- 13 files changed, 370 insertions(+), 132 deletions(-) create mode 100644 gdj/hexgrid/map/editor/HexMapGridEditor.gdj create mode 100644 gdj/hexgrid/map/editor/SponsorEditor.gdj create mode 100644 src/main/kuiper/hexgrid/map/editor/HexMapGridEditor.kt create mode 100644 src/main/kuiper/hexgrid/map/editor/SponsorEditor.kt create mode 100644 src/main/kuiper/hexgrid/map/editor/hex_map_editor.tscn diff --git a/gdj/hexgrid/map/editor/HexMapGridEditor.gdj b/gdj/hexgrid/map/editor/HexMapGridEditor.gdj new file mode 100644 index 0000000..8dfbc9a --- /dev/null +++ b/gdj/hexgrid/map/editor/HexMapGridEditor.gdj @@ -0,0 +1,29 @@ +// THIS FILE IS GENERATED! DO NOT EDIT OR DELETE IT. EDIT OR DELETE THE ASSOCIATED SOURCE CODE FILE INSTEAD +// Note: You can however freely move this file inside your godot project if you want. Keep in mind however, that if you rename the originating source code file, this file will be deleted and regenerated as a new file instead of being updated! Other modifications to the source file however, will result in this file being updated. + +registeredName = HexMapGridEditor +fqName = hexgrid.map.editor.HexMapGridEditor +relativeSourcePath = src/main/kuiper/hexgrid/map/editor/HexMapGridEditor.kt +baseType = GridContainer +supertypes = [ + godot.api.GridContainer, + godot.api.Container, + godot.api.Control, + godot.api.CanvasItem, + godot.api.Node, + godot.api.Object, + godot.core.KtObject, + godot.common.interop.NativeWrapper, + godot.common.interop.NativePointer, + kotlin.Any +] +signals = [ + +] +properties = [ + +] +functions = [ + _ready, + _process +] \ No newline at end of file diff --git a/gdj/hexgrid/map/editor/SponsorEditor.gdj b/gdj/hexgrid/map/editor/SponsorEditor.gdj new file mode 100644 index 0000000..9f1dc6c --- /dev/null +++ b/gdj/hexgrid/map/editor/SponsorEditor.gdj @@ -0,0 +1,25 @@ +// THIS FILE IS GENERATED! DO NOT EDIT OR DELETE IT. EDIT OR DELETE THE ASSOCIATED SOURCE CODE FILE INSTEAD +// Note: You can however freely move this file inside your godot project if you want. Keep in mind however, that if you rename the originating source code file, this file will be deleted and regenerated as a new file instead of being updated! Other modifications to the source file however, will result in this file being updated. + +registeredName = SponsorEditor +fqName = hexgrid.map.editor.SponsorEditor +relativeSourcePath = src/main/kuiper/hexgrid/map/editor/SponsorEditor.kt +baseType = Node +supertypes = [ + godot.api.Node, + godot.api.Object, + godot.core.KtObject, + godot.common.interop.NativeWrapper, + godot.common.interop.NativePointer, + kotlin.Any +] +signals = [ + +] +properties = [ + +] +functions = [ + _ready, + _process +] \ No newline at end of file diff --git a/gdj/screens/MainMenu/MainMenu.gdj b/gdj/screens/MainMenu/MainMenu.gdj index 1bc140f..3878f4a 100644 --- a/gdj/screens/MainMenu/MainMenu.gdj +++ b/gdj/screens/MainMenu/MainMenu.gdj @@ -30,5 +30,6 @@ functions = [ _on_load_button_pressed, _on_load_file_selected, on_tech_tree_editor_pressed, + on_sponsor_editor_pressed, load_game ] \ No newline at end of file diff --git a/src/main/kuiper/confirm_action/ConfirmAction.kt b/src/main/kuiper/confirm_action/ConfirmAction.kt index 2e32f4e..1c58882 100644 --- a/src/main/kuiper/confirm_action/ConfirmAction.kt +++ b/src/main/kuiper/confirm_action/ConfirmAction.kt @@ -79,7 +79,7 @@ class ConfirmAction : Control(), LogInterface { signalBus.showActionConfirmation.connect { h, c -> hex = h card = c - location = h.location + location = h.location ?: Location("**Unknown**") updateUI() } } @@ -152,7 +152,7 @@ class ConfirmAction : Control(), LogInterface { } is Building.ScienceLab -> { - buildingSummary.appendText(" New ${building.name} at ${hex.location.name}") + buildingSummary.appendText(" New ${building.name} at ${hex.location?.name}") building.runningCosts.forEach { (resourceType, amount) -> costsPerTurnList.appendText( @@ -197,7 +197,6 @@ class ConfirmAction : Control(), LogInterface { hexToRender.location = location hexToRender.isConfirmationDialog = true hexToRender.hexUnlocked = true - hexToRender.sectors = location.sectors.toMutableList() hexToRender.setName("ConfirmHex${hex.id}") // hide the location label because I've got better one down below hexToRender.getNodeAs