diff --git a/src/assets/img/stages/S2_Stage_Ancho-V_Games.png b/src/assets/img/stages/S2_Stage_Ancho-V_Games.png deleted file mode 100755 index 912a676..0000000 Binary files a/src/assets/img/stages/S2_Stage_Ancho-V_Games.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Arowana_Mall.png b/src/assets/img/stages/S2_Stage_Arowana_Mall.png deleted file mode 100755 index 6ac5773..0000000 Binary files a/src/assets/img/stages/S2_Stage_Arowana_Mall.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Blackbelly_Skatepark.png b/src/assets/img/stages/S2_Stage_Blackbelly_Skatepark.png deleted file mode 100755 index 1c2a926..0000000 Binary files a/src/assets/img/stages/S2_Stage_Blackbelly_Skatepark.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Camp_Triggerfish.png b/src/assets/img/stages/S2_Stage_Camp_Triggerfish.png deleted file mode 100755 index e2bd3bf..0000000 Binary files a/src/assets/img/stages/S2_Stage_Camp_Triggerfish.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Goby_Arena.png b/src/assets/img/stages/S2_Stage_Goby_Arena.png deleted file mode 100755 index ee17569..0000000 Binary files a/src/assets/img/stages/S2_Stage_Goby_Arena.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Humpback_Pump_Track.png b/src/assets/img/stages/S2_Stage_Humpback_Pump_Track.png deleted file mode 100755 index 49ca7d8..0000000 Binary files a/src/assets/img/stages/S2_Stage_Humpback_Pump_Track.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Inkblot_Art_Academy.png b/src/assets/img/stages/S2_Stage_Inkblot_Art_Academy.png deleted file mode 100755 index 5afb8f1..0000000 Binary files a/src/assets/img/stages/S2_Stage_Inkblot_Art_Academy.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Kelp_Dome.png b/src/assets/img/stages/S2_Stage_Kelp_Dome.png deleted file mode 100755 index 8437e97..0000000 Binary files a/src/assets/img/stages/S2_Stage_Kelp_Dome.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_MakoMart.png b/src/assets/img/stages/S2_Stage_MakoMart.png deleted file mode 100755 index a13e813..0000000 Binary files a/src/assets/img/stages/S2_Stage_MakoMart.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Manta_Maria.png b/src/assets/img/stages/S2_Stage_Manta_Maria.png deleted file mode 100755 index 39ae807..0000000 Binary files a/src/assets/img/stages/S2_Stage_Manta_Maria.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Moray_Towers.png b/src/assets/img/stages/S2_Stage_Moray_Towers.png deleted file mode 100755 index 871e245..0000000 Binary files a/src/assets/img/stages/S2_Stage_Moray_Towers.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Musselforge_Fitness.png b/src/assets/img/stages/S2_Stage_Musselforge_Fitness.png deleted file mode 100755 index caa1cd4..0000000 Binary files a/src/assets/img/stages/S2_Stage_Musselforge_Fitness.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_New_Albacore_Hotel.png b/src/assets/img/stages/S2_Stage_New_Albacore_Hotel.png deleted file mode 100755 index 75f958e..0000000 Binary files a/src/assets/img/stages/S2_Stage_New_Albacore_Hotel.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Piranha_Pit.png b/src/assets/img/stages/S2_Stage_Piranha_Pit.png deleted file mode 100755 index 669fd05..0000000 Binary files a/src/assets/img/stages/S2_Stage_Piranha_Pit.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Port_Mackerel.png b/src/assets/img/stages/S2_Stage_Port_Mackerel.png deleted file mode 100755 index ceeb29a..0000000 Binary files a/src/assets/img/stages/S2_Stage_Port_Mackerel.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Shellendorf_Institute.png b/src/assets/img/stages/S2_Stage_Shellendorf_Institute.png deleted file mode 100755 index 2dd86c8..0000000 Binary files a/src/assets/img/stages/S2_Stage_Shellendorf_Institute.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Shifty_Station.png b/src/assets/img/stages/S2_Stage_Shifty_Station.png deleted file mode 100755 index b597dab..0000000 Binary files a/src/assets/img/stages/S2_Stage_Shifty_Station.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Skipper_Pavilion.png b/src/assets/img/stages/S2_Stage_Skipper_Pavilion.png deleted file mode 100755 index 4f108ec..0000000 Binary files a/src/assets/img/stages/S2_Stage_Skipper_Pavilion.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Snapper_Canal.png b/src/assets/img/stages/S2_Stage_Snapper_Canal.png deleted file mode 100755 index 892a685..0000000 Binary files a/src/assets/img/stages/S2_Stage_Snapper_Canal.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Starfish_Mainstage.png b/src/assets/img/stages/S2_Stage_Starfish_Mainstage.png deleted file mode 100755 index 7352fd0..0000000 Binary files a/src/assets/img/stages/S2_Stage_Starfish_Mainstage.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Sturgeon_Shipyard.png b/src/assets/img/stages/S2_Stage_Sturgeon_Shipyard.png deleted file mode 100755 index 11c76ca..0000000 Binary files a/src/assets/img/stages/S2_Stage_Sturgeon_Shipyard.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_The_Reef.png b/src/assets/img/stages/S2_Stage_The_Reef.png deleted file mode 100755 index 1a34fdf..0000000 Binary files a/src/assets/img/stages/S2_Stage_The_Reef.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Wahoo_World.png b/src/assets/img/stages/S2_Stage_Wahoo_World.png deleted file mode 100755 index 9db6f96..0000000 Binary files a/src/assets/img/stages/S2_Stage_Wahoo_World.png and /dev/null differ diff --git a/src/assets/img/stages/S2_Stage_Walleye_Warehouse.png b/src/assets/img/stages/S2_Stage_Walleye_Warehouse.png deleted file mode 100755 index bdced8d..0000000 Binary files a/src/assets/img/stages/S2_Stage_Walleye_Warehouse.png and /dev/null differ diff --git a/src/assets/img/stages/S3HagglefishMarketIcon.png b/src/assets/img/stages/S3HagglefishMarketIcon.png deleted file mode 100644 index 344e36d..0000000 Binary files a/src/assets/img/stages/S3HagglefishMarketIcon.png and /dev/null differ diff --git a/src/assets/img/stages/S3HammerheadBridgeIcon.png b/src/assets/img/stages/S3HammerheadBridgeIcon.png deleted file mode 100644 index b484d33..0000000 Binary files a/src/assets/img/stages/S3HammerheadBridgeIcon.png and /dev/null differ diff --git a/src/assets/img/stages/S3MahiMahiResortIcon.png b/src/assets/img/stages/S3MahiMahiResortIcon.png deleted file mode 100644 index 25d41a9..0000000 Binary files a/src/assets/img/stages/S3MahiMahiResortIcon.png and /dev/null differ diff --git a/src/assets/img/stages/S3MincemeatMetalworksIcon.png b/src/assets/img/stages/S3MincemeatMetalworksIcon.png deleted file mode 100644 index 973e01e..0000000 Binary files a/src/assets/img/stages/S3MincemeatMetalworksIcon.png and /dev/null differ diff --git a/src/assets/img/stages/S3UndertowSpillwayIcon.png b/src/assets/img/stages/S3UndertowSpillwayIcon.png deleted file mode 100644 index c983a0a..0000000 Binary files a/src/assets/img/stages/S3UndertowSpillwayIcon.png and /dev/null differ diff --git a/src/assets/img/stages/S3_Brinewater_Springs.png b/src/assets/img/stages/S3_Brinewater_Springs.png deleted file mode 100644 index a458b0d..0000000 Binary files a/src/assets/img/stages/S3_Brinewater_Springs.png and /dev/null differ diff --git a/src/assets/img/stages/S3_Eeltail_Alley.png b/src/assets/img/stages/S3_Eeltail_Alley.png deleted file mode 100644 index 2f566b3..0000000 Binary files a/src/assets/img/stages/S3_Eeltail_Alley.png and /dev/null differ diff --git a/src/assets/img/stages/S3_Scorch_Gorge.png b/src/assets/img/stages/S3_Scorch_Gorge.png deleted file mode 100644 index 182ee04..0000000 Binary files a/src/assets/img/stages/S3_Scorch_Gorge.png and /dev/null differ diff --git a/src/assets/img/stages/S3_Stage_Flounder_Heights.png b/src/assets/img/stages/S3_Stage_Flounder_Heights.png deleted file mode 100644 index 17eb203..0000000 Binary files a/src/assets/img/stages/S3_Stage_Flounder_Heights.png and /dev/null differ diff --git a/src/assets/img/stages/S3_Stage_Museum_d_Alfonsino.png b/src/assets/img/stages/S3_Stage_Museum_d_Alfonsino.png deleted file mode 100644 index ed09af5..0000000 Binary files a/src/assets/img/stages/S3_Stage_Museum_d_Alfonsino.png and /dev/null differ diff --git a/src/graphics/helpers/imageHelper.ts b/src/graphics/helpers/imageHelper.ts index e6373a1..1578e87 100644 --- a/src/graphics/helpers/imageHelper.ts +++ b/src/graphics/helpers/imageHelper.ts @@ -1,5 +1,4 @@ import { isBlank } from '../../shared/helpers/stringHelper'; -import { mapNameToImagePath } from '../../shared/constants'; export async function loadAndCheckIfImageExists(src: string): Promise { return new Promise(resolve => { @@ -18,5 +17,3 @@ export async function loadAndCheckIfImageExists(src: string): Promise { }; }); } - -export const getStageImagePath = (stage: string): string => mapNameToImagePath[stage]; diff --git a/src/graphics/pages/stageDisplay/StageDisplay.vue b/src/graphics/pages/stageDisplay/StageDisplay.vue index fe0edc5..e89629e 100644 --- a/src/graphics/pages/stageDisplay/StageDisplay.vue +++ b/src/graphics/pages/stageDisplay/StageDisplay.vue @@ -71,10 +71,11 @@ import { defineComponent } from '@vue/runtime-core'; import { computed, onMounted } from 'vue'; import OpacitySwapTransition from '../../components/OpacitySwapTransition.vue'; import gsap from 'gsap'; -import { getStageImagePath, loadAndCheckIfImageExists } from '../../helpers/imageHelper'; +import { loadAndCheckIfImageExists } from '../../helpers/imageHelper'; import { addDots } from '../../../shared/helpers/stringHelper'; import { bindEntranceToTimelineGenerator } from '../../helpers/obsSourceHelper'; import { useActiveRoundStore } from '../../../shared/store/activeRoundStore'; +import { useAssetPathStore } from '../../../shared/store/assetPathStore'; const STAGE_SHOW_HIDE_ANIMATION_DURATION = 0.35; @@ -85,6 +86,7 @@ export default defineComponent({ setup() { const activeRoundStore = useActiveRoundStore(); + const assetPathStore = useAssetPathStore(); const games = computed(() => activeRoundStore.activeRound.games); onMounted(() => { @@ -142,10 +144,10 @@ export default defineComponent({ } })), matchId: computed(() => activeRoundStore.activeRound.match.id), - getStageImagePath, + getStageImagePath: assetPathStore.getStageImagePath, async stageEnter(elem: HTMLElement, done: gsap.Callback) { - await loadAndCheckIfImageExists(getStageImagePath(elem.dataset.stage)); + await loadAndCheckIfImageExists(assetPathStore.getStageImagePath(elem.dataset.stage)); stageEnter(elem, done); }, stageWrapperEnter(elem: HTMLElement, done: gsap.Callback) { diff --git a/src/graphics/stageDisplay.ts b/src/graphics/stageDisplay.ts index 3b9dac9..698c322 100644 --- a/src/graphics/stageDisplay.ts +++ b/src/graphics/stageDisplay.ts @@ -5,11 +5,13 @@ import StageDisplay from './pages/stageDisplay/StageDisplay.vue'; import { installCommonHelpers } from './helpers/installCommonHelpers'; import { createPinia } from 'pinia'; import { initActiveRoundStore } from '../shared/store/activeRoundStore'; +import { initAssetPathStore } from '../shared/store/assetPathStore'; (async () => { const app = createApp(StageDisplay); installCommonHelpers(app); app.use(createPinia()); await initActiveRoundStore(); + await initAssetPathStore(); app.mount('#app'); })(); diff --git a/src/shared/constants.ts b/src/shared/constants.ts index 2e1e8d2..3ad369a 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -1,77 +1 @@ -import ImgAncho from 'img/stages/S2_Stage_Ancho-V_Games.png'; -import ImgArowana from 'img/stages/S2_Stage_Arowana_Mall.png'; -import ImgBlackbelly from 'img/stages/S2_Stage_Blackbelly_Skatepark.png'; -import ImgCamp from 'img/stages/S2_Stage_Camp_Triggerfish.png'; -import ImgGoby from 'img/stages/S2_Stage_Goby_Arena.png'; -import ImgHumpback from 'img/stages/S2_Stage_Humpback_Pump_Track.png'; -import ImgInkblot from 'img/stages/S2_Stage_Inkblot_Art_Academy.png'; -import ImgKelp from 'img/stages/S2_Stage_Kelp_Dome.png'; -import ImgMakoMart from 'img/stages/S2_Stage_MakoMart.png'; -import ImgManta from 'img/stages/S2_Stage_Manta_Maria.png'; -import ImgMoray from 'img/stages/S2_Stage_Moray_Towers.png'; -import ImgMusselforge from 'img/stages/S2_Stage_Musselforge_Fitness.png'; -import ImgNew from 'img/stages/S2_Stage_New_Albacore_Hotel.png'; -import ImgPiranha from 'img/stages/S2_Stage_Piranha_Pit.png'; -import ImgPort from 'img/stages/S2_Stage_Port_Mackerel.png'; -import ImgShellendorf from 'img/stages/S2_Stage_Shellendorf_Institute.png'; -import ImgShifty from 'img/stages/S2_Stage_Shifty_Station.png'; -import ImgSnapper from 'img/stages/S2_Stage_Snapper_Canal.png'; -import ImgStarfish from 'img/stages/S2_Stage_Starfish_Mainstage.png'; -import ImgSturgeon from 'img/stages/S2_Stage_Sturgeon_Shipyard.png'; -import ImgThe from 'img/stages/S2_Stage_The_Reef.png'; -import ImgWahoo from 'img/stages/S2_Stage_Wahoo_World.png'; -import ImgWalleye from 'img/stages/S2_Stage_Walleye_Warehouse.png'; -import ImgSkipper from 'img/stages/S2_Stage_Skipper_Pavilion.png'; -import ImgUnknown from 'img/stages/unknown-stage.png'; -import ImgMuseum from 'img/stages/S3_Stage_Museum_d_Alfonsino.png'; -import ImgScorch from 'img/stages/S3_Scorch_Gorge.png'; -import ImgEeltail from 'img/stages/S3_Eeltail_Alley.png'; -import ImgHagglefish from 'img/stages/S3HagglefishMarketIcon.png'; -import ImgUndertow from 'img/stages/S3UndertowSpillwayIcon.png'; -import ImgMincemeat from 'img/stages/S3MincemeatMetalworksIcon.png'; -import ImgHammerhead from 'img/stages/S3HammerheadBridgeIcon.png'; -import ImgMahi from 'img/stages/S3MahiMahiResortIcon.png'; -import ImgFlounder from 'img/stages/S3_Stage_Flounder_Heights.png'; -import ImgBrinewater from 'img/stages/S3_Brinewater_Springs.png'; - export const DASHBOARD_BUNDLE_NAME = 'ipl-overlay-controls'; - -export const mapNameToImagePath: Record = { - 'Ancho-V Games': ImgAncho, - 'Arowana Mall': ImgArowana, - 'Blackbelly Skatepark': ImgBlackbelly, - 'Camp Triggerfish': ImgCamp, - 'Goby Arena': ImgGoby, - 'Humpback Pump Track': ImgHumpback, - 'Inkblot Art Academy': ImgInkblot, - 'Kelp Dome': ImgKelp, - MakoMart: ImgMakoMart, - 'Manta Maria': ImgManta, - 'Moray Towers': ImgMoray, - 'Musselforge Fitness': ImgMusselforge, - 'New Albacore Hotel': ImgNew, - 'Piranha Pit': ImgPiranha, - 'Port Mackerel': ImgPort, - 'Shellendorf Institute': ImgShellendorf, - 'Shifty Station': ImgShifty, - 'Snapper Canal': ImgSnapper, - 'Starfish Mainstage': ImgStarfish, - 'Sturgeon Shipyard': ImgSturgeon, - 'The Reef': ImgThe, - 'Wahoo World': ImgWahoo, - 'Walleye Warehouse': ImgWalleye, - 'Skipper Pavilion': ImgSkipper, - 'Museum d\'Alfonsino': ImgMuseum, - 'Scorch Gorge': ImgScorch, - 'Eeltail Alley': ImgEeltail, - 'Hagglefish Market': ImgHagglefish, - 'Undertow Spillway': ImgUndertow, - 'Mincemeat Metalworks': ImgMincemeat, - 'Hammerhead Bridge': ImgHammerhead, - 'Mahi-Mahi Resort': ImgMahi, - 'Flounder Heights': ImgFlounder, - 'Brinewater Springs': ImgBrinewater, - 'Unknown Stage': ImgUnknown, - Counterpick: ImgUnknown -}; - diff --git a/src/shared/store/assetPathStore.ts b/src/shared/store/assetPathStore.ts new file mode 100644 index 0000000..5f8f334 --- /dev/null +++ b/src/shared/store/assetPathStore.ts @@ -0,0 +1,23 @@ +import { AssetPaths } from 'schemas'; +import { defineStore } from 'pinia'; +import { DASHBOARD_BUNDLE_NAME } from '../constants'; +import { createReplicantStoreInitializer } from './storeHelper'; +import ImgUnknown from 'img/stages/unknown-stage.png'; + +const assetPaths = nodecg.Replicant('assetPaths', DASHBOARD_BUNDLE_NAME); + +interface AssetPathStore { + assetPaths: AssetPaths; +} + +export const useAssetPathStore = defineStore('assetPaths', { + state: (): AssetPathStore => ({ + assetPaths: null + }), + getters: { + getStageImagePath: state => + (stageName: string) => state.assetPaths.stageImages[stageName] ?? ImgUnknown + } +}); + +export const initAssetPathStore = createReplicantStoreInitializer([assetPaths], useAssetPathStore);