From 6e442c14c10dcb30900c370a57344441e21a6621 Mon Sep 17 00:00:00 2001 From: Vick Scarlet Date: Tue, 17 Sep 2024 18:31:30 +0800 Subject: [PATCH] update: afd url --- src/app.js | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/app.js b/src/app.js index 6e4cf51c..e1a08819 100644 --- a/src/app.js +++ b/src/app.js @@ -7,21 +7,21 @@ import UIManager from './ui/uiManager.js'; import * as utils from './functions/util.js'; globalThis.UIManager = -globalThis.UI = -UIManager; + globalThis.UI = + UIManager; globalThis.$_ = utils; globalThis.goto = async tag => { let url; - switch(tag) { + switch (tag) { case 'github': url = 'https://github.com/VickScarlet/lifeRestart'; break; case 'discord': url = 'https://discord.gg/U3qrf49NMQ'; break; - case 'sponsor_afd': url = 'https://afdian.net/@LifeRestart'; break; + case 'sponsor_afd': url = 'https://afdian.com/a/LifeRestart'; break; case 'sponsor_ddf': url = 'https://dun.mianbaoduo.com/@vickscarlet'; break; } try { - if(Laya.Browser.onIOS) { + if (Laya.Browser.onIOS) { window.location.href = url; } else { window.open(url, '_blank'); @@ -30,8 +30,8 @@ globalThis.goto = async tag => { console.error(error); } } -class App{ - constructor(){ +class App { + constructor() { this.name = 'lifeRestart'; this.version = '2.0.0'; console.log(`${this.name} ${this.version}`); @@ -50,10 +50,10 @@ class App{ //class laya.webgl.text.CharSegment class CharSegment { constructor() { - this._sourceStr=null; + this._sourceStr = null; } textToSpit(str) { - this._sourceStr=str; + this._sourceStr = str; var texLen = str.length; var idx = -1; this._words = []; @@ -67,18 +67,18 @@ class App{ } } } - getChar(i){ + getChar(i) { return this._words; } - getCharCode(i){ + getCharCode(i) { return this._words[i].codePointAt(0); } - length(){ + length() { return this._words.length; } } - Laya.class(CharSegment,'laya.webgl.text.CharSegment'); - Laya.imps(CharSegment.prototype,{"laya.webgl.text.ICharSegment":true}) + Laya.class(CharSegment, 'laya.webgl.text.CharSegment'); + Laya.imps(CharSegment.prototype, { "laya.webgl.text.ICharSegment": true }) // Laya.init(1125, 2436, Laya.WebGL); @@ -103,15 +103,15 @@ class App{ const screenWidth = window.innerWidth; const screenHeight = window.innerHeight; const screenRatio = screenWidth / screenHeight; - if(screenRatio > designRatio) { + if (screenRatio > designRatio) { return [ - Math.min(screenWidth*designHeight/screenHeight, maxWidth), + Math.min(screenWidth * designHeight / screenHeight, maxWidth), designHeight ] } else { return [ designWidth, - Math.min(screenHeight*designWidth/screenWidth, maxHeight) + Math.min(screenHeight * designWidth / screenWidth, maxHeight) ] } } @@ -121,7 +121,7 @@ class App{ } async #setLanguage(language) { - switch(language) { + switch (language) { case App.languages['en-us']: case App.languages['zh-cn']: this.#language = language; @@ -131,23 +131,23 @@ class App{ break; } globalThis.$lang = - Laya.Text.langPacks = + Laya.Text.langPacks = (await import(`./i18n/${this.#language}.js`)).default; } resigterEvent() { $$on('achievement', achievement => { - $ui.popup(UI.popups.ACHIEVEMENT, {achievement}); + $ui.popup(UI.popups.ACHIEVEMENT, { achievement }); }) $$on('message', ([message, ...args]) => { - if(Array.isArray(message)) { - message = message.map(([m, ...a]) => $_.format($lang[m], ...a)) .join('\n'); + if (Array.isArray(message)) { + message = message.map(([m, ...a]) => $_.format($lang[m], ...a)).join('\n'); } else { message = $_.format( $lang[message], ...args ); } - $ui.popup(UI.popups.MESSAGE, {message}); + $ui.popup(UI.popups.MESSAGE, { message }); }) } @@ -159,7 +159,7 @@ class App{ this.#initLaya(); globalThis.$ui = UIManager.getInstance(); - if(theme=='default') { + if (theme == 'default') { theme = localStorage.getItem('theme') || 'default'; } @@ -168,8 +168,8 @@ class App{ await $ui.setLoading(UI.pages.LOADING); await $ui.switchView(UI.pages.LOADING); await core.initial( - dataSet=>Laya.promises.loader.load(`data/${this.#language}/${dataSet}.json`, null, Laya.Loader.JSON), - dataSet=>Laya.promises.loader.load(`data/${dataSet}.json`, null, Laya.Loader.JSON), + dataSet => Laya.promises.loader.load(`data/${this.#language}/${dataSet}.json`, null, Laya.Loader.JSON), + dataSet => Laya.promises.loader.load(`data/${dataSet}.json`, null, Laya.Loader.JSON), ); await $ui.switchView(UI.pages.MAIN);