31 Commits

Author SHA1 Message Date
Vick Scarlet
0567e40ddc add particle 2021-12-02 21:28:10 +08:00
Vick Scarlet
f17003925e change ui 2021-12-02 20:14:26 +08:00
Vick Scarlet
f8beda1d8f change popup message ui 2021-12-02 19:08:30 +08:00
Vick Scarlet
915a2aa17d new build 2021-12-02 18:34:29 +08:00
Vick Scarlet
b5edabc104 add hint message 2021-12-02 18:18:46 +08:00
Vick Scarlet
a143feadaf fix copy bug 2021-12-02 17:57:31 +08:00
Vick Scarlet
eab1975791 add save/load 2021-12-02 17:56:28 +08:00
Vick Scarlet
acf9b92134 add theme switch 2021-12-02 14:35:33 +08:00
Vick Scarlet
488a6054ab fix uiManager bug 2021-12-01 18:30:36 +08:00
Vick Scarlet
f0317eaf14 add message popup 2021-12-01 16:07:03 +08:00
Vick Scarlet
eb02d1ee6f change relocation 2021-11-28 21:22:54 +08:00
Vick Scarlet
60503eae47 change ScaleButton -> Laya.runtime.ScaleButton 2021-11-28 19:27:16 +08:00
Vick Scarlet
52ef5909c1 change ScaleButton -> Laya.runtime.ScaleButton 2021-11-28 19:26:31 +08:00
Vick Scarlet
0284f6aa71 config webpack 2021-11-28 19:05:24 +08:00
Vick Scarlet
0e272ffd99 add thanks 2021-11-28 13:17:41 +08:00
Vick Scarlet
e1e2ab4701 add light theme 2021-11-28 11:40:21 +08:00
Vick Scarlet
4f55c00f86 fix bug 2021-11-27 22:27:39 +08:00
Vick Scarlet
1d07bdfc46 daily update 2021-11-27 21:48:47 +08:00
Vick Scarlet
52d6a0ca8f daily update 2021-11-24 23:10:04 +08:00
Vick Scarlet
f8dd720d4d daily update 2021-11-24 19:08:13 +08:00
Vick Scarlet
d088c1a862 remove useless 2021-11-21 21:41:46 +08:00
Vick Scarlet
a711fcf3ed add achievement popup
add page adaptive
add talent extends
2021-11-16 00:53:05 +08:00
Vick Scarlet
05e02de3db add github and discord 2021-11-13 01:24:04 +08:00
Vick Scarlet
bff0109cc5 add trajectory auto mode 2021-11-13 00:30:01 +08:00
Vick Scarlet
54c04f65c2 fix property judge negative number bug 2021-11-12 19:54:31 +08:00
Vick Scarlet
660739530b update achievement 2021-11-12 19:48:58 +08:00
Vick Scarlet
c94e9e7433 update daily 2021-11-11 21:37:45 +08:00
Vick Scarlet
c06cd9ea62 update daily 2021-11-09 00:08:05 +08:00
Vick Scarlet
2666983f89 add uiManager auto scan and load skin resource 2021-11-07 23:00:22 +08:00
Vick Scarlet
22fa5d755a update framework 2021-11-07 22:17:04 +08:00
Vick Scarlet
f40698d63e add laya 2021-10-31 00:13:22 +08:00
113 changed files with 183698 additions and 5298 deletions

View File

@@ -1,2 +0,0 @@
node_modules
npm-debug.log

View File

@@ -1,29 +0,0 @@
name: Build and Deploy
on:
push:
branches: [main]
permissions:
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
pnpm install
pnpm xlsx2json
pnpm build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: template # The folder the action should deploy.

31
.github/workflows/node.js.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build --if-present
- run: npm test

5
.gitignore vendored
View File

@@ -107,7 +107,4 @@ utils/xlsxTransform-*
/.idea
__localStorage.json
template/public
public/data
__localStorage.json

29
.vscode/launch.json vendored
View File

@@ -4,15 +4,40 @@
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome",
"request": "launch",
"type": "pwa-chrome",
"url": "http://127.0.0.1:8000/public/index.html",
"webRoot": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "test",
"program": "${workspaceFolder}/test",
"skipFiles": [
"<node_internals>/**",
"**/node_modumes/**"
"<node_internals>/**"
]
},
{
"type": "node",
"request": "launch",
"name": "xlsx2json",
"program": "${workspaceFolder}/node_modules/v-transform/src/index.js",
"args": ["transform", "jobs/xlsx2json/config.json"],
"skipFiles": [
"<node_internals>/**"
]
},
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
},
]
}

1
CNAME Normal file
View File

@@ -0,0 +1 @@
liferestart.syaro.io

View File

@@ -1,15 +0,0 @@
FROM node:alpine
ENV NPM_CONFIG_LOGLEVEL info
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["yarn", "dev"]

View File

