Files
lifeRestart/src/index.js
Vick Scarlet 14f9340d0a Squashed commit of the following:
commit 870d711162
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Jan 27 16:50:19 2022 +0800

    update event

commit b327eb1765
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Jan 27 16:36:02 2022 +0800

    update event

commit 4e845bc2eb
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Jan 27 16:35:56 2022 +0800

    fix ui feel

commit bd508913c5
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Jan 27 16:35:22 2022 +0800

    update special thanks

commit d097b3bc15
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Jan 27 16:04:55 2022 +0800

    add unique character

commit 8d71b73e94
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Jan 25 21:27:29 2022 +0800

    fix: bug
    save load

commit 286828abe7
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Jan 25 18:15:22 2022 +0800

    add game mode

commit 0e3c885ad3
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Jan 6 20:09:20 2022 +0800

    update special thanks

commit b421082374
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Fri Dec 31 20:26:20 2021 +0800

    update specialthanks

commit 765a69294b
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Dec 14 19:10:03 2021 +0800

    fix ios goto

commit 8eb8c3ca72
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Dec 14 19:03:37 2021 +0800

    add event grade

commit ab705dd46c
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Dec 14 18:48:42 2021 +0800

    build version

commit a1e4232369
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Dec 14 18:47:05 2021 +0800

    change talent replace before property allocate

commit f4d7b3ae3c
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Dec 14 18:06:18 2021 +0800

    add event grade

commit 0567e40ddc
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 21:28:10 2021 +0800

    add particle

commit f17003925e
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 20:14:26 2021 +0800

    change ui

commit f8beda1d8f
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 19:08:30 2021 +0800

    change popup message ui

commit 915a2aa17d
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 18:34:29 2021 +0800

    new build

commit b5edabc104
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 18:18:46 2021 +0800

    add hint message

commit a143feadaf
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 17:57:31 2021 +0800

    fix copy bug

commit eab1975791
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 17:56:28 2021 +0800

    add save/load

commit acf9b92134
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Dec 2 14:35:33 2021 +0800

    add theme switch

commit 488a6054ab
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Wed Dec 1 18:30:36 2021 +0800

    fix uiManager bug

commit f0317eaf14
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Wed Dec 1 16:07:03 2021 +0800

    add message popup

commit eb02d1ee6f
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 28 21:22:54 2021 +0800

    change relocation

commit 60503eae47
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 28 19:27:16 2021 +0800

    change ScaleButton -> Laya.runtime.ScaleButton

commit 52ef5909c1
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 28 19:26:31 2021 +0800

    change ScaleButton -> Laya.runtime.ScaleButton

commit 0284f6aa71
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 28 19:05:24 2021 +0800

    config webpack

commit 0e272ffd99
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 28 13:17:41 2021 +0800

    add thanks

commit e1e2ab4701
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 28 11:40:21 2021 +0800

    add light theme

commit 4f55c00f86
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sat Nov 27 22:27:39 2021 +0800

    fix bug

commit 1d07bdfc46
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sat Nov 27 21:48:47 2021 +0800

    daily update

commit 52d6a0ca8f
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Wed Nov 24 23:10:04 2021 +0800

    daily update

commit f8dd720d4d
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Wed Nov 24 19:08:13 2021 +0800

    daily update

commit d088c1a862
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 21 21:41:46 2021 +0800

    remove useless

commit a711fcf3ed
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Nov 16 00:53:05 2021 +0800

    add achievement popup
    add page adaptive
    add talent extends

commit 05e02de3db
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sat Nov 13 01:24:04 2021 +0800

    add github and discord

commit bff0109cc5
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sat Nov 13 00:30:01 2021 +0800

    add trajectory auto mode

commit 54c04f65c2
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Fri Nov 12 19:54:31 2021 +0800

    fix property judge negative number bug

commit 660739530b
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Fri Nov 12 19:48:58 2021 +0800

    update achievement

commit c94e9e7433
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Thu Nov 11 21:37:45 2021 +0800

    update daily

commit c06cd9ea62
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Tue Nov 9 00:08:05 2021 +0800

    update daily

commit 2666983f89
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 7 23:00:22 2021 +0800

    add uiManager auto scan and load skin resource

commit 22fa5d755a
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Nov 7 22:17:04 2021 +0800

    update framework

commit f40698d63e
Author: Vick Scarlet <scarlet_vick@outlook.com>
Date:   Sun Oct 31 00:13:22 2021 +0800

    add laya
