Skip to content

Commit

Permalink
Reworked the remaining parts of the game results menu which were in L…
Browse files Browse the repository at this point in the history
…ua to be in QML
  • Loading branch information
Andrettin committed Jun 25, 2022
1 parent 8b676b7 commit 4d2c63f
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 94 deletions.
1 change: 0 additions & 1 deletion interface/Viewport.qml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ Item {
if (wyrmgus.game.results !== null) {
if (wyrmgus.game.results.victory || wyrmgus.game.results.defeat || wyrmgus.game.results.draw) {
menu_stack.push("menus/ResultsMenu.qml")
wyrmgus.call_lua_command("RunResultsMenu();")
}
}
map_view_underlay.destroy()
Expand Down
136 changes: 135 additions & 1 deletion interface/menus/ResultsMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,146 @@ MenuBase {
font.bold: true
}

LargeText {
id: units_label
anchors.right: buildings_label.left
anchors.rightMargin: 32 * wyrmgus.scale_factor
anchors.top: outcome_label.bottom
anchors.topMargin: 64 * wyrmgus.scale_factor
text: "Units"
}

LargeText {
id: buildings_label
anchors.right: copper_label.left
anchors.rightMargin: 32 * wyrmgus.scale_factor
anchors.top: units_label.top
text: "Buildings"
}

LargeText {
id: copper_label
anchors.right: lumber_label.left
anchors.rightMargin: 32 * wyrmgus.scale_factor
anchors.top: units_label.top
text: "Copper"
}

LargeText {
id: lumber_label
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: units_label.top
text: "Lumber"
}

LargeText {
id: stone_label
anchors.left: lumber_label.right
anchors.leftMargin: 32 * wyrmgus.scale_factor
anchors.top: units_label.top
text: "Stone"
}

LargeText {
id: kills_label
anchors.left: stone_label.right
anchors.leftMargin: 32 * wyrmgus.scale_factor
anchors.top: units_label.top
text: "Kills"
}

LargeText {
id: razings_label
anchors.left: kills_label.right
anchors.leftMargin: 32 * wyrmgus.scale_factor
anchors.top: units_label.top
text: "Razings"
}

ListView {
id: player_results_list
anchors.left: parent.left
anchors.right: parent.right
anchors.top: units_label.bottom
anchors.topMargin: 16 * wyrmgus.scale_factor
anchors.bottom: continue_button.top
anchors.bottomMargin: 16 * wyrmgus.scale_factor
leftMargin: 0
rightMargin: 0
topMargin: 0
bottomMargin: 0
boundsBehavior: Flickable.StopAtBounds
clip: true
spacing: 16 * wyrmgus.scale_factor
model: wyrmgus.game.results.player_results
delegate: Item {
height: player_units_label.height + 8 * wyrmgus.scale_factor + player_label.height

LargeText {
id: player_units_label
text: modelData.unit_count
x: units_label.x - player_results_list.contentItem.x + units_label.width / 2 - width / 2
anchors.top: parent.top
}

LargeText {
id: player_buildings_label
text: modelData.building_count
x: buildings_label.x - player_results_list.contentItem.x + buildings_label.width / 2 - width / 2
anchors.top: parent.top
}

LargeText {
id: player_copper_label
text: modelData.get_resource_count("copper")
x: copper_label.x - player_results_list.contentItem.x + copper_label.width / 2 - width / 2
anchors.top: parent.top
}

LargeText {
id: player_lumber_label
text: modelData.get_resource_count("lumber")
x: lumber_label.x - player_results_list.contentItem.x + lumber_label.width / 2 - width / 2
anchors.top: parent.top
}

LargeText {
id: player_stone_label
text: modelData.get_resource_count("stone")
x: stone_label.x - player_results_list.contentItem.x + stone_label.width / 2 - width / 2
anchors.top: parent.top
}

LargeText {
id: player_kills_label
text: modelData.kill_count
x: kills_label.x - player_results_list.contentItem.x + kills_label.width / 2 - width / 2
anchors.top: parent.top
}

LargeText {
id: player_razings_label
text: modelData.razing_count
x: razings_label.x - player_results_list.contentItem.x + razings_label.width / 2 - width / 2
anchors.top: parent.top
}

LargeText {
id: player_label
text: modelData.name + " - " + (modelData.this_player ? "You" : (modelData.ally ? "Ally" : (modelData.enemy ? "Enemy" : "Neutral")))
x: player_results_list.contentItem.width / 2 - width / 2
anchors.top: player_units_label.bottom
anchors.topMargin: 8 * wyrmgus.scale_factor
}
}
}

PreviousMenuButton {
id: continue_button
anchors.bottom: parent.bottom
anchors.bottomMargin: 8 * wyrmgus.scale_factor
text: "Continue"
hotkey: "c"
lua_command: "CleanPlayers(); results_menu:stop();"
lua_command: "CleanPlayers();"
}
}
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ https://github.com/Andrettin/Wyrmsun
* User Interface
- Reworked the multiplayer host and client game menus.
- Fixed issue which caused the screen to shake when mousewheel-scrolling to the edge of the map.
- Reworked the game results menu.

-----------------------------------------------------------------------
- 5.3.5
Expand Down
1 change: 0 additions & 1 deletion scripts/guichan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ Load("scripts/menus/options.lua")
Load("scripts/menus/editor.lua")
Load("scripts/menus/game.lua")
Load("scripts/menus/objectives.lua")
Load("scripts/menus/results.lua")
Load("scripts/menus/mods.lua")
Load("scripts/grand_strategy/grand_strategy.lua")

Expand Down
91 changes: 0 additions & 91 deletions scripts/menus/results.lua

This file was deleted.

0 comments on commit 4d2c63f

Please sign in to comment.