@@ -24,7 +24,7 @@ cd my-project
2. 进入目录安装依赖。
```bash
pnpm install
yarn install
```
或者
@@ -36,7 +36,7 @@ npm install
3. 启动本地服务器。
```bash
pnpm dev
yarn dev
```
或者
@@ -45,7 +45,7 @@ pnpm dev
npm run dev
```
4. 启动完成后会自动打开浏览器访问 [http://localhost:5173](http://localhost:5173)。
4. 启动完成后会自动打开浏览器访问 [http://localhost:8081/view/index.html](http://localhost:8081/view/index.html)。
</details>

View File

@@ -24,7 +24,7 @@ cd my-project
2. Installation dependence.
```bash
pnpm install
yarn install
```
Or
@@ -36,7 +36,7 @@ npm install
3. Start local server.
```bash
pnpm dev
yarn dev
```
Or
@@ -45,7 +45,7 @@ Or
npm run dev
```
4. After the startup is complete, open a browser and visit [http://localhost:5173](http://localhost:5173).
4. After the startup is complete, will automatically open a browser and visit [http://localhost:8081/view/index.html](http://localhost:8081/view/index.html).
</details>
<details>

View File

@@ -2,7 +2,10 @@
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset="UTF-8">
<script data-ad-client="ca-pub-9857163863537600" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
{% seo %}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap" as="style" type="text/css" crossorigin>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
@@ -15,7 +18,8 @@
<header class="page-header" role="banner">
<h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
<h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>
<a href="/public/" class="btn">RESTART</a>
<a href="/view/" class="btn">RESTART</a>
<a href="/view/test.html" class="btn">Source Version</a>
{% if site.github.is_project_page %}
<a href="{{ site.github.repository_url }}" class="btn">View on GitHub</a>
{% endif %}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,19 @@
{
"configurations": [
{
"source": [
"../../data/specialthanks-afd.xlsx",
"../../data/specialthanks-dun.xlsx"
],
"target": "../../public/data"
},
{
"source": "../../data/zh-cn",
"target": "../../public/data/zh-cn"
},
{
"source": "../../data/en-us",
"target": "../../public/data/en-us"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
{
"x":0,
"type":"View",
"selectedBox":93,
"selecteID":94,
"selectedBox":1,
"selecteID":12,
"props":{"y":1218,"x":562,"width":1125,"sceneColor":"#000000","sceneBg":"laya/views/view/CyberTheme/CyberMain.png","runtime":"Laya.runtime.ViewBase","height":2436,"anchorY":0.5,"anchorX":0.5},
"nodeParent":-1,
"label":"View",
@@ -548,13 +548,14 @@
"props":{"width":1,"left":0,"height":1,"bottom":0},
"nodeParent":1,
"label":"Box",
"isOpen":false,
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":85,
"child":[
{
"x":30,
"type":"Box",
"props":{"y":-175,"x":100,"width":160,"var":"btnGithub","runtime":"Laya.runtime.ScaleButton","name":"btnGithub","height":160,"anchorY":0.5,"anchorX":0.5},
"nodeParent":85,
@@ -579,6 +580,7 @@
}]
},
{
"x":30,
"type":"Box",
"props":{"y":-355,"x":100,"width":160,"var":"btnDiscord","runtime":"Laya.runtime.ScaleButton","name":"btnDiscord","height":160,"anchorY":0.5,"anchorX":0.5},
"nodeParent":85,
@@ -609,13 +611,14 @@
"props":{"right":0,"bottom":0},
"nodeParent":1,
"label":"Box",
"isOpen":false,
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":88,
"child":[
{
"x":30,
"type":"Box",
"props":{"y":-300,"x":-100,"width":110,"runtime":"Laya.runtime.ScaleButton","height":110,"anchorY":0.5,"anchorX":0.5},
"nodeParent":88,
@@ -627,6 +630,7 @@
"compId":90,
"child":[
{
"x":45,
"type":"Box",
"props":{"width":110,"var":"btnSaveLoad","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","height":110,"centerY":0,"centerX":0,"anchorY":0.5,"anchorX":0.5},
"nodeParent":90,
@@ -638,6 +642,7 @@
"compId":91,
"child":[
{
"x":60,
"type":"Image",
"props":{"width":80,"skin":"images/icons/icon_save.png","height":80,"centerY":0,"centerX":0},
"nodeParent":91,
@@ -652,6 +657,7 @@
}]
},
{
"x":30,
"type":"Box",
"props":{"y":-175,"x":-100,"width":110,"runtime":"Laya.runtime.ScaleButton","height":110,"anchorY":0.5,"anchorX":0.5},
"nodeParent":88,
@@ -663,6 +669,7 @@
"compId":89,
"child":[
{
"x":45,
"type":"Box",
"props":{"width":110,"var":"btnThemes","runtime":"Laya.runtime.ColorfulBox","name":"btnThemes","height":110,"centerY":0,"centerX":0,"anchorY":0.5,"anchorX":0.5},
"nodeParent":89,
@@ -687,32 +694,6 @@
}]
}]
}]
},
{
"x":15,
"type":"Box",
"props":{"x":572,"var":"banner","centerX":0,"bottom":100,"anchorY":1,"anchorX":0.5},
"nodeParent":1,
"label":"Box(banner)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":93,
"child":[
{
"x":30,
"type":"Label",
"props":{"text":"UI_Banner","fontSize":40,"font":"方正像素12","color":"#00fffd"},
"nodeParent":93,
"label":"Label",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":94,
"child":[
]
}]
}],
"animations":[
{

View File

@@ -1,8 +1,8 @@
{
"x":0,
"type":"View",
"selectedBox":88,
"selecteID":153,
"selectedBox":1,
"selecteID":152,
"props":{"width":1125,"sceneColor":"#000000","sceneBg":"laya/views/view/CyberTheme/CyberTrajectory.png","runtime":"Laya.runtime.ViewBase","height":2436},
"nodeParent":-1,
"label":"View",
@@ -889,14 +889,13 @@
"props":{"top":440,"right":20,"left":20,"bottom":250},
"nodeParent":1,
"label":"Box",
"isOpen":true,
"isOpen":false,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":102,
"child":[
{
"x":30,
"type":"Image",
"props":{"top":0,"skin":"images/border/border_1@3x.png","right":0,"left":0,"bottom":0},
"nodeParent":102,
@@ -909,7 +908,6 @@
]
},
{
"x":30,
"type":"Panel",
"props":{"var":"panelTrajectory","vScrollBarSkin":"images/slider/vslider_1@3x.png","top":80,"right":20,"name":"panelTrajectory","left":0,"bottom":80},
"nodeParent":102,
@@ -921,19 +919,17 @@
"compId":18,
"child":[
{
"x":45,
"type":"VBox",
"props":{"var":"vboxTrajectory","top":0,"right":40,"name":"vboxTrajectory","left":20},
"nodeParent":18,
"label":"VBox(vboxTrajectory)",
"isOpen":true,
"isOpen":false,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":17,
"child":[
{
"x":60,
"type":"Box",
"props":{"right":0,"name":"boxTrajectoryItem","left":0},
"nodeParent":17,
@@ -945,25 +941,11 @@
"compId":88,
"child":[
{
"x":75,
"type":"Box",
"props":{"y":0,"width":10,"top":0,"runtime":"Laya.runtime.ColorfulBox","name":"boxGrade","left":0,"height":50},
"nodeParent":88,
"label":"Box(boxGrade)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":153,
"child":[
]
},
{
"x":75,
"type":"HBox",
"props":{"y":0,"x":220,"name":"hboxAge","anchorX":1,"align":"middle"},
"props":{"y":0,"x":200,"name":"hboxAge","anchorX":1,"align":"middle"},
"nodeParent":88,
"label":"HBox(hboxAge)",
"isOpen":false,
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
@@ -1007,9 +989,8 @@
}]
},
{
"x":75,
"type":"Label",
"props":{"wordWrap":true,"text":"你的父母开始辅导你数学和英语,智力+1","right":0,"name":"labContent","left":240,"leading":44,"fontSize":50,"font":"方正像素12","color":"#ffffff"},
"props":{"wordWrap":true,"text":"你的父母开始辅导你数学和英语,智力+1","right":0,"name":"labContent","left":220,"leading":44,"fontSize":50,"font":"方正像素12","color":"#ffffff"},
"nodeParent":88,
"label":"Label(labContent)",
"isDirectory":false,
@@ -1024,7 +1005,6 @@
"$HIDDEN":false
},
{
"x":30,
"type":"Box",
"props":{"y":20,"x":20,"var":"btnUp","top":20,"right":20,"name":"btnUp","left":20,"height":50},
"nodeParent":102,
@@ -1073,7 +1053,6 @@
}]
},
{
"x":30,
"type":"Box",
"props":{"y":1676,"x":20,"var":"btnDown","right":20,"name":"btnDown","left":20,"height":50,"bottom":20},
"nodeParent":102,

View File

@@ -1,128 +0,0 @@
{
"x":0,
"type":"View",
"selectedBox":1,
"selecteID":8,
"props":{"width":1125,"sceneColor":"#000000","height":2436},
"nodeParent":-1,
"label":"View",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":1,
"child":[
{
"x":15,
"type":"Box",
"props":{"y":10,"x":10,"width":600,"var":"btnCustom","runtime":"Laya.runtime.ScaleButton","name":"btn","height":400,"centerY":-400,"centerX":0},
"nodeParent":1,
"label":"Box(btnCustom)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":2,
"child":[
{
"x":30,
"type":"Image",
"props":{"top":-15,"skin":"images/border/achievement_complete@3x.png","right":-15,"left":-15,"bottom":-15},
"nodeParent":2,
"label":"Image",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":10,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"top":50,"text":"UI_CustomMode","fontSize":80,"font":"方正像素12","color":"#ffffff","centerX":0,"bold":true},
"nodeParent":2,
"label":"Label",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":4,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"top":200,"text":"UI_CustomModeDescription","right":0,"left":0,"leading":20,"fontSize":40,"font":"方正像素12","color":"#bcbcbc","bottom":0,"align":"center"},
"nodeParent":2,
"label":"Label",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":5,
"child":[
]
}]
},
{
"x":15,
"type":"Box",
"props":{"y":10,"x":20,"width":600,"var":"btnCelebrity","runtime":"Laya.runtime.ScaleButton","name":"btn","height":400,"centerY":400,"centerX":0},
"nodeParent":1,
"label":"Box(btnCelebrity)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":3,
"child":[
{
"x":30,
"type":"Image",
"props":{"y":-15,"x":-15,"top":-15,"skin":"images/border/achievement_complete@3x.png","right":-15,"left":-15,"bottom":-15},
"nodeParent":3,
"label":"Image",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":11,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"top":50,"text":"UI_CelebrityMode","fontSize":80,"font":"方正像素12","color":"#ffffff","centerX":0,"bold":true},
"nodeParent":3,
"label":"Label",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":7,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"top":200,"text":"UI_CelebrityModeDescription","right":0,"left":0,"leading":20,"fontSize":40,"font":"方正像素12","color":"#bcbcbc","bottom":0,"align":"center"},
"nodeParent":3,
"label":"Label",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":8,
"child":[
]
}]
}],
"animations":[
{
"nodes":[
],
"name":"ani1",
"id":1,
"frameRate":24,
"action":0
}]
}

View File

@@ -1,306 +0,0 @@
{
"x":0,
"type":"View",
"selectedBox":1,
"selecteID":28,
"props":{"width":1125,"sceneColor":"#000000","height":2436},
"nodeParent":-1,
"label":"View",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":1,
"child":[
{
"x":15,
"type":"Label",
"props":{"y":80,"text":"UI_Title_Celebrity","name":"title","fontSize":80,"font":"SimHei","color":"#ffffff","centerX":0},
"nodeParent":1,
"label":"Label(title)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":19,
"child":[
]
},
{
"x":15,
"type":"Panel",
"props":{"var":"panelCharacter","vScrollBarSkin":" ","top":200,"right":0,"name":"panelCharacter","left":0,"bottom":700},
"nodeParent":1,
"label":"Panel(panelCharacter)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":2,
"child":[
{
"x":30,
"type":"VBox",
"props":{"y":10,"width":1000,"var":"vboxCharacter","space":20,"name":"vboxCharacter","centerX":0},
"nodeParent":2,
"label":"VBox(vboxCharacter)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":8,
"child":[
{
"x":45,
"type":"Box",
"props":{"right":0,"name":"boxCharacter","left":0},
"nodeParent":8,
"label":"Box(boxCharacter)",
"isOpen":false,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":10,
"child":[
{
"type":"Box",
"props":{"y":0,"runtime":"Laya.runtime.ColorfulBox","right":0,"name":"boxName","left":0,"height":100},
"nodeParent":10,
"label":"Box(boxName)",
"isOpen":false,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":12,
"child":[
{
"type":"Label",
"props":{"valign":"middle","text":"颜值10 智力10 体质10 家境Π","name":"label","fontSize":55,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"align":"center"},
"nodeParent":12,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":18,
"child":[
]
}]
},
{
"type":"VBox",
"props":{"top":100,"space":20,"runtime":"Laya.runtime.ColorfulBox","right":25,"name":"vboxStates","left":25},
"nodeParent":10,
"label":"VBox(vboxStates)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":11,
"child":[
{
"type":"Label",
"props":{"valign":"middle","text":"颜值10 智力10 体质10 家境Π","name":"label","height":100,"fontSize":55,"font":"SimHei","color":"#ffffff","centerX":0,"align":"center"},
"nodeParent":11,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":14,
"child":[
]
}]
}]
},
{
"x":45,
"type":"Box",
"props":{"runtime":"Laya.runtime.ColorfulBox","right":25,"name":"boxTalent","left":25,"height":100},
"nodeParent":8,
"label":"Box(boxTalent)",
"isOpen":false,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":15,
"child":[
{
"type":"Label",
"props":{"valign":"middle","text":"颜值10 智力10 体质10 家境Π","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"align":"center"},
"nodeParent":15,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":17,
"child":[
]
}]
},
{
"x":45,
"type":"Box",
"props":{"y":10,"x":10,"right":0,"name":"boxUniqueUnGenerate","left":0},
"nodeParent":8,
"label":"Box(boxUniqueUnGenerate)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":20,
"child":[
{
"x":60,
"type":"Box",
"props":{"y":0,"runtime":"Laya.runtime.ColorfulBox","right":0,"name":"boxName","left":0,"height":100},
"nodeParent":20,
"label":"Box(boxName)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":21,
"child":[
{
"x":75,
"type":"Label",
"props":{"valign":"middle","text":"UI_UniqueWaTaShi","name":"label","fontSize":55,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"align":"center"},
"nodeParent":21,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":22,
"child":[
]
}]
},
{
"x":60,
"type":"VBox",
"props":{"top":100,"space":20,"runtime":"Laya.runtime.ColorfulBox","right":25,"name":"vboxStates","left":25},
"nodeParent":20,
"label":"VBox(vboxStates)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":23,
"child":[
{
"x":75,
"type":"Label",
"props":{"y":1,"valign":"middle","text":"UI_UniqueWaTaShiContent","right":0,"name":"label","left":0,"leading":30,"fontSize":55,"font":"SimHei","color":"#ffffff","align":"center"},
"nodeParent":23,
"label":"Label(label)",
"isOpen":true,
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":24,
"child":[
]
},
{
"x":75,
"type":"Box",
"props":{"y":2,"right":0,"name":"boxBtn","left":0,"height":150},
"nodeParent":23,
"label":"Box(boxBtn)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":25,
"child":[
{
"x":90,
"type":"Box",
"props":{"runtime":"Laya.runtime.ColorfulBox","right":50,"name":"btn","left":50,"height":120,"centerY":0},
"nodeParent":25,
"label":"Box(btn)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":26,
"child":[
{
"x":105,
"type":"Label",
"props":{"y":30,"x":290,"text":"UI_GenerateNow","name":"label","fontSize":60,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0},
"nodeParent":26,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":27,
"child":[
]
}]
}]
}]
}]
}]
}]
},
{
"x":15,
"type":"Box",
"props":{"width":480,"var":"btnRetry","runtime":"Laya.runtime.ColorfulBox","name":"btnRetry","height":150,"centerX":0,"bottom":400},
"nodeParent":1,
"label":"Box(btnRetry)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":4,
"child":[
{
"x":30,
"type":"Label",
"props":{"text":"UI_AllNot","name":"label","fontSize":60,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0},
"nodeParent":4,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":5,
"child":[
]
}]
},
{
"x":15,
"type":"Box",
"props":{"width":480,"var":"btnNext","runtime":"Laya.runtime.ColorfulBox","name":"btnNext","height":150,"centerX":0,"bottom":150},
"nodeParent":1,
"label":"Box(btnNext)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":6,
"child":[
{
"x":30,
"type":"Label",
"props":{"text":"UI_Make_New_Life","name":"label","fontSize":60,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0},
"nodeParent":6,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":7,
"child":[
]
}]
}],
"animations":[
{
"nodes":[
],
"name":"ani1",
"id":1,
"frameRate":24,
"action":0
}]
}

View File

@@ -1,8 +1,8 @@
{
"x":0,
"type":"View",
"selectedBox":101,
"selecteID":102,
"selectedBox":99,
"selecteID":100,
"props":{"y":1218,"x":562,"width":1125,"sceneColor":"#000000","runtime":"Laya.runtime.ViewBase","height":2436,"anchorY":0.5,"anchorX":0.5},
"nodeParent":-1,
"label":"View",
@@ -276,32 +276,6 @@
"child":[
]
}]
},
{
"x":15,
"type":"Box",
"props":{"x":562,"var":"banner","centerX":0,"bottom":100,"anchorY":1,"anchorX":0.5},
"nodeParent":1,
"label":"Box(banner)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":101,
"child":[
{
"x":30,
"type":"Label",
"props":{"text":"UI_Banner","name":"title","fontSize":40,"font":"SimHei","color":"#ffffff"},
"nodeParent":101,
"label":"Label(title)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":102,
"child":[
]
}]
}],
"animations":[
{

View File

@@ -1,128 +0,0 @@
{
"x":0,
"type":"View",
"selectedBox":1,
"selecteID":11,
"props":{"width":1125,"sceneColor":"#000000","height":2436},
"nodeParent":-1,
"label":"View",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":1,
"child":[
{
"x":15,
"type":"Box",
"props":{"width":600,"var":"btnCustom","runtime":"Laya.runtime.ColorfulBox","name":"btn","height":400,"centerY":-400,"centerX":0},
"nodeParent":1,
"label":"Box(btnCustom)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":2,
"child":[
{
"x":30,
"type":"Label",
"props":{"top":50,"text":"UI_CustomMode","name":"font_default","fontSize":80,"font":"SimHei","color":"#ffffff","centerX":0,"bold":true},
"nodeParent":2,
"label":"Label(font_default)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":4,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"top":200,"text":"UI_CustomModeDescription","right":0,"name":"font_default","left":0,"leading":20,"fontSize":40,"font":"SimHei","color":"#ffffff","bottom":0,"align":"center"},
"nodeParent":2,
"label":"Label(font_default)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":5,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"runtime":"Laya.runtime.ColorAgentLabel","name":"label"},
"nodeParent":2,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":10,
"child":[
]
}]
},
{
"x":15,
"type":"Box",
"props":{"x":10,"width":600,"var":"btnCelebrity","runtime":"Laya.runtime.ColorfulBox","name":"btn","height":400,"centerY":400,"centerX":0},
"nodeParent":1,
"label":"Box(btnCelebrity)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":3,
"child":[
{
"x":30,
"type":"Label",
"props":{"top":50,"text":"UI_CelebrityMode","name":"font_default","fontSize":80,"font":"SimHei","color":"#ffffff","centerX":0,"bold":true},
"nodeParent":3,
"label":"Label(font_default)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":8,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"top":200,"text":"UI_CelebrityModeDescription","right":0,"name":"font_default","left":0,"leading":20,"fontSize":40,"font":"SimHei","color":"#ffffff","bottom":0,"align":"center"},
"nodeParent":3,
"label":"Label(font_default)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":9,
"child":[
]
},
{
"x":30,
"type":"Label",
"props":{"y":10,"x":10,"runtime":"Laya.runtime.ColorAgentLabel","name":"label"},
"nodeParent":3,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":11,
"child":[
]
}]
}],
"animations":[
{
"nodes":[
],
"name":"ani1",
"id":1,
"frameRate":24,
"action":0
}]
}

View File

@@ -2,7 +2,7 @@
"x":0,
"type":"View",
"selectedBox":1,
"selecteID":95,
"selecteID":153,
"props":{"width":1125,"sceneColor":"#000000","runtime":"Laya.runtime.ViewBase","height":2436},
"nodeParent":-1,
"label":"View",

View File

@@ -2,8 +2,8 @@
"x":0,
"type":"Dialog",
"selectedBox":1,
"selecteID":25,
"props":{"width":645,"sceneColor":"#000000","height":400},
"selecteID":15,
"props":{"width":645,"sceneColor":"#000000","height":250},
"nodeParent":-1,
"label":"Dialog",
"isOpen":true,
@@ -15,16 +15,17 @@
{
"x":15,
"type":"Box",
"props":{"top":0,"right":0,"left":0,"bottom":300},
"props":{"top":0,"right":0,"left":0,"bottom":150},
"nodeParent":1,
"label":"Box",
"isOpen":false,
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":15,
"child":[
{
"x":30,
"type":"Box",
"props":{"y":0,"x":0,"width":645,"height":2},
"nodeParent":15,
@@ -49,6 +50,7 @@
}]
},
{
"x":30,
"type":"Box",
"props":{"width":645,"height":2,"centerX":0,"bottom":0},
"nodeParent":15,
@@ -73,6 +75,7 @@
}]
},
{
"x":30,
"type":"Box",
"props":{"width":645,"height":100,"centerY":0,"centerX":0,"alpha":0.2},
"nodeParent":15,
@@ -84,6 +87,7 @@
"compId":22,
"child":[
{
"x":45,
"type":"Rect",
"props":{"width":645,"lineWidth":1,"height":100,"fillColor":"#000000"},
"nodeParent":22,
@@ -100,7 +104,7 @@
{
"x":15,
"type":"TextInput",
"props":{"wordWrap":false,"var":"input","valign":"middle","top":0,"text":"content","right":0,"overflow":"scroll","left":0,"fontSize":35,"font":"SimHei","color":"#ffffff","bottom":300},
"props":{"wordWrap":false,"var":"input","valign":"middle","top":0,"text":"content","right":0,"overflow":"scroll","left":0,"fontSize":35,"font":"SimHei","color":"#ffffff","bottom":150},
"nodeParent":1,
"label":"TextInput(input)",
"isDirectory":false,
@@ -113,7 +117,7 @@
{
"x":15,
"type":"Box",
"props":{"width":120,"var":"btnSave","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":5,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},
"props":{"width":120,"var":"btnSave","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":5,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},
"nodeParent":1,
"label":"Box(btnSave)",
"isOpen":false,
@@ -138,7 +142,7 @@
{
"x":15,
"type":"Box",
"props":{"width":120,"var":"btnLoad","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":130,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},
"props":{"width":120,"var":"btnLoad","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":130,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},
"nodeParent":1,
"label":"Box(btnLoad)",
"isOpen":false,
@@ -163,7 +167,7 @@
{
"x":15,
"type":"Box",
"props":{"width":120,"var":"btnRead","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":260,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},
"props":{"y":335,"width":120,"var":"btnRead","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":260,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},
"nodeParent":1,
"label":"Box(btnRead)",
"isOpen":false,
@@ -188,7 +192,7 @@
{
"x":15,
"type":"Box",
"props":{"width":120,"var":"btnWrite","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":390,"height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},
"props":{"y":335,"width":120,"var":"btnWrite","runtime":"Laya.runtime.ColorfulBox","name":"btnSmall","left":390,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},
"nodeParent":1,
"label":"Box(btnWrite)",
"isOpen":false,
@@ -213,7 +217,7 @@
{
"x":15,
"type":"Box",
"props":{"x":10,"width":120,"var":"btnClose","runtime":"Laya.runtime.ColorfulBox","right":5,"name":"btnSmall","height":120,"bottom":155,"anchorY":0.5,"anchorX":0.5},
"props":{"y":10,"x":10,"width":120,"var":"btnClose","runtime":"Laya.runtime.ColorfulBox","right":5,"name":"btnSmall","height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},
"nodeParent":1,
"label":"Box(btnClose)",
"isOpen":false,
@@ -234,32 +238,6 @@
"child":[
]
}]
},
{
"x":15,
"type":"Box",
"props":{"y":20,"var":"btnBackup","runtime":"Laya.runtime.ColorfulBox","right":5,"name":"btnBackup","left":5,"height":120,"bottom":5,"anchorY":0.5,"anchorX":0.5},
"nodeParent":1,
"label":"Box(btnBackup)",
"isOpen":true,
"isDirectory":true,
"isAniNode":true,
"hasChild":true,
"compId":25,
"child":[
{
"x":30,
"type":"Label",
"props":{"text":"UI_BackupBtn","name":"label","fontSize":50,"font":"SimHei","color":"#ffffff","centerY":0,"centerX":0,"bold":true,"anchorY":0.5,"anchorX":0.5},
"nodeParent":25,
"label":"Label(label)",
"isDirectory":false,
"isAniNode":true,
"hasChild":false,
"compId":26,
"child":[
]
}]
}],
"animations":[
{

View File

@@ -1,19 +1,24 @@
{
"name": "life_restart",
"type": "module",
"main": "repl/index.js",
"version": "2.1.0",
"author": "Vick Scarlet <vick@syaro.io>",
"bin": "repl/index.js",
"version": "2.0.0",
"scripts": {
"xlsx2json": "vt transform -d public \"data/**/*.xlsx\"",
"dev": "vite",
"build": "vite build",
"start": "vite preview",
"test": "vitest"
"test": "node test",
"xlsxTransform": "vt transform data",
"xlsx2json": "vt transform jobs/xlsx2json/config.json",
"dev": "webpack serve --open /view/index.html",
"build": "webpack --mode production"
},
"devDependencies": {
"v-transform": "^2.1.1",
"vite": "^6.2.5",
"vitest": "^3.1.1"
"@babel/core": "^7.15.4",
"@babel/preset-env": "^7.15.4",
"babel-loader": "^8.2.2",
"core-js": "^3.17.2",
"html-webpack-plugin": "^5.5.0",
"v-transform": "^1.0.1",
"webpack": "^5.64.4",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.0"
}
}

1059
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
public/chunk/33.891bb.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
public/chunk/51.b32bb.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
public/chunk/85.ffdbc.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

71808
public/data/en-us/age.json Normal file

File diff suppressed because it is too large Load Diff

12652
public/data/en-us/events.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

71808
public/data/zh-cn/age.json Normal file

File diff suppressed because it is too large Load Diff

12652
public/data/zh-cn/events.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,8 @@
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<font-face font-family="方正像素12" src="fonts/方正像素12.ttf"/>
<title>Life Restart</title>
</head>
<body style="background:black">
<!--以下引用了常用类库,如果不使用,可以删除-->
<!--核心包,封装了显示对象渲染,事件,时间管理,时间轴动画,缓动,消息交互,socket本地存储鼠标触摸声音加载颜色滤镜位图字体等-->
@@ -52,7 +54,7 @@
<!--包含更多webgl滤镜比如外发光阴影模糊以及更多-->
<script type="text/javascript" src="libs/laya/laya.filter.js"></script>
<!--封装了html动态排版功能-->
<script type="text/javascript" src="libs/laya/laya.html.js"></script>
<!-- <script type="text/javascript" src="libs/laya/laya.html.js"></script> -->
<!--粒子类库-->
<script type="text/javascript" src="libs/laya/laya.particle.js"></script>
<!--提供tileMap解析支持-->
@@ -65,8 +67,8 @@
<!-- 物理引擎matter.js -->
<!--自定义的js(src文件夹下)文件自动添加到下面jsfile模块标签里面里js的顺序可以手动修改修改后保留修改的顺序新增加的js会默认依次追加到标签里-->
<!--删除标签ide不会自动添加js文件请谨慎操作-->
<script type="module" src="src/index.js"></script>
</head>
<body style="background:black"></body>
<!--jsfile--startTag-->
<script type="module" src="../src/index.js"></script>
<!--jsfile--endTag-->
</body>
</html>

1
public/index.html Normal file
View File

@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><meta name="description" content="やり直すんだ。そして、次はうまくやる。"/><meta name="keywords" content="人生重开模拟器 liferestart life restart remake 人生重来"/><meta name="renderer" content="webkit"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="full-screen" content="true"/><meta name="x5-fullscreen" content="true"/><meta name="360-fullscreen" content="true"/><meta name="theme-color" content="#157878"/><meta name="laya" screenorientation="landscape"/><meta http-equiv="expires" content="0"/><meta http-equiv="Cache-Control" content="no-siteapp"/><title>Life Restart</title><script src="libs/laya/min/laya.core.min.js"></script><script src="libs/laya/min/laya.webgl.min.js"></script><script src="libs/laya/min/laya.filter.min.js"></script><script src="libs/laya/min/laya.particle.min.js"></script><script src="libs/laya/min/laya.ui.min.js"></script><script defer="defer" src="chunk/main.09389.js"></script></head><body style="background:black"></body></html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,44 +1,32 @@
import { fileURLToPath } from 'url'
import { dirname } from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
import App from './app.js'
import { readFile, writeFile } from 'fs/promises'
import App from './app.js';
import { readFile, writeFile } from 'fs/promises';
async function main() {
try {
globalThis.localStorage = JSON.parse(
await readFile(__dirname + '/__localStorage.json')
)
globalThis.localStorage = JSON.parse(await readFile('__localStorage.json'));
} catch (e) {
globalThis.localStorage = {}
globalThis.localStorage = {};
}
localStorage.getItem = key =>
localStorage[key] === void 0 ? null : localStorage[key]
localStorage.setItem = (key, value) => (localStorage[key] = value)
localStorage.getItem = key => localStorage[key]===void 0? null: localStorage[key];
localStorage.setItem = (key, value) => (localStorage[key] = value);
globalThis.dumpLocalStorage = async () =>
await writeFile(
__dirname + '/__localStorage.json',
JSON.stringify(global.localStorage)
)
globalThis.dumpLocalStorage = async ()=>await writeFile('__localStorage.json', JSON.stringify( global.localStorage))
const app = new App()
const app = new App();
app.io(
repl => process.stdin.on('data', data => repl(data.toString().trim())),
(data, isRepl) => process.stdout.write(`${data}${isRepl ? '\n>' : ''}`),
code => process.exit(code)
repl => process.stdin.on('data', data=>repl(data.toString().trim())),
(data, isRepl) => process.stdout.write(`${data}${isRepl?'\n>':''}`),
code=>process.exit(code)
)
await app.initial()
await app.initial();
}
main()
main();
// process.stdin.setRawMode(true);
// process.openStdin().on('keypress', function (chunk, key) {
// process.stdout.write('Get Chunk: ' + chunk + '\n');
// if (key && key.ctrl && key.name == 'c') process.exit();
// });
// });

View File

@@ -1,4 +1,3 @@
import './ui/laya.patch.js';
import './ui/runtime.js';
import './ui/pluginFunction.js'
import './ui/promisesLaya.js'
@@ -7,31 +6,12 @@ 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) {
case 'github': url = 'https://github.com/VickScarlet/lifeRestart'; break;
case 'discord': url = 'https://discord.gg/U3qrf49NMQ'; 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) {
window.location.href = url;
} else {
window.open(url, '_blank');
}
} catch (error) {
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 +30,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 +47,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 +83,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 +101,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 +111,18 @@ 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');
} else {
message = $_.format(
$lang[message], ...args
);
}
$ui.popup(UI.popups.MESSAGE, { message });
$ui.popup(UI.popups.MESSAGE, {message: $_.format(
$lang[message], ...args
) });
})
}
@@ -159,8 +134,12 @@ class App {
this.#initLaya();
globalThis.$ui = UIManager.getInstance();
if (theme == 'default') {
theme = localStorage.getItem('theme') || 'default';
if(theme=='default') {
if(!localStorage.getItem('__')) {
localStorage.setItem('__', 1);
localStorage.setItem('theme', 'cyber');
}
theme = localStorage.getItem('theme');
}
$ui.theme = theme;
@@ -168,11 +147,10 @@ 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);
}
}

View File

@@ -43,7 +43,7 @@ function parseCondition(condition) {
return conditions;
}
export function checkCondition(property, condition) {
function checkCondition(property, condition) {
const conditions = parseCondition(condition);
return checkParsedConditions(property, conditions);
}
@@ -113,7 +113,7 @@ function checkProp(property, condition) {
}
}
export function extractMaxTriggers(condition) {
function extractMaxTriggers(condition) {
// Assuming only age related talents can be triggered multiple times.
const RE_AGE_CONDITION = /AGE\?\[([0-9\,]+)\]/;
const match_object = RE_AGE_CONDITION.exec(condition);
@@ -124,4 +124,6 @@ export function extractMaxTriggers(condition) {
const age_list = match_object[1].split(",");
return age_list.length;
}
}
export { checkCondition, extractMaxTriggers };

View File

@@ -1,103 +0,0 @@
import { expect, test, describe } from 'vitest'
import { checkCondition } from './condition'
function withProp(prop) {
const p = {
get(key) {
return prop[key]
},
}
return condition => checkCondition(p, condition)
}
describe('condition', () => {
const check = withProp({
n1: 0,
n2: -10,
n3: 10,
nl1: [1, 2, 3],
nl2: [0],
nl3: [],
})
test('gt(>)', () => {
expect(check('n3>11')).toBe(false)
expect(check('n3>10')).toBe(false)
expect(check('n3>9')).toBe(true)
})
test('gte(>=)', () => {
expect(check('n3>=11')).toBe(false)
expect(check('n3>=10')).toBe(true)
expect(check('n3>=9')).toBe(true)
})
test('lt(<)', () => {
expect(check('n3<9')).toBe(false)
expect(check('n3<10')).toBe(false)
expect(check('n3<11')).toBe(true)
})
test('lte(<=)', () => {
expect(check('n3<=9')).toBe(false)
expect(check('n3<=10')).toBe(true)
expect(check('n3<=11')).toBe(true)
})
test('eq(=)', () => {
expect(check('n3=9')).toBe(false)
expect(check('n3=10')).toBe(true)
expect(check('n3=11')).toBe(false)
expect(check('nl1=0')).toBe(false)
expect(check('nl1=1')).toBe(true)
expect(check('nl1=2')).toBe(true)
expect(check('nl1=3')).toBe(true)
})
test('ne(!=)', () => {
expect(check('n3!=9')).toBe(true)
expect(check('n3!=10')).toBe(false)
expect(check('n3!=11')).toBe(true)
expect(check('nl1!=0')).toBe(true)
expect(check('nl1!=1')).toBe(false)
expect(check('nl1!=2')).toBe(false)
expect(check('nl1!=3')).toBe(false)
})
test('in(?)', () => {
expect(check('n3?[1,2,3]')).toBe(false)
expect(check('n3?[10,11,12]')).toBe(true)
expect(check('nl1?[0,1]')).toBe(true)
expect(check('nl2?[1,2,3]')).toBe(false)
expect(check('nl3?[1,2,3]')).toBe(false)
expect(check('nl2?[]')).toBe(false)
expect(check('nl3?[]')).toBe(false)
})
test('notin(!)', () => {
expect(check('n3![1,2,3]')).toBe(true)
expect(check('n3![10,11,12]')).toBe(false)
expect(check('nl1![0,1]')).toBe(false)
expect(check('nl2![1,2,3]')).toBe(true)
expect(check('nl3![1,2,3]')).toBe(true)
expect(check('nl2![]')).toBe(true)
expect(check('nl3![]')).toBe(true)
})
test('and(&)', () => {
expect(check('n1>=0&n2<0')).toBe(true)
expect(check('n2>0&n3>0')).toBe(false)
expect(check('n2<0&n3<0')).toBe(false)
expect(check('n2<0&n3>0')).toBe(true)
expect(check('n1=0&n2<0&n3>0')).toBe(true)
expect(check('n1=0&n2>0&n3>0')).toBe(false)
})
test('or(|)', () => {
expect(check('n1>=0|n2<0')).toBe(true)
expect(check('n2>0|n3>0')).toBe(true)
expect(check('n2<0|n3<0')).toBe(true)
expect(check('n2<0|n3>0')).toBe(true)
expect(check('n2>0|n3<0')).toBe(false)
expect(check('n1=0|n2<0|n3>0')).toBe(true)
expect(check('n1=0|n2>0|n3>0')).toBe(true)
expect(check('n1!=0|n2>0|n3<0')).toBe(false)
})
test('mix', () => {
expect(check('(n1=0|n2<0|n3>0)&(n1=0|n2>0|n3>0)')).toBe(true)
expect(check('(n1=0|n2<0|n3>0)&(n1!=0|n2>0|n3<0)')).toBe(false)
expect(check('n1=0|n2<0|n3>0&n1!=0|n2>0|n3<0')).toBe(true)
expect(check('(n1>0|n1?[-10,0])&(n2>0|n3![0,1])')).toBe(true)
expect(check('(n1>0&n1?[-10,0])|(n2<0&n3![0,1])')).toBe(true)
})
})

View File

@@ -1,7 +1,6 @@
function clone(value) {
switch(typeof value) {
case 'object':
if(value === null) return null;
if(Array.isArray(value)) return value.map(v=>clone(v));
const newObj = {};
for(const key in value) newObj[key] = clone(value[key]);
@@ -84,17 +83,10 @@ function deepMapSet(target, source) {
return target;
}
function deepGet(obj, path) {
for(const key of path.split('.')) {
if(!(key in obj)) return undefined;
obj = obj[key];
}
return obj;
}
function format(str, ...args) {
const replace = set => (match, key) => {
const value = deepGet(set, key);
const value = set[key];
switch(typeof value) {
case 'object': return JSON.stringify(value);
case 'boolean':

View File

@@ -27,11 +27,10 @@ export default ({
UI_Title_Remake: 'Remake Simulate',
UI_Title_Subsequent: 'The rubbish life doesn\'t want to stay for a second',
UI_Remake: 'Remake Now',
UI_Remake: 'Remake Now',
UI_Thanks: 'Thx',
UI_Achievement: 'Achv',
UI_Cyber_Theme_Art_Design: 'UI Design by 晰晰',
UI_Banner: '作者的新作《纸上谈亲》已上线小程序\n微信/抖音搜索“纸上谈亲”即可游玩~',
UI_Title_Talent: 'Talent Draw',
UI_Talent_Draw: '!10 Pulls!',
@@ -126,31 +125,17 @@ export default ({
UI_Write: 'Paste',
UI_CopySuccess: 'Copy to clipboard success',
UI_CopyFailed: 'Copy to clipboard Failed',
UI_CopyFaild: 'Copy to clipboard faild',
UI_PasteSuccessDecodeSuccess: 'Load Success!',
UI_PasteSuccessDecodeFailed: 'Paste success, but load Failed!',
UI_PasteFailedDecodeSuccess: 'Paste Failed, use input load success!',
UI_PasteFailedDecodeFailed: 'Paste Failed, use input load Failed!',
UI_PasteSuccessDecodeFaild: 'Paste success, but load faild!',
UI_PasteFaildDecodeSuccess: 'Paste faild, use input load success!',
UI_PasteFaildDecodeFaild: 'Paste faild, use input load faild!',
UI_LoadSuccess: 'Load Success!',
UI_LoadFailed: 'Load Failed!',
UI_Title_Celebrity: 'Past life was...',
UI_CustomMode: 'Custom',
UI_CustomModeDescription: '10 Talent\nCustom property',
UI_CelebrityMode: 'Celebrity',
UI_CelebrityModeDescription: 'Past life is celebrity\nRebirth to modern',
UI_AllNot: '↻All Not',
UI_UniqueWaTaShi: 'Unique of mine',
UI_UniqueWaTaShiContent: '\nUnique character card different from other 60 million player\nAll property, All talent, All random\nAll has only one chance',
UI_GenerateNow: 'Generate Now',
UI_LoadFaild: 'Load Faild!',
M_NoRank: 'There is no rank',
M_PleaseSelectOne: 'Please Select One',
M_UnGenerate: 'Unique Character no generate',
M_DisableExtendTalent: 'Celebrity mode can\'t extends talent',
F_RemakeTimes: 'Remake {0} Times',
F_AchievementCount: 'Achievement {0}',
@@ -158,7 +143,5 @@ export default ({
F_TalentConflict: 'Conflict with talent ({0})',
F_TalentSelectLimit: 'Talent select limit {0}',
F_TalentSelectNotComplect: 'Please select {0} talent',
F_PropertyPointLeft: 'You have left {0} property point',
F_TalentReplace: 'Talent replace [{source.name}] -> [{target.name}]',
F_PropertyStr: 'CHR{CHR} INT{INT} STR{STR} MNY{MNY}'
F_PropertyPointLeft: 'You have left {0} property point'
});

View File

@@ -15,8 +15,6 @@ export default ({
UI_Loading: '加载中...',
UI_Error: '错误',
UI_BackupBtn: '上面没有效果就试试这个吧',
UI_Colon: '',
UI_Times: '次',
UI_Count: '个',
@@ -29,11 +27,10 @@ export default ({
UI_Title_Remake: '人生重开模拟器',
UI_Title_Subsequent: '这垃圾人生一秒也不想待了',
UI_Remake: '立即重开',
UI_Remake: '立即重开',
UI_Thanks: '感谢',
UI_Achievement: '成就',
UI_Cyber_Theme_Art_Design: 'UI 设计 by 晰晰',
UI_Banner: '作者的新作《纸上谈亲》已上线小程序\n微信/抖音搜索“纸上谈亲”即可游玩~',
UI_Title_Talent: '天赋抽卡',
UI_Talent_Draw: '10连抽',
@@ -128,30 +125,17 @@ export default ({
UI_Write: '粘贴',
UI_LoadSuccess: '读档成功!',
UI_LoadFailed: '读档失败!',
UI_LoadFaild: '读档失败!',
UI_CopySuccess: '成功复制存档到剪贴板',
UI_CopyFailed: '复制存档到剪贴板失败,请手动复制存档内容',
UI_CopyFaild: '复制存档到剪贴板失败,请手动复制存档内容',
UI_PasteSuccessDecodeSuccess: '读档成功!',
UI_PasteSuccessDecodeFailed: '粘贴剪贴板存档内容成功,但剪贴板内容读档失败',
UI_PasteFailedDecodeSuccess: '粘贴剪贴板存档内容失败,使用输入的内容读档成功',
UI_PasteFailedDecodeFailed: '粘贴剪贴板存档内容失败,使用输入的内容读档失败',
UI_Title_Celebrity: '你的前世是...',
UI_CustomMode: '经典模式',
UI_CustomModeDescription: '10连抽天赋\n自由分配属性',
UI_CelebrityMode: '名人模式',
UI_CelebrityModeDescription: '前世是古代名人\n重开到了现代',
UI_AllNot: '↻都不是',
UI_UniqueWaTaShi: '独一无二的我',
UI_UniqueWaTaShiContent: '\n6000万玩家中独一无二的角色卡\n所有属性 所有天赋 随机生成\n 每人只能生成一次',
UI_GenerateNow: '立即生成',
UI_PasteSuccessDecodeFaild: '粘贴剪贴板存档内容成功,但剪贴板内容读档失败',
UI_PasteFaildDecodeSuccess: '粘贴剪贴板存档内容失败,使用输入的内容读档成功',
UI_PasteFaildDecodeFaild: '粘贴剪贴板存档内容失败,使用输入的内容读档失败',
M_NoRank: '别卷了,没有排行榜',
M_PleaseSelectOne: '请选择一个名人',
M_UnGenerate: '独一无二的我还没有生成',
M_DisableExtendTalent: '名人模式不能继承天赋',
F_RemakeTimes: '已重开{0}次',
F_AchievementCount: '成就达成{0}个',
@@ -159,7 +143,5 @@ export default ({
F_TalentConflict: '与已选的「{0}」天赋冲突',
F_TalentSelectLimit: '只能选 {0} 个天赋',
F_TalentSelectNotComplect: '要选满{0}个天赋',
F_PropertyPointLeft: '你还有 {0} 属性点没有分配完',
F_TalentReplace: '天赋替换【{source.name}】->【{target.name}】',
F_PropertyStr: '颜值{CHR} 智力{INT} 体质{STR} 家境{MNY}'
F_PropertyPointLeft: '你还有 {0} 属性点没有分配完'
});

View File

@@ -1,6 +1,21 @@
import App from './app.js';
import Life from './modules/life.js';
globalThis.goto = async tag => {
let url;
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_ddf': url = 'https://dun.mianbaoduo.com/@vickscarlet'; break;
}
try {
window.open(url, '_blank');
} catch (error) {
console.error(error);
}
}
globalThis.$$eventMap = new Map();
globalThis.$$event = (tag, data) => {
const listener = $$eventMap.get(tag);
@@ -196,29 +211,5 @@ core.config({
],
},
},
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);

View File

@@ -1,7 +1,8 @@
import { clone } from '../functions/util.js';
import { checkCondition } from '../functions/condition.js';
class Achievement {
constructor(system) {
this.#system = system;
}
constructor() {}
// 时机
Opportunity = {
@@ -11,7 +12,6 @@ class Achievement {
END: "END", // 游戏完成,点击重开 重开次数在这之后才会+1
};
#system;
#achievements;
initial({achievements}) {
@@ -23,11 +23,7 @@ class Achievement {
return Object.keys(this.#achievements).length;
}
get #prop() {
return this.#system.request(this.#system.Module.PROPERTY);
}
list() {
list(property) {
return Object
.values(this.#achievements)
.map(({
@@ -36,34 +32,34 @@ class Achievement {
})=>({
id, name, opportunity,
description, hide, grade,
isAchieved: this.isAchieved(id, this.#prop),
isAchieved: this.isAchieved(id, property),
}));
}
get(achievementId) {
const achievement = this.#achievements[achievementId];
if(!achievement) throw new Error(`[ERROR] No Achievement[${achievementId}]`);
return this.#system.clone(achievement);
return clone(achievement);
}
check(achievementId) {
check(achievementId, property) {
const { condition } = this.get(achievementId);
return this.#system.check(condition);
return checkCondition(property, condition);
}
isAchieved(achievementId) {
for(const [achieved] of (this.#prop.get(this.#prop.TYPES.ACHV)||[]))
isAchieved(achievementId, property) {
for(const [achieved] of (property.get(property.TYPES.ACHV)||[]))
if(achieved == achievementId) return true;
return false;
}
achieve(opportunity) {
this.list()
achieve(opportunity, property) {
this.list(property)
.filter(({isAchieved})=>!isAchieved)
.filter(({opportunity: o})=>o==opportunity)
.filter(({id})=>this.check(id, this.#prop))
.filter(({id})=>this.check(id, property))
.forEach(({id})=>{
this.#prop.achieve(this.#prop.TYPES.ACHV, id)
property.achieve(property.TYPES.ACHV, id)
$$event('achievement', this.get(id))
});
}

View File

@@ -1,134 +0,0 @@
class Character {
constructor(system) {
this.#system = system;
}
#system;
#characters;
#characterPullCount;
#rateableKnife;
#rate;
#pipe = [];
#uniqueWaTaShi;
#propertyWeight;
#talentWeight
initial({characters}) {
this.#characters = characters;
const uniqueWaTaShi = localStorage.getItem('uniqueWaTaShi');
if(uniqueWaTaShi != null || uniqueWaTaShi != 'undefined')
this.#uniqueWaTaShi = JSON.parse(uniqueWaTaShi);
return this.count;
}
get count() {
return Object.keys(this.#characters).length;
}
config({
characterPullCount = 3,
rateableKnife = 10,
propertyWeight,
talentWeight,
} = {}) {
this.#characterPullCount = characterPullCount;
this.#rateableKnife = rateableKnife;
this.#propertyWeight = propertyWeight;
this.#talentWeight = talentWeight;
}
get #unique() {
if(this.#uniqueWaTaShi) {
return this.#system.clone(this.#uniqueWaTaShi);
}
const now = Date.now();
this.#pipe.push(now);
if(this.#pipe.length < 10) return null;
const time = this.#pipe.shift();
if(now - time > 10000) return null;
return {unique: true, generate: false};
}
set #unique(data) {
this.#uniqueWaTaShi = this.#system.clone(data);
this.#uniqueWaTaShi.unique = true;
this.#uniqueWaTaShi.generate = true;
localStorage.setItem(
'uniqueWaTaShi',
JSON.stringify(this.#uniqueWaTaShi)
);
}
get #weightRandom() {
return this.#system.function(this.#system.Function.UTIL).weightRandom;
}
generateUnique() {
if(this.#uniqueWaTaShi) return this.#unique;
const weightRandom = this.#weightRandom;
const {CHR, INT, STR, MNY} = this.#system.PropertyTypes;
this.#unique = {
property: {
[CHR]: weightRandom(this.#propertyWeight),
[INT]: weightRandom(this.#propertyWeight),
[STR]: weightRandom(this.#propertyWeight),
[MNY]: weightRandom(this.#propertyWeight),
},
talent: this.#system
.request(this.#system.Module.TALENT)
.random(weightRandom(this.#talentWeight)),
}
return this.#unique;
}
random() {
return {
unique: this.#unique,
normal: this.#rateable(),
}
}
#rateable() {
if(!this.#rate) {
this.#rate = {};
for(const id in this.#characters) {
this.#rate[id] = 1;
}
}
const r = [];
const weightRandom = this.#weightRandom;
new Array(this.#characterPullCount)
.fill(0)
.forEach(()=>{
r.push(
weightRandom(Object
.keys(this.#rate)
.filter(id=>!r.includes(id))
.map(id=>([id,this.#rate[id]]))
)
)
});
let min = Infinity;
for(const id in this.#rate) {
if(r.includes(id)) {
min = Math.min(min, this.#rate[id]);
continue;
}
min = Math.min(min, ++ this.#rate[id]);
}
if(min > this.#rateableKnife) {
for(const id in this.#rate) {
this.#rate[id] -= this.#rateableKnife;
}
}
return r.map(id=>this.#system.clone(this.#characters[id]));
}
}
export default Character;

View File

@@ -1,9 +1,9 @@
class Event {
constructor(system) {
this.#system = system;
}
import { clone } from '../functions/util.js';
import { checkCondition } from '../functions/condition.js';
class Event {
constructor() {}
#system;
#events;
initial({events}) {
@@ -24,18 +24,18 @@ class Event {
return Object.keys(this.#events).length;
}
check(eventId) {
check(eventId, property) {
const { include, exclude, NoRandom } = this.get(eventId);
if(NoRandom) return false;
if(exclude && this.#system.check(exclude)) return false;
if(include) return this.#system.check(include);
if(exclude && checkCondition(property, exclude)) return false;
if(include) return checkCondition(property, include);
return true;
}
get(eventId) {
const event = this.#events[eventId];
if(!event) throw new Error(`[ERROR] No Event[${eventId}]`);
return this.#system.clone(event);
return clone(event);
}
information(eventId) {
@@ -43,13 +43,13 @@ class Event {
return { description };
}
do(eventId) {
const { effect, branch, event: description, postEvent, grade } = this.get(eventId);
do(eventId, property) {
const { effect, branch, event: description, postEvent } = this.get(eventId);
if(branch)
for(const [cond, next] of branch)
if(this.#system.check(cond))
return { effect, next, description, grade };
return { effect, postEvent, description, grade };
if(checkCondition(property, cond))
return { effect, next, description };
return { effect, postEvent, description };
}
}

View File

@@ -1,65 +1,45 @@
import * as util from '../functions/util.js';
import * as fCondition from '../functions/condition.js';
import { clone, weightRandom, getListValuesMap, getConvertedMap } from '../functions/util.js'
import Property from './property.js';
import Event from './event.js';
import Talent from './talent.js';
import Achievement from './achievement.js';
import Character from './character.js';
class Life {
constructor() {
this.#property = new Property(this);
this.#event = new Event(this);
this.#talent = new Talent(this);
this.#achievement = new Achievement(this);
this.#character = new Character(this);
}
Module = {
PROPERTY: 'PROPERTY',
TALENT: 'TALENT',
EVENT: 'EVENT',
ACHIEVEMENT: 'ACHIEVEMENT',
CHARACTER: 'CHARACTER',
}
Function = {
CONDITION: 'CONDITION',
UTIL: 'UTIL',
this.#property = new Property();
this.#event = new Event();
this.#talent = new Talent();
this.#achievement = new Achievement();
}
#property;
#event;
#talent;
#achievement;
#character;
#triggerTalents;
#defaultPropertyPoints;
#talentSelectLimit;
#propertyAllocateLimit;
#defaultPropertys;
#specialThanks;
#initialData;
async initial(i18nLoad, commonLoad) {
const [age, talents, events, achievements, characters, specialThanks] = await Promise.all([
const [age, talents, events, achievements, specialThanks] = await Promise.all([
i18nLoad('age'),
i18nLoad('talents'),
i18nLoad('events'),
i18nLoad('achievement'),
i18nLoad('character'),
commonLoad('specialthanks'),
]);
this.#specialThanks = specialThanks;
const total = {
[this.PropertyTypes.TACHV]: this.#achievement.initial({achievements}),
[this.PropertyTypes.TACEV]: this.#achievement.initial({achievements}),
[this.PropertyTypes.TEVT]: this.#event.initial({events}),
[this.PropertyTypes.TTLT]: this.#talent.initial({talents}),
};
this.#property.initial({age, total});
this.#character.initial({characters});
}
config({
@@ -69,7 +49,6 @@ class Life {
defaultPropertys = {}, // default propertys
talentConfig, // config for talent
propertyConfig, // config for property
characterConfig, // config for character
} = {}) {
this.#defaultPropertyPoints = defaultPropertyPoints;
this.#talentSelectLimit = talentSelectLimit;
@@ -77,54 +56,27 @@ class Life {
this.#defaultPropertys = defaultPropertys;
this.#talent.config(talentConfig);
this.#property.config(propertyConfig);
this.#character.config(characterConfig);
}
request(module) {
switch (module) {
case this.Module.ACHIEVEMENT: return this.#achievement;
case this.Module.CHARACTER: return this.#character;
case this.Module.EVENT: return this.#event;
case this.Module.PROPERTY: return this.#property;
case this.Module.TALENT: return this.#talent;
default: return null;
}
}
function(type) {
switch (type) {
case this.Function.CONDITION: return fCondition;
case this.Function.UTIL: return util;
}
}
check(condition) {
return fCondition.checkCondition(this.#property,condition);
}
clone(...args) {
return util.clone(...args);
}
remake(talents) {
this.#initialData = util.clone(this.#defaultPropertys);
this.#initialData.TLT = util.clone(talents);
this.#triggerTalents = {};
return this.talentReplace(this.#initialData.TLT);
}
start(allocation) {
restart(allocation) {
const propertys = clone(this.#defaultPropertys);
for(const key in allocation) {
this.#initialData[key] = util.clone(allocation[key]);
propertys[key] = clone(allocation[key]);
}
this.#property.restart(this.#initialData);
this.#triggerTalents = {};
const contents = this.talentReplace(propertys.TLT);
this.#property.restart(propertys);
this.doTalent()
this.#property.restartLastStep();
this.#achievement.achieve(this.AchievementOpportunity.START);
this.#achievement.achieve(
this.AchievementOpportunity.START,
this.#property
)
return contents;
}
getPropertyPoints() {
return this.#defaultPropertyPoints + this.#talent.allocationAddition(this.#initialData.TLT);
getPropertyPoints(selectedTalentIds) {
return this.#defaultPropertyPoints + this.#talent.allocationAddition(selectedTalentIds);
}
getTalentCurrentTriggerCount(talentId) {
@@ -140,7 +92,10 @@ class Life {
const isEnd = this.#property.isEnd();
const content = [talentContent, eventContent].flat();
this.#achievement.achieve(this.AchievementOpportunity.TRAJECTORY);
this.#achievement.achieve(
this.AchievementOpportunity.TRAJECTORY,
this.#property
)
return { age, content, isEnd };
}
@@ -166,7 +121,7 @@ class Life {
const contents = [];
for(const talentId of talents) {
const result = this.#talent.do(talentId);
const result = this.#talent.do(talentId, this.#property);
if(!result) continue;
this.#triggerTalents[talentId] = this.getTalentCurrentTriggerCount(talentId) + 1;
const { effect, name, description, grade } = result;
@@ -183,21 +138,20 @@ class Life {
}
doEvent(eventId) {
const { effect, next, description, postEvent, grade } = this.#event.do(eventId);
const { effect, next, description, postEvent } = this.#event.do(eventId, this.#property);
this.#property.change(this.PropertyTypes.EVT, eventId);
this.#property.effect(effect);
const content = {
type: this.PropertyTypes.EVT,
description,
postEvent,
grade,
}
if(next) return [content, this.doEvent(next)].flat();
return [content];
}
random(events) {
return util.weightRandom(
return weightRandom(
events.filter(
([eventId])=>this.#event.check(eventId, this.#property)
)
@@ -214,35 +168,20 @@ class Life {
);
}
characterRandom() {
const characters = this.#character.random();
const replaceTalent = v=>v.talent=v.talent.map(
id=>this.#talent.get(id)
);
characters.normal.forEach(replaceTalent);
if(characters.unique && characters.unique.talent)
replaceTalent(characters.unique);
return characters;
}
talentExtend(talentId) {
this.#property.set(this.PropertyTypes.EXT, talentId);
}
exclude(talents, exclusive) {
return this.#talent.exclude(talents, exclusive);
}
generateUnique() {
this.#character.generateUnique();
exclusive(talents, exclusive) {
return this.#talent.exclusive(talents, exclusive);
}
#getJudges(...types) {
return util.getListValuesMap(types.flat(), key => this.#property.judge(key));
return getListValuesMap(types.flat(), key => this.#property.judge(key));
}
#getPropertys(...types) {
return util.getListValuesMap(types.flat(), key => this.#property.get(key));
return getListValuesMap(types.flat(), key => this.#property.get(key));
}
get lastExtendTalent() {
@@ -250,7 +189,10 @@ class Life {
}
get summary() {
this.#achievement.achieve(this.AchievementOpportunity.SUMMARY);
this.#achievement.achieve(
this.AchievementOpportunity.SUMMARY,
this.#property
)
const pt = this.PropertyTypes;
@@ -296,13 +238,16 @@ class Life {
get PropertyTypes() { return this.#property.TYPES; }
get AchievementOpportunity() { return this.#achievement.Opportunity; }
get talentSelectLimit() { return this.#talentSelectLimit; }
get propertyAllocateLimit() { return util.clone(this.#propertyAllocateLimit); }
get propertyAllocateLimit() { return clone(this.#propertyAllocateLimit); }
get propertys() { return this.#property.getPropertys(); }
get times() { return this.#property.get(this.PropertyTypes.TMS) || 0; }
set times(v) {
this.#property.set(this.PropertyTypes.TMS, v);
this.#achievement.achieve(this.AchievementOpportunity.END);
this.#achievement.achieve(
this.AchievementOpportunity.END,
this.#property
)
}
get specialThanks() { return this.#specialThanks; }
}

View File

@@ -1,7 +1,7 @@
import { max, min, sum, clone, listRandom } from '../functions/util.js';
class Property {
constructor(system) {
this.#system = system;
}
constructor() {}
TYPES = {
// 本局
@@ -70,16 +70,11 @@ class Property {
]
}
#system;
#ageData;
#data = {};
#total;
#judge;
get #util() {
return this.#system.function(this.#system.Function.UTIL);
}
initial({age, total}) {
this.#ageData = age;
for(const a in age) {
@@ -156,7 +151,6 @@ class Property {
}
get(prop) {
const util = this.#util;
switch(prop) {
case this.TYPES.AGE:
case this.TYPES.CHR:
@@ -167,14 +161,14 @@ class Property {
case this.TYPES.LIF:
case this.TYPES.TLT:
case this.TYPES.EVT:
return util.clone(this.#data[prop]);
return clone(this.#data[prop]);
case this.TYPES.LAGE:
case this.TYPES.LCHR:
case this.TYPES.LINT:
case this.TYPES.LSTR:
case this.TYPES.LMNY:
case this.TYPES.LSPR:
return util.min(
return min(
this.#data[prop],
this.get(this.fallback(prop))
);
@@ -184,7 +178,7 @@ class Property {
case this.TYPES.HSTR:
case this.TYPES.HMNY:
case this.TYPES.HSPR:
return util.max(
return max(
this.#data[prop],
this.get(this.fallback(prop))
);
@@ -195,7 +189,7 @@ class Property {
const HSTR = this.get(this.TYPES.HSTR);
const HMNY = this.get(this.TYPES.HMNY);
const HSPR = this.get(this.TYPES.HSPR);
return Math.floor(util.sum(HCHR, HINT, HSTR, HMNY, HSPR)*2 + HAGE/2);
return Math.floor(sum(HCHR, HINT, HSTR, HMNY, HSPR)*2 + HAGE/2);
case this.TYPES.TMS:
return this.lsget('times') || 0;
case this.TYPES.EXT:
@@ -259,7 +253,7 @@ class Property {
case this.TYPES.LIF:
case this.TYPES.TLT:
case this.TYPES.EVT:
this.hl(prop, this.#data[prop] = this.#system.clone(value));
this.hl(prop, this.#data[prop] = clone(value));
this.achieve(prop, value);
return;
case this.TYPES.TMS:
@@ -273,7 +267,7 @@ class Property {
}
getPropertys() {
return this.#system.clone({
return clone({
[this.TYPES.AGE]: this.get(this.TYPES.AGE),
[this.TYPES.CHR]: this.get(this.TYPES.CHR),
[this.TYPES.INT]: this.get(this.TYPES.INT),
@@ -321,8 +315,7 @@ class Property {
hookSpecial(prop) {
switch(prop) {
case this.TYPES.RDM:
return this.#util.listRandom(this.SPECIAL.RDM);
case this.TYPES.RDM: return listRandom(this.SPECIAL.RDM);
default: return prop;
}
}
@@ -341,6 +334,15 @@ class Property {
const d = this.#judge[prop];
let length = d.length;
// progress judge
// const p = 1/length;
// const progress = () => {
// const min = d[length][0] || 0;
// const max = d[length+1]?.[0] || value;
// if(max == min) return 1;
// return p * (length + (value - min) / (max - min));
// }
const progress = () => Math.max(Math.min(value, 10), 0) / 10;
while(length--) {
@@ -361,7 +363,7 @@ class Property {
}
getAgeData(age) {
return this.#system.clone(this.#ageData[age]);
return clone(this.#ageData[age]);
}
hl(prop, value) {
@@ -376,8 +378,8 @@ class Property {
default: return;
}
const [l, h] = keys;
this.#data[l] = this.#util.min(this.#data[l], value);
this.#data[h] = this.#util.max(this.#data[h], value);
this.#data[l] = min(this.#data[l], value);
this.#data[h] = max(this.#data[h], value);
}
achieve(prop, newData) {
@@ -409,7 +411,7 @@ class Property {
lsget(key) {
const data = localStorage.getItem(key);
if(data === null || data === 'undefined') return;
if(data === null) return;
return JSON.parse(data);
}

View File

@@ -1,9 +1,9 @@
class Talent {
constructor(system) {
this.#system = system;
}
import { clone, weightRandom } from '../functions/util.js';
import { checkCondition, extractMaxTriggers } from '../functions/condition.js';
class Talent {
constructor() {}
#system;
#talents;
#talentPullCount;
#talentRate;
@@ -11,12 +11,11 @@ class Talent {
initial({talents}) {
this.#talents = talents;
const emt = this.#system.function(this.#system.Function.CONDITION).extractMaxTriggers;
for(const id in talents) {
const talent = talents[id];
talent.id= Number(id);
talent.grade = Number(talent.grade);
talent.max_triggers = emt(talent.condition);
talent.max_triggers = extractMaxTriggers(talent.condition);
if(talent.replacement) {
for(let key in talent.replacement) {
const obj = {};
@@ -35,10 +34,6 @@ class Talent {
return Object.keys(this.#talents).length;
}
get #prop() {
return this.#system.request(this.#system.Module.PROPERTY);
}
config({
talentPullCount = 10, // number of talents to pull from the talent pool
talentRate = { 1:100, 2:10, 3:1, total: 1000 }, // rate of talent pull
@@ -50,15 +45,15 @@ class Talent {
}
check(talentId) {
check(talentId, property) {
const { condition } = this.get(talentId);
return this.#system.check(this.#prop, condition);
return checkCondition(property, condition);
}
get(talentId) {
const talent = this.#talents[talentId];
if(!talent) throw new Error(`[ERROR] No Talent[${talentId}]`);
return this.#system.clone(talent);
return clone(talent);
}
information(talentId) {
@@ -66,11 +61,11 @@ class Talent {
return { grade, name, description };
}
exclude(talents, excludeId) {
const { exclude } = this.get(excludeId);
if(!exclude) return null;
for(const talent of talents) {
for(const e of exclude) {
exclusive(talends, exclusiveId) {
const { exclusive } = this.get(exclusiveId);
if(!exclusive) return null;
for(const talent of talends) {
for(const e of exclusive) {
if(talent == e) return talent;
}
}
@@ -86,7 +81,7 @@ class Talent {
}
getRate(additionValues = {}) {
const rate = this.#system.clone(this.#talentRate);
const rate = clone(this.#talentRate);
const addition = { 1:1, 2:1, 3:1, };
Object.keys(additionValues).forEach(key => {
@@ -108,14 +103,13 @@ class Talent {
let randomNumber = Math.floor(Math.random() * rate.total);
if((randomNumber -= rate[3]) < 0) return 3;
if((randomNumber -= rate[2]) < 0) return 2;
if((randomNumber - rate[1]) < 0) return 1;
if((randomNumber -= rate[1]) < 0) return 1;
return 0;
}
const talentList = {};
for(const talentId in this.#talents) {
const { id, grade, name, description, exclusive } = this.#talents[talentId];
if(!!exclusive) continue;
const { id, grade, name, description } = this.#talents[talentId];
if(id == include) {
include = { grade, name, description, id };
continue;
@@ -136,19 +130,6 @@ class Talent {
});
}
random(count) {
const talents = Object
.keys(this.#talents)
.filter(id=>!this.#talents[id].exclusive);
return new Array(count)
.fill(1)
.map(()=>talents.splice(
Math.floor(Math.random()*talents.length)%talents.length,
1
)[0]
);
}
allocationAddition(talents) {
if(Array.isArray(talents)) {
let addition = 0;
@@ -159,9 +140,9 @@ class Talent {
return Number(this.get(talents).status) || 0;
}
do(talentId) {
do(talentId, property) {
const { effect, condition, grade, name, description } = this.get(talentId);
if(condition && !this.#system.check(condition))
if(condition && !checkCondition(property, condition))
return null;
return { effect, grade, name, description };
}
@@ -172,34 +153,32 @@ class Talent {
if(!replacement) return null;
const list = [];
if(replacement.grade) {
this.forEach(({id, grade, exclusive})=>{
if(exclusive) return;
this.forEach(({id, grade})=>{
if(!replacement.grade[grade]) return;
if(this.exclude(talents, id)) return;
if(this.exclusive(talents, id)) return;
list.push([id, replacement.grade[grade]]);
})
}
if(replacement.talent) {
for(let id in replacement.talent) {
id = Number(id);
if(this.exclude(talents, id)) continue;
if(this.exclusive(talents, id)) continue;
list.push([id, replacement.talent[id]]);
}
}
return list;
}
const wr = this.#system.function(this.#system.Function.UTIL).weightRandom;
const replace = (talent, talents) => {
const replaceList = getReplaceList(talent, talents);
if(!replaceList) return talent;
const rand = wr(replaceList);
const rand = weightRandom(replaceList);
return replace(
rand, talents.concat(rand)
);
}
const newTalents = this.#system.clone(talents);
const newTalents = clone(talents);
const result = {};
for(const talent of talents) {
const replaceId = replace(talent, newTalents);
@@ -214,7 +193,7 @@ class Talent {
forEach(callback) {
if(typeof callback != 'function') return;
for(const id in this.#talents)
callback(this.#system.clone(this.#talents[id]), id);
callback(clone(this.#talents[id]), id);
}
}

View File

@@ -1,47 +0,0 @@
// 滚动条太灵敏
const SCROLL_START_DISTANCE = 30;
Laya.ScrollBar.prototype.loop=function(){
var mouseY=Laya.stage.mouseY;
var mouseX=Laya.stage.mouseX;
this._lastOffset=this.isVertical ? (mouseY-this._lastPoint.y):(mouseX-this._lastPoint.x);
if (this._clickOnly){
if (Math.abs(this._lastOffset *(this.isVertical ? Laya.stage._canvasTransform.getScaleY():Laya.stage._canvasTransform.getScaleX()))> SCROLL_START_DISTANCE){
this._clickOnly=false;
this._offsets || (this._offsets=[]);
this._offsets.length=0;
this._target.mouseEnabled=false;
if (!this.hide && this.autoHide){
this.alpha=1;
this.visible=true;
}
this.event(/*laya.events.Event.START*/"start");
}else return;
}
this._offsets.push(this._lastOffset);
this._lastPoint.x=mouseX;
this._lastPoint.y=mouseY;
if (this._lastOffset===0)return;
if (!this._checkElastic){
if (this.elasticDistance > 0){
if (!this._checkElastic && this._lastOffset !=0){
if ((this._lastOffset > 0 && this._value <=this.min)|| (this._lastOffset < 0 && this._value >=this.max)){
this._isElastic=true;
this._checkElastic=true;
}else {
this._isElastic=false;
}
}
}else {
this._checkElastic=true;
}
}
if (this._isElastic){
if (this._value <=this.min){
this.value-=this._lastOffset *Math.max(0,(1-((this.min-this._value)/ this.elasticDistance)));
}else if (this._value >=this.max){
this.value-=this._lastOffset *Math.max(0,(1-((this._value-this.max)/ this.elasticDistance)));
}
}else {
this.value-=this._lastOffset;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -475,12 +475,6 @@ class ColorfulBox extends Laya.Box {
label.text = value;
}
get cacheAs() {return super.cacheAs;}
set cacheAs(value) {
if(value=='bitmap') debugger;
super.cacheAs = value;
}
}
runtime.BlankBox =
@@ -540,32 +534,4 @@ class BlankBox extends Laya.Box {
super.height = value;
this.#draw();
}
}
runtime.ColorAgentLabel =
class ColorAgentLabel extends Laya.Label {
constructor(...args) {
super(...args);
}
get #brothers() {
const brothers = [];
if(!this.parent) return brothers;
const deepFind = p => {
if(!p._childs) return;
for(const c of p._childs) {
if(c == this) continue;
if(c instanceof Laya.Label) brothers.push(c);
deepFind(c);
}
}
deepFind(this.parent);
return brothers;
}
get color() {return this.super.color;}
set color(c) {
super.color = c;
this.#brothers.forEach(b=>b.color=c);
}
}

View File

@@ -1,136 +0,0 @@
export default class CyberCelebrity extends ui.view.CyberTheme.CelebrityUI {
constructor() {
super();
this.btnRetry.on(Laya.Event.CLICK, this, ()=>this.random());
this.btnNext.on(Laya.Event.CLICK, this, this.next);
this.panelCharacter.vScrollBar.elasticDistance = 150;
}
#selected;
static #createComponent = Laya.plugin.extractComponents(CyberCelebrity.uiView, ['boxCharacter','boxTalent','boxUniqueUnGenerate']);
#createCharacterItem(dataSource, click) {
const {name, property, talent} = dataSource;
const item = CyberCelebrity.#createComponent('boxCharacter');
const vboxStates = item.getChildByName('vboxStates');
const boxName = item.getChildByName('boxName');
boxName.getChildByName('label').text = name;
const p = $_.clone(property);
for(const k in p)
if(Math.abs(p[k] - Math.PI) < 0.0000001)
p[k] = 'π';
vboxStates.getChildByName('label').text = $_.format($lang.F_PropertyStr, p);
for(const t of talent) {
const i = CyberCelebrity.#createComponent('boxTalent');
i.getChildByName('label').text = $_.format($lang.F_TalentSelection, t);
i.y = vboxStates.height+vboxStates.space;
let g = i.getChildByName(`grade${t.grade}`);
if(g) g.visible = true;
vboxStates.addChild(i);
}
const box = new Laya.Box();
box.height = vboxStates.space;
box.y = vboxStates.height;
vboxStates.addChild(box);
vboxStates.scaleY = 0;
item.dataSource = dataSource;
item.switch = showDetails => vboxStates.scaleY = !!showDetails?1:0;
item.click = (cb, caller) => {
boxName.offAll(Laya.Event.CLICK);
boxName.on(Laya.Event.CLICK, caller || this, cb);
}
if(click) item.click(click);
return item;
}
#createUniqueUnGenerateItem(generate) {
const item = CyberCelebrity.#createComponent('boxUniqueUnGenerate');
const boxName = item.getChildByName('boxName');
const vboxStates = item.getChildByName('vboxStates');
const label = vboxStates.getChildByName('label');
const boxBtn = vboxStates.getChildByName('boxBtn');
const btn = boxBtn.getChildByName('btn');
label.event(Laya.Event.RESIZE);
vboxStates.scaleY = 0;
item.dataSource = false;
item.switch = showDetails => vboxStates.scaleY = !!showDetails?1:0;
item.click = (cb, caller) => {
boxName.offAll(Laya.Event.CLICK);
boxName.on(Laya.Event.CLICK, caller || this, cb);
}
item.generate = (cb, caller) => {
btn.offAll(Laya.Event.CLICK);
btn.on(Laya.Event.CLICK, caller || this, cb);
}
if(generate) item.generate(generate);
return item;
}
init() {
this.random();
}
close() {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
}
random(g) {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
const {unique, normal} = core.characterRandom();
const items = [];
const uniqueItem = this.generateUnique(unique, ()=>{
core.generateUnique();
this.random(normal);
});
if(uniqueItem) items.push(uniqueItem);
(g||normal).forEach(character => items.push(this.#createCharacterItem(character)));
items.forEach((item, i) => {
item.y = i;
this.vboxCharacter.addChild(item);
item.click(()=>{
if(this.#selected) this.#selected.switch(false);
this.#selected = item;
item.switch(true);
item.event(Laya.Event.RESIZE);
})
});
if(g&&uniqueItem) {
this.#selected = uniqueItem;
uniqueItem.switch(true);
uniqueItem.event(Laya.Event.RESIZE);
}
}
generateUnique(data, generate) {
if(!data) return null;
if(!data.generate) return this.#createUniqueUnGenerateItem(generate);
data.name = $lang.UI_UniqueWaTaShi;
return this.#createCharacterItem(data);
}
next() {
if(!this.#selected) return $$event('message', ['M_PleaseSelectOne']);
if(!this.#selected.dataSource) return $$event('message', ['M_UnGenerate']);
const {property: propertyAllocate, talent: talents} = this.#selected.dataSource;
const replace = core.remake(talents.map(talent => talent.id));
if(replace.length > 0) {
$$event('message', [replace.map(v => ['F_TalentReplace', v])]);
}
$ui.switchView(
UI.pages.TRAJECTORY,
{
propertyAllocate, talents,
enableExtend: false,
}
);
}
}

View File

@@ -1,7 +1,7 @@
export default class CyberMain extends ui.view.CyberTheme.CyberMainUI {
constructor() {
super();
this.btnRemake.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.MODE));
this.btnRemake.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.TALENT));
this.btnAchievement.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.ACHIEVEMENT));
this.btnThanks.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.THANKS));
this.btnGithub.on(Laya.Event.CLICK, this, goto, ['github']);
@@ -30,7 +30,6 @@ export default class CyberMain extends ui.view.CyberTheme.CyberMainUI {
}
init() {
this.banner.visible =
this.btnDiscord.visible =
this.btnAchievement.visible =
this.btnThanks.visible = !!core.times;

View File

@@ -1,7 +0,0 @@
export default class CyberMode extends ui.view.CyberTheme.ModeUI {
constructor() {
super();
this.btnCustom.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.TALENT));
this.btnCelebrity.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.CELEBRITY));
}
}

View File

@@ -41,11 +41,9 @@ export default class CyberProperty extends ui.view.CyberTheme.CyberPropertyUI {
init({talents}) {
this.listSelectedTalents.array = talents;
const replace = core.remake(talents.map(talent => talent.id));
if(replace.length > 0) {
$$event('message', [replace.map(v => ['F_TalentReplace', v])]);
}
this.#propertyPoints = core.getPropertyPoints();
const talentIds = talents.map(talent => talent.id);
// core.talentReplace(talentIds);
this.#propertyPoints = core.getPropertyPoints(talentIds);
this.#propertyAllocateLimit = core.propertyAllocateLimit;
this.labLeftPropertyPoint.text = this.#propertyPoints;
this.#propertyAllocate = {
@@ -53,6 +51,7 @@ export default class CyberProperty extends ui.view.CyberTheme.CyberPropertyUI {
[this.#types.INT]: 0,
[this.#types.STR]: 0,
[this.#types.MNY]: 0,
[this.#types.TLT]: talentIds,
}
this.updateAllocate();
}
@@ -67,7 +66,6 @@ export default class CyberProperty extends ui.view.CyberTheme.CyberPropertyUI {
{
propertyAllocate: this.#propertyAllocate,
talents: this.listSelectedTalents.array,
enableExtend: true,
}
);
}

View File

@@ -6,7 +6,6 @@ export default class CyberSummary extends ui.view.CyberTheme.CyberSummaryUI {
}
#selectedTalent;
#enableExtend;
onAgain() {
core.talentExtend(this.#selectedTalent);
@@ -14,10 +13,8 @@ export default class CyberSummary extends ui.view.CyberTheme.CyberSummaryUI {
$ui.switchView(UI.pages.MAIN);
}
init({talents, enableExtend}) {
init({talents}) {
const {summary, lastExtendTalent} = core;
this.#enableExtend = enableExtend;
const gradeFilters = $ui.common.filter;
const gradeColors = $ui.common.grade;
@@ -71,11 +68,7 @@ export default class CyberSummary extends ui.view.CyberTheme.CyberSummaryUI {
if(b == lastExtendTalent) return 1;
return bg - ag;
});
if(this.#enableExtend) {
this.#selectedTalent = talents[0].id;
} else {
this.#selectedTalent = lastExtendTalent;
}
this.#selectedTalent = talents[0].id;
this.listSelectedTalents.array = talents;
}
@@ -122,9 +115,6 @@ export default class CyberSummary extends ui.view.CyberTheme.CyberSummaryUI {
}
onSelectTalent(talentId) {
if(!this.#enableExtend) {
return $$event('message', ['M_DisableExtendTalent']);
}
if(talentId == this.#selectedTalent) {
this.#selectedTalent = null;
} else {

View File

@@ -40,7 +40,7 @@ export default class CyberTalent extends ui.view.CyberTheme.CyberTalentUI {
}
const talents = [...this.#selected].map(index => this.listTalents.array[index]);
$ui.switchView(UI.pages.PROPERTY, { talents, enableExtend: true});
$ui.switchView(UI.pages.PROPERTY, { talents });
}
renderTalent(box, index) {
@@ -99,7 +99,7 @@ export default class CyberTalent extends ui.view.CyberTheme.CyberTalentUI {
if(this.#selected.size >= core.talentSelectLimit) {
return $$event('message', ['F_TalentSelectLimit', core.talentSelectLimit]);
}
const exclusive = core.exclude(
const exclusive = core.exclusive(
[...this.#selected].map(index => this.listTalents.array[index].id),
this.listTalents.array[index].id
);

View File

@@ -60,23 +60,20 @@ export default class CyberTrajectory extends ui.view.CyberTheme.CyberTrajectoryU
const item = CyberTrajectory.#createComponent('boxTrajectoryItem');
item.labContent = item.getChildByName('labContent');
item.labAge = item.getChildByName('hboxAge').getChildByName('labAge');
item.boxGrade = item.getChildByName('boxGrade');
return item;
}
#isEnd;
#trajectoryItems;
#talents;
#enableExtend;
init({propertyAllocate, talents, enableExtend}) {
this.#enableExtend = enableExtend;
init({propertyAllocate, talents}) {
this.boxParticle.visible = false;
this.boxSpeed.visible = true;
this.btnSummary.visible = false;
this.#trajectoryItems = [];
this.#isEnd = false;
this.#talents = talents;
core.start(propertyAllocate);
core.restart(propertyAllocate);
this.updateProperty();
this.onNext();
}
@@ -111,16 +108,16 @@ export default class CyberTrajectory extends ui.view.CyberTheme.CyberTrajectoryU
if(isEnd) {
this.boxSpeed.visible = false;
this.btnSummary.visible = true;
Laya.timer.frameOnce(1,this,()=>{
this.panelTrajectory.scrollTo(0, this.panelTrajectory.contentHeight);
});
}
this.panelTrajectory.scrollTo(0, this.panelTrajectory.contentHeight);
this.renderTrajectory(age, content);
if(age >= 100) {
this.boxParticle.visible = true;
}
Laya.timer.frameOnce(1, this, () => {
this.panelTrajectory.scrollTo(0, this.panelTrajectory.contentHeight);
});
this.updateProperty();
}
@@ -137,18 +134,14 @@ export default class CyberTrajectory extends ui.view.CyberTheme.CyberTrajectoryU
}
}
).join('\n');
$_.deepMapSet(
item.boxGrade,
$ui.common.gradeBlk[content[content.length - 1].grade || 0]
);
this.vboxTrajectory.addChild(item);
this.#trajectoryItems.push(item);
item.y = this.vboxTrajectory.height;
this.#trajectoryItems.forEach((item, index) => item.y = index);
}
onSummary() {
const talents = this.#talents;
$ui.switchView(UI.pages.SUMMARY, { talents, enableExtend: this.#enableExtend });
$ui.switchView(UI.pages.SUMMARY, {talents});
}
get speed() {

View File

@@ -1,143 +0,0 @@
export default class Celebrity extends ui.view.DefaultTheme.CelebrityUI {
constructor() {
super();
this.btnRetry.on(Laya.Event.CLICK, this, ()=>this.random());
this.btnNext.on(Laya.Event.CLICK, this, this.next);
this.panelCharacter.vScrollBar.elasticDistance = 150;
}
#selected;
static #createComponent = Laya.plugin.extractComponents(Celebrity.uiView, ['boxCharacter','boxTalent','boxUniqueUnGenerate']);
#createCharacterItem(dataSource, click) {
const {name, property, talent} = dataSource;
const style = $ui.common.characterItem;
const item = Celebrity.#createComponent('boxCharacter');
const vboxStates = item.getChildByName('vboxStates');
const boxName = item.getChildByName('boxName');
boxName.label = name;
const p = $_.clone(property);
for(const k in p)
if(Math.abs(p[k] - Math.PI) < 0.0000001)
p[k] = 'π';
vboxStates.label = $_.format($lang.F_PropertyStr, p);
$_.deepMapSet(boxName, style.name);
$_.deepMapSet(vboxStates, style.state);
for(const t of talent) {
const i = Celebrity.#createComponent('boxTalent');
i.label = $_.format($lang.F_TalentSelection, t);
i.y = vboxStates.height+vboxStates.space;
$_.deepMapSet(i, $ui.common.card[t.grade].normal);
vboxStates.addChild(i);
}
const box = new Laya.Box();
box.height = vboxStates.space;
box.y = vboxStates.height;
vboxStates.addChild(box);
vboxStates.scaleY = 0;
item.dataSource = dataSource;
item.switch = showDetails => vboxStates.scaleY = !!showDetails?1:0;
item.click = (cb, caller) => {
boxName.offAll(Laya.Event.CLICK);
boxName.on(Laya.Event.CLICK, caller || this, cb);
}
if(click) item.click(click);
return item;
}
#createUniqueUnGenerateItem(generate) {
const style = $ui.common.characterItem;
const item = Celebrity.#createComponent('boxUniqueUnGenerate');
const boxName = item.getChildByName('boxName');
const vboxStates = item.getChildByName('vboxStates');
const label = vboxStates.getChildByName('label');
const boxBtn = vboxStates.getChildByName('boxBtn');
const btn = boxBtn.getChildByName('btn');
$_.deepMapSet(boxName, style.name);
$_.deepMapSet(vboxStates, style.state);
$_.deepMapSet(btn, style.name);
boxBtn.y = label.height + vboxStates.space;
label.event(Laya.Event.RESIZE);
vboxStates.scaleY = 0;
item.dataSource = false;
item.switch = showDetails => vboxStates.scaleY = !!showDetails?1:0;
item.click = (cb, caller) => {
boxName.offAll(Laya.Event.CLICK);
boxName.on(Laya.Event.CLICK, caller || this, cb);
}
item.generate = (cb, caller) => {
btn.offAll(Laya.Event.CLICK);
btn.on(Laya.Event.CLICK, caller || this, cb);
}
if(generate) item.generate(generate);
return item;
}
init() {
this.random();
}
close() {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
}
random(g) {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
const {unique, normal} = core.characterRandom();
const items = [];
const uniqueItem = this.generateUnique(unique, ()=>{
core.generateUnique();
this.random(normal);
});
if(uniqueItem) items.push(uniqueItem);
(g||normal).forEach(character => items.push(this.#createCharacterItem(character)));
items.forEach((item, i) => {
item.y = i;
this.vboxCharacter.addChild(item);
item.click(()=>{
if(this.#selected) this.#selected.switch(false);
this.#selected = item;
item.switch(true);
item.event(Laya.Event.RESIZE);
})
});
if(g&&uniqueItem) {
this.#selected = uniqueItem;
uniqueItem.switch(true);
uniqueItem.event(Laya.Event.RESIZE);
}
}
generateUnique(data, generate) {
if(!data) return null;
if(!data.generate) return this.#createUniqueUnGenerateItem(generate);
data.name = $lang.UI_UniqueWaTaShi;
return this.#createCharacterItem(data);
}
next() {
if(!this.#selected) return $$event('message', ['M_PleaseSelectOne']);
if(!this.#selected.dataSource) return $$event('message', ['M_UnGenerate']);
const {property: propertyAllocate, talent: talents} = this.#selected.dataSource;
const replace = core.remake(talents.map(talent => talent.id));
if(replace.length > 0) {
$$event('message', [replace.map(v => ['F_TalentReplace', v])]);
}
$ui.switchView(
UI.pages.TRAJECTORY,
{
propertyAllocate, talents,
enableExtend: false,
}
);
}
}

View File

@@ -1,7 +1,7 @@
export default class Main extends ui.view.DefaultTheme.MainUI {
constructor() {
super();
this.btnRemake.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.MODE));
this.btnRemake.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.TALENT));
this.btnAchievement.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.ACHIEVEMENT));
this.btnThanks.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.THANKS));
this.btnGithub.on(Laya.Event.CLICK, this, goto, ['github']);
@@ -17,7 +17,6 @@ export default class Main extends ui.view.DefaultTheme.MainUI {
}
init() {
this.banner.visible =
this.btnDiscord.visible =
this.btnAchievement.visible =
this.btnThanks.visible = !!core.times;

View File

@@ -1,7 +0,0 @@
export default class Mode extends ui.view.DefaultTheme.ModeUI {
constructor() {
super();
this.btnCustom.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.TALENT));
this.btnCelebrity.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.CELEBRITY));
}
}

View File

@@ -41,11 +41,9 @@ export default class Property extends ui.view.DefaultTheme.PropertyUI {
init({talents}) {
this.listSelectedTalents.array = talents;
const replace = core.remake(talents.map(talent => talent.id));
if(replace.length > 0) {
$$event('message', [replace.map(v => ['F_TalentReplace', v])]);
}
this.#propertyPoints = core.getPropertyPoints();
const talentIds = talents.map(talent => talent.id);
// core.talentReplace(talentIds);
this.#propertyPoints = core.getPropertyPoints(talentIds);
this.#propertyAllocateLimit = core.propertyAllocateLimit;
this.labLeftPropertyPoint.text = this.#propertyPoints;
this.#propertyAllocate = {
@@ -53,6 +51,7 @@ export default class Property extends ui.view.DefaultTheme.PropertyUI {
[this.#types.INT]: 0,
[this.#types.STR]: 0,
[this.#types.MNY]: 0,
[this.#types.TLT]: talentIds,
}
this.updateAllocate();
}
@@ -67,7 +66,6 @@ export default class Property extends ui.view.DefaultTheme.PropertyUI {
{
propertyAllocate: this.#propertyAllocate,
talents: this.listSelectedTalents.array,
enableExtend: true,
}
);
}

Some files were not shown because too many files have changed in this diff Show More