feat(showcase): skip wallpaper engin init
This commit is contained in:
@@ -41,7 +41,9 @@ export default class Settings {
|
||||
#doNotTrack = false
|
||||
#lastFunctionInsights = null
|
||||
|
||||
|
||||
constructor(el, logoEl) {
|
||||
this.isWallpaperEngine = false
|
||||
this.#el = el
|
||||
this.#logoEl = logoEl
|
||||
this.spinePlayer = null
|
||||
@@ -71,6 +73,7 @@ export default class Settings {
|
||||
}
|
||||
|
||||
insights(isWallpaperEngine, doNotTrack) {
|
||||
this.isWallpaperEngine = isWallpaperEngine
|
||||
if (this.#isInsightsInited || import.meta.env.MODE === 'development') return
|
||||
this.#isInsightsInited = true
|
||||
this.#doNotTrack = doNotTrack
|
||||
@@ -78,8 +81,8 @@ export default class Settings {
|
||||
window.umami?.trackView(`/${import.meta.env.VITE_LINK}${isWallpaperEngine ? "?steam" : ""}`);
|
||||
}
|
||||
|
||||
functionInsights(functionName) {
|
||||
if (!this.#isInsightsInited || this.#doNotTrack || import.meta.env.MODE === 'development' || functionName === this.#lastFunctionInsights) return
|
||||
functionInsights(functionName, toSkip = false) {
|
||||
if (!this.#isInsightsInited || this.#doNotTrack || import.meta.env.MODE === 'development' || functionName === this.#lastFunctionInsights || toSkip) return
|
||||
this.#lastFunctionInsights = functionName
|
||||
window.umami?.trackEvent(`${functionName}`);
|
||||
}
|
||||
@@ -87,12 +90,12 @@ export default class Settings {
|
||||
setFPS(value) {
|
||||
this.#fps = value
|
||||
this.spinePlayer.setFps(value)
|
||||
this.functionInsights("setFPS")
|
||||
this.functionInsights("setFPS", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
setLogoDisplay(flag) {
|
||||
this.#logoEl.hidden = flag;
|
||||
this.functionInsights("setLogoDisplay")
|
||||
this.functionInsights("setLogoDisplay", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
#resize(_this, value) {
|
||||
@@ -113,7 +116,7 @@ export default class Settings {
|
||||
this.#logoEl.src = src
|
||||
this.#resize()
|
||||
this.#setLogoInvertFilter(invert_filter)
|
||||
this.functionInsights("setLogo")
|
||||
this.functionInsights("setLogo", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
#readFile(e, onload, callback) {
|
||||
@@ -144,18 +147,18 @@ export default class Settings {
|
||||
setLogoRatio(value) {
|
||||
this.#ratio = value
|
||||
this.#resize(this, value)
|
||||
this.functionInsights("setLogoRatio")
|
||||
this.functionInsights("setLogoRatio", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
setLogoOpacity(value) {
|
||||
this.#logoEl.style.opacity = value / 100
|
||||
this.#opacity = value
|
||||
this.functionInsights("setLogoOpacity")
|
||||
this.functionInsights("setLogoOpacity", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
setBackgoundImage(v, skipInsights = false) {
|
||||
document.body.style.backgroundImage = v
|
||||
if (!skipInsights) this.functionInsights("setBackgoundImage");
|
||||
if (!skipInsights) this.functionInsights("setBackgoundImage", this.isWallpaperEngine);
|
||||
}
|
||||
|
||||
setDefaultBackground(e) {
|
||||
@@ -164,7 +167,7 @@ export default class Settings {
|
||||
this.setBackgoundImage(backgroundURL, true)
|
||||
}
|
||||
this.#defaultBackgroundImage = backgroundURL
|
||||
this.functionInsights("setDefaultBackground")
|
||||
this.functionInsights("setDefaultBackground", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
setBackground(e) {
|
||||
@@ -215,7 +218,7 @@ export default class Settings {
|
||||
break;
|
||||
}
|
||||
this.loadViewport()
|
||||
this.functionInsights("positionPadding")
|
||||
this.functionInsights("positionPadding", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
positionReset() {
|
||||
@@ -261,7 +264,7 @@ export default class Settings {
|
||||
break;
|
||||
}
|
||||
this.elementPosition(this.#logoEl, this.#logoX, this.#logoY)
|
||||
this.functionInsights("logoPadding")
|
||||
this.functionInsights("logoPadding", this.isWallpaperEngine)
|
||||
}
|
||||
|
||||
logoReset() {
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class Voice {
|
||||
set useSubtitle(show) {
|
||||
this.#useSubtitle = show
|
||||
this.#el.hidden = !show
|
||||
window.settings.functionInsights("useSubtitle")
|
||||
window.settings.functionInsights("useSubtitle", window.settings.isWallpaperEngine)
|
||||
}
|
||||
|
||||
get useSubtitle() {
|
||||
@@ -72,7 +72,7 @@ export default class Voice {
|
||||
* @param {boolean} show
|
||||
*/
|
||||
set useVoice(show) {
|
||||
window.settings.functionInsights("useVoice")
|
||||
window.settings.functionInsights("useVoice", window.settings.isWallpaperEngine)
|
||||
this.#useVoice = show
|
||||
this.#el.hidden = !show
|
||||
this.#playEntryVoice()
|
||||
@@ -91,7 +91,7 @@ export default class Voice {
|
||||
set useVoiceActor(show) {
|
||||
this.#useVoiceActor = show
|
||||
document.getElementById('voice_actor_box').hidden = !show
|
||||
window.settings.functionInsights("useVoiceActor")
|
||||
window.settings.functionInsights("useVoiceActor", window.settings.isWallpaperEngine)
|
||||
}
|
||||
|
||||
get useVoiceActor() {
|
||||
@@ -107,7 +107,7 @@ export default class Voice {
|
||||
} else {
|
||||
this.#subtitleLang = this.#defaultRegion
|
||||
}
|
||||
window.settings.functionInsights("subtitleLanguage")
|
||||
window.settings.functionInsights("subtitleLanguage", window.settings.isWallpaperEngine)
|
||||
}
|
||||
|
||||
get subtitleLanguage() {
|
||||
@@ -144,7 +144,7 @@ export default class Voice {
|
||||
|
||||
#updateSubtitlePosition() {
|
||||
window.settings.elementPosition(this.#el, this.#subtitleX, this.#subtitleY)
|
||||
window.settings.functionInsights("subtitlePosition")
|
||||
window.settings.functionInsights("subtitlePosition", window.settings.isWallpaperEngine)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ export default class Voice {
|
||||
} else {
|
||||
this.#voiceLang = this.#defaultVoiceLang
|
||||
}
|
||||
window.settings.functionInsights("language")
|
||||
window.settings.functionInsights("language", window.settings.isWallpaperEngine)
|
||||
const availableSubtitleLang = this.#getSubtitleLanguages()
|
||||
if (!availableSubtitleLang.includes(this.#subtitleLang)) {
|
||||
this.#subtitleLang = availableSubtitleLang[0]
|
||||
@@ -180,7 +180,7 @@ export default class Voice {
|
||||
this.#idleDuration = duration * 60 * 1000
|
||||
this.#initIdleVoiceTimer()
|
||||
}
|
||||
window.settings.functionInsights("idleDuration")
|
||||
window.settings.functionInsights("idleDuration", window.settings.isWallpaperEngine)
|
||||
}
|
||||
|
||||
get idleDuration() {
|
||||
@@ -196,7 +196,7 @@ export default class Voice {
|
||||
this.#nextDuration = duration * 60 * 1000
|
||||
this.#initNextVoiceTimer()
|
||||
}
|
||||
window.settings.functionInsights("nextDuration")
|
||||
window.settings.functionInsights("nextDuration", window.settings.isWallpaperEngine)
|
||||
}
|
||||
|
||||
get nextDuration() {
|
||||
|
||||
@@ -2,6 +2,7 @@ window.wallpaperPropertyListener = {
|
||||
applyGeneralProperties: function (properties) {
|
||||
if (properties.fps) {
|
||||
window.settings.setFPS(properties.fps)
|
||||
window.settings.functionInsights("setFPS", Object.keys(properties) !== 1)
|
||||
}
|
||||
},
|
||||
applyUserProperties: function (properties) {
|
||||
@@ -10,68 +11,86 @@ window.wallpaperPropertyListener = {
|
||||
}
|
||||
if (properties.logo) {
|
||||
window.settings.setLogoDisplay(!properties.logo.value)
|
||||
window.settings.functionInsights("setLogoDisplay", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.logoratio) {
|
||||
if (properties.logoratio.value) {
|
||||
window.settings.setLogoRatio(properties.logoratio.value)
|
||||
window.settings.functionInsights("setLogoRatio", Object.keys(properties) !== 1)
|
||||
}
|
||||
}
|
||||
if (properties.logoopacity) {
|
||||
if (properties.logoopacity.value) {
|
||||
window.settings.setLogoOpacity(properties.logoopacity.value)
|
||||
window.settings.functionInsights("setLogoOpacity", Object.keys(properties) !== 1)
|
||||
}
|
||||
}
|
||||
if (properties.logoimage) {
|
||||
if (properties.logoimage.value) {
|
||||
window.settings.setLogo('file:///' + properties.logoimage.value)
|
||||
window.settings.functionInsights("setLogo", Object.keys(properties) !== 1)
|
||||
} else {
|
||||
window.settings.resetLogoImage()
|
||||
}
|
||||
}
|
||||
if (properties.logox) {
|
||||
window.settings.logoPadding("x", properties.logox.value)
|
||||
window.settings.functionInsights("logoPaddingX", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.logoy) {
|
||||
window.settings.logoPadding("y", properties.logoy.value)
|
||||
window.settings.functionInsights("logoPaddingY", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.defaultbackground) {
|
||||
if (properties.defaultbackground.value) {
|
||||
window.settings.setDefaultBackground(properties.defaultbackground.value)
|
||||
window.settings.functionInsights("setDefaultBackground", Object.keys(properties) !== 1)
|
||||
}
|
||||
}
|
||||
if (properties.background) {
|
||||
if (properties.background.value) {
|
||||
window.settings.setBackgoundImage(`url('file:///${properties.background.value}`)
|
||||
window.settings.functionInsights("setBackgoundImage", Object.keys(properties) !== 1)
|
||||
} else {
|
||||
window.settings.resetBackground()
|
||||
}
|
||||
}
|
||||
if (properties.voicetitle) {
|
||||
window.voice.useVoice = properties.voicetitle.value
|
||||
window.settings.functionInsights("useVoice", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voicelanguage) {
|
||||
window.voice.language = properties.voicelanguage.value
|
||||
window.settings.functionInsights("language", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voiceidle) {
|
||||
window.voice.idleDuration = parseInt(properties.voiceidle.value)
|
||||
window.settings.functionInsights("idleDuration", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voicenext) {
|
||||
window.voice.nextDuration = parseInt(properties.voicenext.value)
|
||||
window.settings.functionInsights("nextDuration", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voicesubtitle) {
|
||||
window.voice.useSubtitle = properties.voicesubtitle.value
|
||||
window.settings.functionInsights("useSubtitle", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voicesubtitlelanguage) {
|
||||
window.voice.subtitleLanguage = properties.voicesubtitlelanguage.value
|
||||
window.settings.functionInsights("subtitleLanguage", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voicesubtitlex) {
|
||||
window.voice.subtitleX = properties.voicesubtitlex.value
|
||||
window.settings.functionInsights("subtitleX", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voicesubtitley) {
|
||||
window.voice.subtitleY = properties.voicesubtitley.value
|
||||
window.settings.functionInsights("subtitleY", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.voiceactor) {
|
||||
window.voice.useVoiceActor = properties.voiceactor.value
|
||||
console.log(properties)
|
||||
window.settings.functionInsights("useVoiceActor", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.position) {
|
||||
if (!properties.position.value) {
|
||||
@@ -87,15 +106,19 @@ window.wallpaperPropertyListener = {
|
||||
}
|
||||
if (properties.paddingleft) {
|
||||
window.settings.positionPadding("left", properties.paddingleft.value)
|
||||
window.settings.functionInsights("positionPaddingLeft", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.paddingright) {
|
||||
window.settings.positionPadding("right", properties.paddingright.value)
|
||||
window.settings.functionInsights("positionPaddingRight", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.paddingtop) {
|
||||
window.settings.positionPadding("top", properties.paddingtop.value)
|
||||
window.settings.functionInsights("positionPaddingTop", Object.keys(properties) !== 1)
|
||||
}
|
||||
if (properties.paddingbottom) {
|
||||
window.settings.positionPadding("bottom", properties.paddingbottom.value)
|
||||
window.settings.functionInsights("positionPaddingBottom", Object.keys(properties) !== 1)
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user