Skip to content

Commit

Permalink
update: afd url
Browse files Browse the repository at this point in the history
  • Loading branch information
VickScarlet committed Sep 17, 2024
1 parent 2eadb6f commit 6e442c1
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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}`);
Expand All @@ -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 = [];
Expand All @@ -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);
Expand All @@ -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)
]
}
}
Expand All @@ -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;
Expand All @@ -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 });
})
}

Expand All @@ -159,7 +159,7 @@ class App{
this.#initLaya();
globalThis.$ui = UIManager.getInstance();

if(theme=='default') {
if (theme == 'default') {
theme = localStorage.getItem('theme') || 'default';
}

Expand All @@ -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);

Expand Down

0 comments on commit 6e442c1

Please sign in to comment.