6 Commits

Author SHA1 Message Date
Vick Scarlet
6e135949fe update build 2021-09-07 21:43:16 +08:00
Vick Scarlet
4964b01eac fix: dom-to-image add: specialthanks 2021-09-07 21:41:12 +08:00
Vick Scarlet
3f3d6dda0f update data 2021-09-07 18:23:37 +08:00
wz930206
476cafdc4a 新增"人生回放"按钮保存图片功能,目前支持微信浏览器和普通浏览器 2021-09-07 16:49:32 +08:00
Vick Scarlet
01d6cdbff4 update data 2021-09-07 15:59:39 +08:00
Vick Scarlet
df6b130b56 update data 2021-09-07 15:51:52 +08:00
12 changed files with 353 additions and 24 deletions

View File

@@ -4435,7 +4435,7 @@
"SPR": -1
},
"include": "EVT?[10505]",
"exclude": "EVT?[10534]",
"exclude": "(EVT?[10534])|(TLT?[1072])",
"branch": [
"TLT?[1108]:20534"
]
@@ -10976,7 +10976,8 @@
"effect": {
"CHR": 5
},
"include": "EVT?[20335]"
"include": "EVT?[20335]",
"exclude": "EVT?[20338]"
},
"20339": {
"id": 20339,
@@ -11354,7 +11355,7 @@
"id": 20567,
"event": "你遭到了枪击。",
"include": "EVT?[10011]",
"exclude": "EVT?[10578,10682]",
"exclude": "(TLT?[1072])|(EVT?[10578,10682])",
"branch": [
"EVT?[10011]:10000"
]

Binary file not shown.

43
data/specialthanks.json Normal file
View File

@@ -0,0 +1,43 @@
{
"1": {
"id": 1,
"group": 1,
"name": "白夜",
"comment": "买正版游戏,就是在给自己向往的世界投资。"
},
"2": {
"id": 2,
"group": 2,
"name": "果てない雨"
},
"3": {
"id": 3,
"group": 2,
"name": "qwe凑斗光"
},
"4": {
"id": 4,
"group": 2,
"name": "星芒月幻"
},
"5": {
"id": 5,
"group": 2,
"name": "宇宙常数圆周率"
},
"6": {
"id": 6,
"group": 2,
"name": "当然是选择原谅她了"
},
"7": {
"id": 7,
"group": 2,
"name": "好好吃饭."
},
"8": {
"id": 8,
"group": 2,
"name": "加藤骑士"
}
}

BIN
data/specialthanks.xlsx Normal file

Binary file not shown.

View File

@@ -502,31 +502,31 @@
"1059": {
"id": "1059",
"name": "理财达人",
"description": "30、40、50岁时家境+1",
"condition": "AGE?[30,40,50]",
"description": "40岁时家境+3",
"condition": "AGE?[40]",
"grade": 0,
"effect": {
"MNY": 1
"MNY": 3
}
},
"1060": {
"id": "1060",
"name": "成熟",
"description": "12、18岁时智力+1",
"condition": "AGE?[12,18]",
"description": "18岁时智力+2",
"condition": "AGE?[18]",
"grade": 1,
"effect": {
"INT": 1
"INT": 2
}
},
"1061": {
"id": "1061",
"name": "形象管理",
"description": "16、24岁时颜值+1",
"condition": "AGE?[16,24]",
"description": "24岁时颜值+2",
"condition": "AGE?[24]",
"grade": 1,
"effect": {
"CHR": 1
"CHR": 2
}
},
"1062": {

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -14,11 +14,17 @@ class App{
#isEnd = false;
#selectedExtendTalent = null;
#hintTimeout;
#specialthanks;
async initial() {
this.initPages();
this.switch('loading');
await this.#life.initial();
const [,specialthanks] = await Promise.all([
this.#life.initial(),
json('specialthanks')
]);
this.#specialthanks = specialthanks;
console.table(specialthanks);
this.switch('index');
window.onerror = (event, source, lineno, colno, error) => {
this.hint(`[ERROR] at (${source}:${lineno}:${colno})\n\n${error?.stack||error||'unknow Error'}`, 'error');
@@ -42,6 +48,7 @@ class App{
<div id="main">
<div id="cnt" class="head">已重开1次</div>
<button id="rank">排行榜</button>
<button id="specialthanks">特别感谢</button>
<button id="themeToggleBtn">黑</button>
<div id="title">
人生重开模拟器<br>
@@ -74,6 +81,25 @@ class App{
this.setTheme(localStorage.getItem('theme'))
});
indexPage
.find('#specialthanks')
.click(()=>this.switch('specialthanks'));
const specialThanksPage = $(`
<div id="main">
<button id="specialthanks">返回</button>
<div id="spthx">
<ul class="g1"></ul>
<ul class="g2"></ul>
</div>
<button id="sponsor" onclick="window.open('https://afdian.net/@LifeRestart')">打赏作者</button>
</div>
`);
specialThanksPage
.find('#specialthanks')
.click(()=>this.switch('index'));
// Talent
const talentPage = $(`
<div id="main">
@@ -285,7 +311,11 @@ class App{
<div id="main">
<ul id="lifeProperty" class="lifeProperty"></ul>
<ul id="lifeTrajectory" class="lifeTrajectory"></ul>
<button id="summary" class="mainbtn" style="top:auto; bottom:0.1rem">人生总结</button>
<button id="summary" class="mainbtn" style="top:auto; bottom:0.1rem; left: 25%;">人生总结</button>
<button id="domToImage" class="mainbtn" style="top:auto; bottom:0.1rem; left: 75%; display: none">人生回放</button>
<div class="domToImage2wx">
<img src="" id="endImage" />
</div>
</div>
`);
@@ -295,7 +325,6 @@ class App{
if(this.#isEnd) return;
const trajectory = this.#life.next();
const { age, content, isEnd } = trajectory;
const li = $(`<li><span>${age}岁:</span>${
content.map(
({type, description, grade, name, postEvent}) => {
@@ -314,6 +343,7 @@ class App{
$(document).unbind("keydown");
this.#isEnd = true;
trajectoryPage.find('#summary').show();
trajectoryPage.find('#domToImage').show();
} else {
// 如未死亡,更新数值
// Update properties if not die yet
@@ -326,7 +356,26 @@ class App{
<li>快乐:${property.SPR} </li>`);
}
});
// html2canvas
trajectoryPage
.find('#domToImage')
.click(()=>{
$("#lifeTrajectory").addClass("deleteFixed");
const ua = navigator.userAgent.toLowerCase();
domtoimage.toJpeg(document.getElementById('lifeTrajectory'))
.then(function (dataUrl) {
let link = document.createElement('a');
link.download = '我的人生回放.jpeg';
link.href = dataUrl;
link.click();
$("#lifeTrajectory").removeClass("deleteFixed");
// 微信内置浏览器,显示图片,需要用户单独保存
if(ua.match(/MicroMessenger/i)=="micromessenger") {
$('#endImage').attr('src', dataUrl);
}
});
})
trajectoryPage
.find('#summary')
.click(()=>{
@@ -393,6 +442,25 @@ class App{
cnt.hide();
},
},
specialthanks: {
page: specialThanksPage,
clear: () => {
const groups = [
specialThanksPage.find('#spthx > ul.g1'),
specialThanksPage.find('#spthx > ul.g2'),
];
groups.forEach(g=>g.empty());
Object
.values(this.#specialthanks)
.sort(()=>0.5-Math.random())
.forEach(({group, name, comment})=>groups[--group].append(`
<li>
<span class="name">${name}</span>
<span class="comment">${comment||''}</span>
</li>
`))
}
},
talent: {
page: talentPage,
clear: ()=>{
@@ -487,7 +555,7 @@ class App{
})(),
].join(''));
}
}
},
}
}

