mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-04-22 21:04:23 +08:00
add achievement popup
add page adaptive add talent extends
This commit is contained in:
+34
-1
@@ -14,13 +14,38 @@ class App{
|
||||
};
|
||||
|
||||
#initLaya() {
|
||||
Laya.init(1125, 2436, Laya.WebGL);
|
||||
// Laya.init(1125, 2436, Laya.WebGL);
|
||||
Laya.init(...this.#fitScreen, Laya.WebGL);
|
||||
|
||||
Laya.stage.alignV = Laya.Stage.ALIGN_MIDDLE;
|
||||
Laya.stage.alignH = Laya.Stage.ALIGN_CENTER;
|
||||
|
||||
Laya.stage.scaleMode = "showall";
|
||||
Laya.stage.bgColor = "#04131f";
|
||||
window.onresize = () => Laya.stage.size(...this.#fitScreen);
|
||||
}
|
||||
|
||||
get #fitScreen() {
|
||||
const designWidth = 1125;
|
||||
const designHeight = 2436;
|
||||
const maxWidth = designHeight * 3 / 4;
|
||||
const maxHeight = designWidth * 24 / 9;
|
||||
const designRatio = designWidth / designHeight;
|
||||
|
||||
const screenWidth = window.innerWidth;
|
||||
const screenHeight = window.innerHeight;
|
||||
const screenRatio = screenWidth / screenHeight;
|
||||
if(screenRatio > designRatio) {
|
||||
return [
|
||||
Math.min(screenWidth*designHeight/screenHeight, maxWidth),
|
||||
designHeight
|
||||
]
|
||||
} else {
|
||||
return [
|
||||
designWidth,
|
||||
Math.min(screenHeight*designWidth/screenWidth, maxHeight)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
async setLanguage(language) {
|
||||
@@ -40,9 +65,16 @@ class App{
|
||||
Laya.Text.langPacks = (await import(`./i18n/${this.#language}.js`)).default;
|
||||
}
|
||||
|
||||
resigterEvent() {
|
||||
$$on('achievement', achievement => {
|
||||
UIManager.getInstance().popup(UIManager.getInstance().themes.popup.ACHIEVEMENT, {achievement});
|
||||
})
|
||||
}
|
||||
|
||||
async start({
|
||||
language = App.languages['zh-cn']
|
||||
}) {
|
||||
this.resigterEvent();
|
||||
this.#initLaya();
|
||||
const uiManager = UIManager.getInstance();
|
||||
uiManager.themes = ViewTypes.themes.default;
|
||||
@@ -52,6 +84,7 @@ class App{
|
||||
await core.initial(dataSet=>Laya.promises.loader.load(`data/${this.#language}/${dataSet}.json`, null, Laya.Loader.JSON));
|
||||
await uiManager.switchView(uiManager.themes.MAIN, null, {
|
||||
load: [
|
||||
"fonts/方正像素12.ttf",
|
||||
"images/atlas/images/accessories.atlas",
|
||||
"images/atlas/images/border.atlas",
|
||||
"images/atlas/images/button.atlas",
|
||||
|
||||
Reference in New Issue
Block a user