2022-01-28 00:39:35 +08:00

225 lines
7.8 KiB
JavaScript

import App from './app.js';
import Life from './modules/life.js';
globalThis.$$eventMap = new Map();
globalThis.$$event = (tag, data) => {
const listener = $$eventMap.get(tag);
if(listener) listener.forEach(fn=>fn(data));
}
globalThis.$$on = (tag, fn) => {
let listener = $$eventMap.get(tag);
if(!listener) {
listener = new Set();
$$eventMap.set(tag, listener);
}
listener.add(fn);
}
globalThis.$$off = (tag, fn) => {
const listener = $$eventMap.get(tag);
if(listener) listener.delete(fn);
}
globalThis.$$copy = async text => {
const result = await navigator.permissions.query({ name: "clipboard-write" })
if (result.state == "granted" || result.state == "prompt") {
navigator.clipboard.writeText(text)
return true;
}
const input = document.createElement('input');
input.setAttribute('style', 'opacity: 0;');
document.body.appendChild(input);
input.value = text;
input.select();
const r = document.execCommand("copy");
document.body.removeChild(input);
return r;
}
globalThis.$$read = async ()=>{
const result = await navigator.permissions.query({ name: "clipboard-read" })
if (result.state == "granted" || result.state == "prompt") {
return await navigator.clipboard.readText();
}
const input = document.createElement('input');
input.setAttribute('style', 'opacity: 0;');
document.body.appendChild(input);
input.focus();
const r = document.execCommand("paste");
const text = input.value;
document.body.removeChild(input);
return r?text:r;
};
const core = new Life();
const game = new App();
globalThis.core = core;
globalThis.game = game;
const query = {};
location.search.substr(1).split('&').forEach(item => {
const parts = item.split('=');
query[parts[0]] = parts[1];
});
core.config({
defaultPropertyPoints: 20, // default number of points for a property
talentSelectLimit: 3, // max number of talents that can be selected
propertyAllocateLimit: [0, 10], // scoop of properties that can be allocated,
defaultPropertys: { SPR: 5 }, // default properties
talentConfig: { // config for talent
talentPullCount: 10, // number of talents to pull from the talent pool
talentRate: { 1:100, 2:10, 3:1, total: 1000 }, // rate of talent pull
additions: {
TMS: [
[ 10, { 2: 1 }],
[ 30, { 2: 2 }],
[ 50, { 2: 3 }],
[ 70, { 2: 4 }],
[100, { 2: 5 }],
],
CACHV: [
[ 10, { 2: 1 }],
[ 30, { 2: 2 }],
[ 50, { 2: 3 }],
[ 70, { 2: 4 }],
[100, { 2: 5 }],
]
},
},
propertyConfig: { // config for property
judge: {
// type: [min, grade, judge]
RTLT: [
[ 0, 0],
[ 0.3, 1],
[ 0.6, 2],
[ 0.9, 3],
],
REVT: [
[ 0, 0],
[ 0.2, 1],
[ 0.4, 2],
[ 0.6, 3],
],
TMS: [
[ 0, 0, 'UI_Remake_Times_Judge_Level_0'],
[ 10, 1, 'UI_Remake_Times_Judge_Level_1'],
[ 30, 1, 'UI_Remake_Times_Judge_Level_2'],
[ 50, 2, 'UI_Remake_Times_Judge_Level_3'],
[ 70, 2, 'UI_Remake_Times_Judge_Level_4'],
[ 100, 3, 'UI_Remake_Times_Judge_Level_5'],
],
CACHV: [
[ 0, 0, 'UI_Achievement_Count_Judge_Level_0'],
[ 10, 1, 'UI_Achievement_Count_Judge_Level_1'],
[ 30, 1, 'UI_Achievement_Count_Judge_Level_2'],
[ 50, 2, 'UI_Achievement_Count_Judge_Level_3'],
[ 70, 2, 'UI_Achievement_Count_Judge_Level_4'],
[ 100, 3, 'UI_Achievement_Count_Judge_Level_5'],
],
HCHR: [
[ 0, 0, 'UI_Judge_Level_0'],
[ 1, 0, 'UI_Judge_Level_1'],
[ 2, 0, 'UI_Judge_Level_2'],
[ 4, 0, 'UI_Judge_Level_3'],
[ 7, 1, 'UI_Judge_Level_4'],
[ 9, 2, 'UI_Judge_Level_5'],
[ 11, 3, 'UI_Judge_Level_6'],
],
HMNY: [
[ 0, 0, 'UI_Judge_Level_0'],
[ 1, 0, 'UI_Judge_Level_1'],
[ 2, 0, 'UI_Judge_Level_2'],
[ 4, 0, 'UI_Judge_Level_3'],
[ 7, 1, 'UI_Judge_Level_4'],
[ 9, 2, 'UI_Judge_Level_5'],
[ 11, 3, 'UI_Judge_Level_6'],
],
HSPR: [
[ 0, 0, 'UI_Spirit_Judge_Level_0'],
[ 1, 0, 'UI_Spirit_Judge_Level_1'],
[ 2, 0, 'UI_Spirit_Judge_Level_2'],
[ 4, 0, 'UI_Spirit_Judge_Level_3'],
[ 7, 1, 'UI_Spirit_Judge_Level_4'],
[ 9, 2, 'UI_Spirit_Judge_Level_5'],
[ 11, 3, 'UI_Spirit_Judge_Level_6'],
],
HINT: [
[ 0, 0, 'UI_Judge_Level_0'],
[ 1, 0, 'UI_Judge_Level_1'],
[ 2, 0, 'UI_Judge_Level_2'],
[ 4, 0, 'UI_Judge_Level_3'],
[ 7, 1, 'UI_Judge_Level_4'],
[ 9, 2, 'UI_Judge_Level_5'],
[ 11, 3, 'UI_Judge_Level_6'],
[ 21, 3, 'UI_Intelligence_Judge_Level_7'],
[ 131, 3, 'UI_Intelligence_Judge_Level_8'],
[ 501, 3, 'UI_Intelligence_Judge_Level_9'],
],
HSTR: [
[ 0, 0, 'UI_Judge_Level_0'],
[ 1, 0, 'UI_Judge_Level_1'],
[ 2, 0, 'UI_Judge_Level_2'],
[ 4, 0, 'UI_Judge_Level_3'],
[ 7, 1, 'UI_Judge_Level_4'],
[ 9, 2, 'UI_Judge_Level_5'],
[ 11, 3, 'UI_Judge_Level_6'],
[ 21, 3, 'UI_Strength_Judge_Level_7'],
[ 101, 3, 'UI_Strength_Judge_Level_8'],
[ 401, 3, 'UI_Strength_Judge_Level_9'],
[1001, 3, 'UI_Strength_Judge_Level_10'],
[2001, 3, 'UI_Strength_Judge_Level_11'],
],
HAGE: [
[ 0, 0, 'UI_AGE_Judge_Level_0'],
[ 1, 0, 'UI_AGE_Judge_Level_1'],
[ 10, 0, 'UI_AGE_Judge_Level_2'],
[ 18, 0, 'UI_AGE_Judge_Level_3'],
[ 40, 0, 'UI_AGE_Judge_Level_4'],
[ 60, 1, 'UI_AGE_Judge_Level_5'],
[ 70, 1, 'UI_AGE_Judge_Level_6'],
[ 80, 2, 'UI_AGE_Judge_Level_7'],
[ 90, 2, 'UI_AGE_Judge_Level_8'],
[ 95, 3, 'UI_AGE_Judge_Level_9'],
[ 100, 3, 'UI_AGE_Judge_Level_10'],
[ 500, 3, 'UI_AGE_Judge_Level_11'],
],
SUM: [
[ 0, 0, 'UI_Judge_Level_0'],
[ 41, 0, 'UI_Judge_Level_1'],
[ 50, 0, 'UI_Judge_Level_2'],
[ 60, 0, 'UI_Judge_Level_3'],
[ 80, 1, 'UI_Judge_Level_4'],
[ 100, 2, 'UI_Judge_Level_5'],
[ 110, 3, 'UI_Judge_Level_6'],
[ 120, 3, 'UI_Judge_Level_7'],
],
},
},
characterConfig: { // config for character
characterPullCount: 3,
rateableKnife: 10,
propertyWeight: [
[ 0, 1],
[ 1, 2],
[ 2, 3],
[ 3, 4],
[ 4, 5],
[ 5, 6],
[ 6, 5],
[ 7, 4],
[ 8, 3],
[ 9, 2],
[10, 1],
],
talentWeight: [
[ 1, 1],
[ 2, 2],
[ 3, 3],
[ 4, 2],
[ 5, 1],
],
},
});
game.start(query);