View File

@@ -100,11 +100,14 @@ body {
-moz-osx-font-smoothing: grayscale;
}
#sponsor,
#specialthanks,
#rank {
position: fixed;
top: 1rem;
top: 4rem;
right: 1rem;
padding: 0.1rem 1rem;
padding: 0.1rem;
width: 6rem;
border: none;
border-radius: 0.2rem;
background-color:lightsteelblue;
@@ -112,6 +115,74 @@ body {
color: #EEEEEE;
cursor: pointer;
z-index:2;
word-wrap: none;
}
#specialthanks {
background-color: #5865F2;
top: 1rem;
}
#sponsor {
top: auto;
bottom: 0;
right: 50%;
transform: translate(50%, -50%);
}
#spthx {
position: fixed;
display: grid;
top: 4rem;
bottom: 5rem;
left: 50%;
width: 30rem;
max-width: calc(100% - 2rem);
transform: translateX(-50%);
}
#spthx ul {
list-style-type: none;
padding: 0;
}
#spthx ul li {
margin: 0;
}
#spthx ul.g1 {
display: grid;
max-block-size: 9rem;
max-height: 9rem;
overflow: scroll;
}
#spthx ul.g1 li {
display: inline-grid;
background-color: orange;
margin-bottom: 0.5rem;
padding: 0.2rem 0;
grid-template-columns: 7rem auto;
}
#spthx ul.g1 li .name {
padding: 0 0.5rem;
font-weight: 700;
}
#spthx ul.g1 li .comment {
padding: 0 0.5rem;
}
#spthx ul.g2 {
color: white;
display: grid;
grid-template-columns: 50% 50%;
overflow: scroll;
}
#spthx ul.g2 li {
text-align: center;
}
#themeToggleBtn {
@@ -570,3 +641,40 @@ i {
::-webkit-scrollbar {
width: 0 !important
}
.deleteFixed {
position: relative;
transform: translateX(0);
left: 0;
top: 0;
text-align: left;
}
.operateBtn {
padding: 0.5rem 1.5rem;
border: 1px #EEEEEE solid;
border-radius: 0.2rem;
background-color:#393E46;
font-size: 1.6rem;
white-space: nowrap;
transform: translate(-50%,-50%);
cursor: pointer;
z-index:2;
color: #EEEEEE;
}
.operateBtn:hover {
background: #ff7878;
color: #fff;
transition: all .4s ease 0s;
}
.domToImage2wx {
position: fixed;
z-index: 1111;
width: 100%;
}
.domToImage2wx img {
width: 100%;
}

View File

@@ -8,7 +8,8 @@
<meta name="keywords" content="人生重开模拟器 liferestart life restart remake 人生重来"/>
<link id="themeLink" rel="stylesheet" href="light.css">
<link rel="manifest" href="./manifest.json">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.js" integrity="sha512-wUa0ktp10dgVVhWdRVfcUO4vHS0ryT42WOEcXjVVF2+2rcYBKTY7Yx7JCEzjWgPV+rj2EDUr8TwsoWF6IoIOPg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="../public/bundle.js"></script>
<title>Life Restart</title>
</head>

View File

@@ -97,18 +97,88 @@ body {
-moz-osx-font-smoothing: grayscale;
}
#sponsor,
#specialthanks,
#rank {
position: fixed;
top: 1rem;
top: 4rem;
right: 1rem;
padding: 0.1rem 1rem;
padding: 0.1rem;
width: 6rem;
border: none;
border-radius: 0.2rem;
background-color:lightsteelblue;
font-size: 1.4rem;
color: white;
color: #EEEEEE;
cursor: pointer;
z-index:2;
word-wrap: none;
}
#specialthanks {
background-color: #5865F2;
top: 1rem;
}
#sponsor {
top: auto;
bottom: 0;
right: 50%;
transform: translate(50%, -50%);
}
#spthx {
position: fixed;
display: grid;
top: 4rem;
bottom: 5rem;
left: 50%;
width: 30rem;
max-width: calc(100% - 2rem);
transform: translateX(-50%);
}
#spthx ul {
list-style-type: none;
padding: 0;
}
#spthx ul li {
margin: 0;
}
#spthx ul.g1 {
display: grid;
max-block-size: 9rem;
max-height: 9rem;
overflow: scroll;
}
#spthx ul.g1 li {
display: inline-grid;
background-color: orange;
margin-bottom: 0.5rem;
padding: 0.2rem 0;
grid-template-columns: 7rem auto;
}
#spthx ul.g1 li .name {
padding: 0 0.5rem;
font-weight: 700;
}
#spthx ul.g1 li .comment {
padding: 0 0.5rem;
}
#spthx ul.g2 {
display: grid;
grid-template-columns: 50% 50%;
overflow: scroll;
}
#spthx ul.g2 li {
text-align: center;
}
#themeToggleBtn {
@@ -563,3 +633,40 @@ i {
::-webkit-scrollbar {
width: 0 !important
}
.deleteFixed {
position: relative;
transform: translateX(0);
left: 0;
top: 0;
text-align: left;
}
.operateBtn {
padding: 0.5rem 1.5rem;
border: 1px #EEEEEE solid;
border-radius: 0.2rem;
background-color:#393E46;
font-size: 1.6rem;
white-space: nowrap;
transform: translate(-50%,-50%);
cursor: pointer;
z-index:2;
color: #EEEEEE;
}
.operateBtn:hover {
background: #ff7878;
color: #fff;
transition: all .4s ease 0s;
}
.domToImage2wx {
position: fixed;
z-index: 1111;
width: 100%;
}
.domToImage2wx img {
width: 100%;
}

View File

@@ -8,7 +8,8 @@
<meta name="keywords" content="人生重开模拟器 liferestart life restart remake 人生重来"/>
<link id="themeLink" rel="stylesheet" href="light.css">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9857163863537600" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.js" integrity="sha512-wUa0ktp10dgVVhWdRVfcUO4vHS0ryT42WOEcXjVVF2+2rcYBKTY7Yx7JCEzjWgPV+rj2EDUr8TwsoWF6IoIOPg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="module" src="../src/index.js"></script>
<title>Life Restart</title>
</head>