mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-03-24 21:37:40 +08:00
add autoplay auto selece extend
This commit is contained in:
File diff suppressed because one or more lines are too long
54
src/app.js
54
src/app.js
@@ -16,6 +16,7 @@ class App{
|
|||||||
#selectedExtendTalent = null;
|
#selectedExtendTalent = null;
|
||||||
#hintTimeout;
|
#hintTimeout;
|
||||||
#specialthanks;
|
#specialthanks;
|
||||||
|
#autoTrajectory;
|
||||||
|
|
||||||
async initial() {
|
async initial() {
|
||||||
this.initPages();
|
this.initPages();
|
||||||
@@ -347,6 +348,8 @@ class App{
|
|||||||
<ul id="lifeProperty" class="lifeProperty"></ul>
|
<ul id="lifeProperty" class="lifeProperty"></ul>
|
||||||
<ul id="lifeTrajectory" class="lifeTrajectory"></ul>
|
<ul id="lifeTrajectory" class="lifeTrajectory"></ul>
|
||||||
<div class="btn-area">
|
<div class="btn-area">
|
||||||
|
<button id="auto" class="mainbtn">自动播放</button>
|
||||||
|
<button id="auto2x" class="mainbtn">自动播放2x</button>
|
||||||
<button id="summary" class="mainbtn">人生总结</button>
|
<button id="summary" class="mainbtn">人生总结</button>
|
||||||
<button id="domToImage" class="mainbtn">人生回放</button>
|
<button id="domToImage" class="mainbtn">人生回放</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -380,6 +383,8 @@ class App{
|
|||||||
$(document).unbind("keydown");
|
$(document).unbind("keydown");
|
||||||
this.#isEnd = true;
|
this.#isEnd = true;
|
||||||
trajectoryPage.find('#summary').show();
|
trajectoryPage.find('#summary').show();
|
||||||
|
trajectoryPage.find('#auto').hide();
|
||||||
|
trajectoryPage.find('#auto2x').hide();
|
||||||
// trajectoryPage.find('#domToImage').show();
|
// trajectoryPage.find('#domToImage').show();
|
||||||
} else {
|
} else {
|
||||||
// 如未死亡,更新数值
|
// 如未死亡,更新数值
|
||||||
@@ -419,9 +424,40 @@ class App{
|
|||||||
trajectoryPage
|
trajectoryPage
|
||||||
.find('#summary')
|
.find('#summary')
|
||||||
.click(()=>{
|
.click(()=>{
|
||||||
|
clearInterval(this.#autoTrajectory);
|
||||||
|
this.#autoTrajectory = null;
|
||||||
this.switch('summary');
|
this.switch('summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const auto = tick=>{
|
||||||
|
if(this.#autoTrajectory) {
|
||||||
|
clearInterval(this.#autoTrajectory);
|
||||||
|
this.#autoTrajectory = null;
|
||||||
|
} else {
|
||||||
|
if(!this.isEnd)
|
||||||
|
trajectoryPage
|
||||||
|
.find('#lifeTrajectory')
|
||||||
|
.click();
|
||||||
|
this.#autoTrajectory = setInterval(()=>{
|
||||||
|
if(this.isEnd) {
|
||||||
|
clearInterval(this.#autoTrajectory);
|
||||||
|
this.#autoTrajectory = null;
|
||||||
|
} else {
|
||||||
|
trajectoryPage
|
||||||
|
.find('#lifeTrajectory')
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
}, tick);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
trajectoryPage
|
||||||
|
.find('#auto')
|
||||||
|
.click(()=>auto(1000));
|
||||||
|
trajectoryPage
|
||||||
|
.find('#auto2x')
|
||||||
|
.click(()=>auto(500));
|
||||||
|
|
||||||
// Summary
|
// Summary
|
||||||
const summaryPage = $(`
|
const summaryPage = $(`
|
||||||
<div id="main">
|
<div id="main">
|
||||||
@@ -543,7 +579,7 @@ class App{
|
|||||||
total.append(`
|
total.append(`
|
||||||
<li class="achvg${getGrade('times', times)}"><span class="achievementtitle">已重开${times}次</span>${formatRate('times', times)}</li>
|
<li class="achvg${getGrade('times', times)}"><span class="achievementtitle">已重开${times}次</span>${formatRate('times', times)}</li>
|
||||||
<li class="achvg${getGrade('achievement', achievement)}"><span class="achievementtitle">成就达成${achievement}个</span>${formatRate('achievement', achievement)}</li>
|
<li class="achvg${getGrade('achievement', achievement)}"><span class="achievementtitle">成就达成${achievement}个</span>${formatRate('achievement', achievement)}</li>
|
||||||
<li class="achvg${getGrade('eventRate', eventRate)}"><span class="achievementtitle">事件选择率</span>${Math.floor(eventRate * 100)}%</li>
|
<li class="achvg${getGrade('eventRate', eventRate)}"><span class="achievementtitle">事件收集率</span>${Math.floor(eventRate * 100)}%</li>
|
||||||
<li class="achvg${getGrade('talentRate', talentRate)}"><span class="achievementtitle">天赋收集率</span>${Math.floor(talentRate * 100)}%</li>
|
<li class="achvg${getGrade('talentRate', talentRate)}"><span class="achievementtitle">天赋收集率</span>${Math.floor(talentRate * 100)}%</li>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
@@ -606,6 +642,8 @@ class App{
|
|||||||
this.#currentPage = 'trajectory';
|
this.#currentPage = 'trajectory';
|
||||||
trajectoryPage.find('#lifeTrajectory').empty();
|
trajectoryPage.find('#lifeTrajectory').empty();
|
||||||
trajectoryPage.find('#summary').hide();
|
trajectoryPage.find('#summary').hide();
|
||||||
|
trajectoryPage.find('#auto').show();
|
||||||
|
trajectoryPage.find('#auto2x').show();
|
||||||
this.#isEnd = false;
|
this.#isEnd = false;
|
||||||
},
|
},
|
||||||
born: ()=>{
|
born: ()=>{
|
||||||
@@ -620,7 +658,18 @@ class App{
|
|||||||
const talents = summaryPage.find('#talents');
|
const talents = summaryPage.find('#talents');
|
||||||
judge.empty();
|
judge.empty();
|
||||||
talents.empty();
|
talents.empty();
|
||||||
this.#talentSelected.forEach(talent=>{
|
const lastExtendTalent = this.#life.getLastExtendTalent();
|
||||||
|
Array
|
||||||
|
.from(this.#talentSelected)
|
||||||
|
.sort((
|
||||||
|
{id:a, grade:ag},
|
||||||
|
{id:b, grade:bg},
|
||||||
|
)=>{
|
||||||
|
if(a == lastExtendTalent) return -1;
|
||||||
|
if(b == lastExtendTalent) return 1;
|
||||||
|
return bg - ag;
|
||||||
|
})
|
||||||
|
.forEach((talent, i)=>{
|
||||||
const li = createTalent(talent);
|
const li = createTalent(talent);
|
||||||
talents.append(li);
|
talents.append(li);
|
||||||
li.click(()=>{
|
li.click(()=>{
|
||||||
@@ -635,6 +684,7 @@ class App{
|
|||||||
li.addClass('selected');
|
li.addClass('selected');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if(!i) li.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
const summaryData = this.#life.getSummary();
|
const summaryData = this.#life.getSummary();
|
||||||
|
|||||||
Reference in New Issue
Block a user