From bad4f2a95407aff94ec10348c58ea1601fe6c275 Mon Sep 17 00:00:00 2001 From: Metritutus <324345+Metritutus@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:23:30 +0100 Subject: [PATCH] * Updated player property in PlayerIcon component to be computed to fix icon shape not updating when the player was changed to one with a different shape. * Updated gameStarBulkUpgraded() method in store.js to fix newScience calculation incorrectly calculating the amount of new science. * Updated SvgWrapper component: - Replaced use of object element with render() function, reducing the level of hackery that was being utilised. This also helps to mitigate the SVG pop-in slightly on slow browsers. - Now caches SVG element text (fixes SVG pop-in on slow browsers for all but the very first load of the SVG data) * Updated StarIcon component: - Corrected typo in SvgWrapper component import. - Fixed wormhole and nebula icons not being displaying inline (which would result in text being pushed out of the way). * Updated tabs in Galaxy component to always show four tabs per row. * Added new global styles.css file. * Adjusted styling for blue info boxes to improve readability: - Font colour is now fully white instead of slighty translucent white. - Small font size is now increased from .875em to .925em. * Updated getFriendlyColour() method in gameHelper to also convert the returned colour to lower case (in case it needs to be matched against a colour in colours.json). * Updated ensureExists() in ColourOverrideDialog to fix colour value lookup check (fixes Use Default button not working for older games). * Updated getColourForPlayer() method in store.js to run the colour through GameHelper.getFriendlyColour() before returning it (fixes colour bars appearing black in older games). * Updated gamePlayerJoined() method in BroadcastService to set the avatar value to the avatar file name. This fixes player avatars not loading correctly when players joined games. * Fixed compare() method in gridHelper not actually sorting null values after everything else. --- client/src/assets/styles.css | 8 ++++ client/src/main.js | 1 + client/src/services/gameHelper.js | 2 +- client/src/services/gridHelper.js | 4 +- client/src/store.js | 14 ++++-- client/src/views/components/SvgWrapper.vue | 45 +++++++++++-------- .../views/game/components/galaxy/Galaxy.vue | 6 ++- .../game/components/galaxy/StarTypesTable.vue | 2 +- .../player/ColourOverrideDialog.vue | 2 +- .../game/components/player/PlayerIcon.vue | 6 +-- .../views/game/components/star/StarIcon.vue | 6 ++- server/services/broadcast.ts | 15 +++++-- server/services/index.ts | 2 +- 13 files changed, 76 insertions(+), 37 deletions(-) create mode 100644 client/src/assets/styles.css diff --git a/client/src/assets/styles.css b/client/src/assets/styles.css new file mode 100644 index 000000000..3bf56291d --- /dev/null +++ b/client/src/assets/styles.css @@ -0,0 +1,8 @@ +.bg-info { + color: white; + /*font-weight: 400;*/ +} + +.bg-info .small, .bg-info small { + font-size: .925em; +} \ No newline at end of file diff --git a/client/src/main.js b/client/src/main.js index 3f6af087c..9bfb29272 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -9,6 +9,7 @@ import $ from 'jquery' import 'pixi.js-legacy' import 'pixi-viewport' import '@pixi/graphics-extras'; +import "@/assets/styles.css"; // Note: This was done to get around an issue where the Steam client // had bootstrap as undefined. This also affects the UI template we're using, diff --git a/client/src/services/gameHelper.js b/client/src/services/gameHelper.js index f40ebd531..aa1c95c83 100644 --- a/client/src/services/gameHelper.js +++ b/client/src/services/gameHelper.js @@ -32,7 +32,7 @@ class GameHelper { } getFriendlyColour (colour) { - return colour.replace('0x', '#') + return colour.replace('0x', '#').toLowerCase(); } getStarByName (game, starName) { diff --git a/client/src/services/gridHelper.js b/client/src/services/gridHelper.js index 051c01615..01a6a437f 100644 --- a/client/src/services/gridHelper.js +++ b/client/src/services/gridHelper.js @@ -39,10 +39,10 @@ class GridHelper { } // Sort null values after everything else else if (a === null) { - return 1; + return -1; } else if (b === null) { - return -1; + return 1; } else { diff --git a/client/src/store.js b/client/src/store.js index af099233a..391fb03b1 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -275,7 +275,7 @@ export default new Vuex.Store({ let star = GameHelper.getStarById(state.game, s.starId); if (data.infrastructureType === 'science') { - newScience += s.infrastructure * (star.specialistId === 11 ? 2 : 1); // Research Station + newScience += (s.infrastructure - s.infrastructureCurrent) * (star.specialistId === 11 ? 2 : 1); // Research Station } star.infrastructure[data.infrastructureType] = s.infrastructure @@ -532,11 +532,19 @@ export default new Vuex.Store({ return state.cachedConversationComposeMessages[conversationId] || '' }, getColourForPlayer: (state) => (playerId) => { + let colour = null; + if (state.colourOverride) { - return state.colourMapping?.[playerId] || GameHelper.getPlayerById(state.game, playerId).colour; + colour = state.colourMapping?.[playerId] || GameHelper.getPlayerById(state.game, playerId).colour; } else { - return GameHelper.getPlayerById(state.game, playerId).colour + colour = GameHelper.getPlayerById(state.game, playerId).colour + } + + if (colour != null) { + colour.value = GameHelper.getFriendlyColour(colour.value); } + + return colour; } }, plugins: [vuexPersist.plugin] diff --git a/client/src/views/components/SvgWrapper.vue b/client/src/views/components/SvgWrapper.vue index 4cb6cd95d..c8096b189 100644 --- a/client/src/views/components/SvgWrapper.vue +++ b/client/src/views/components/SvgWrapper.vue @@ -1,33 +1,42 @@ - - - - diff --git a/client/src/views/game/components/galaxy/StarTypesTable.vue b/client/src/views/game/components/galaxy/StarTypesTable.vue index 5d1decb50..6937b66ba 100644 --- a/client/src/views/game/components/galaxy/StarTypesTable.vue +++ b/client/src/views/game/components/galaxy/StarTypesTable.vue @@ -41,7 +41,7 @@