feat: engine utils, editor and asset prefix improvements
This commit is contained in:
@@ -4,6 +4,7 @@ import { SaveSystem } from '@engine/systems/SaveSystem'
|
||||
import type { GameData } from '@engine/types'
|
||||
import { useGameStore } from '@/stores/gameStore'
|
||||
import { useI18n } from '@/composables/useI18n'
|
||||
import { resolveAsset } from '@engine/utils'
|
||||
|
||||
export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVideoElement | null]) {
|
||||
const engine = new Engine()
|
||||
@@ -120,13 +121,6 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide
|
||||
store.setVideoTime(t)
|
||||
})
|
||||
|
||||
function resolveAsset(base: string, path: string): string {
|
||||
if (!path || path.startsWith('http://') || path.startsWith('https://') || path.startsWith('data:')) return path
|
||||
const b = base.endsWith('/') ? base.slice(0, -1) : base
|
||||
const p = path.startsWith('/') ? path : '/' + path
|
||||
return b + p
|
||||
}
|
||||
|
||||
function applyAssetBase(data: GameData) {
|
||||
const base = data.assetBase || ''
|
||||
if (!base) return
|
||||
|
||||
Reference in New Issue
Block a user