mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-02-04 14:53:12 +08:00
feat: 选三个天赋之后按钮文案变化,加点页面显示已选天赋
This commit is contained in:
25
src/app.js
25
src/app.js
@@ -101,6 +101,9 @@ class App{
|
||||
if(li.hasClass('selected')) {
|
||||
li.removeClass('selected')
|
||||
this.#talentSelected.delete(talent);
|
||||
if(this.#talentSelected.size<3) {
|
||||
talentPage.find('#next').text('请选择3个')
|
||||
}
|
||||
} else {
|
||||
if(this.#talentSelected.size==3) {
|
||||
this.hint('只能选3个天赋');
|
||||
@@ -122,6 +125,9 @@ class App{
|
||||
}
|
||||
li.addClass('selected');
|
||||
this.#talentSelected.add(talent);
|
||||
if(this.#talentSelected.size==3) {
|
||||
talentPage.find('#next').text('开始新人生')
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -139,18 +145,30 @@ class App{
|
||||
})
|
||||
|
||||
// Property
|
||||
const propertyPage = $(`
|
||||
// hint of extension tobermory.es6-string-html
|
||||
const propertyPage = $(/*html*/`
|
||||
<div id="main">
|
||||
<div class="head" style="font-size: 1.6rem">
|
||||
调整初始属性<br>
|
||||
<div id="total" style="font-size:1rem; font-weight:normal;">可用属性点:0</div>
|
||||
</div>
|
||||
<ul id="propertyAllocation" class="propinitial"></ul>
|
||||
<ul class="propinitial" style="top:auto; bottom:23rem">
|
||||
<li>已选天赋</li>
|
||||
</ul>
|
||||
<ul class="selectlist" id="talentSelectedView" style="top:auto; bottom:16rem"></ul>
|
||||
<button id="random" class="mainbtn" style="top:auto; bottom:7rem">随机分配</button>
|
||||
<button id="start" class="mainbtn" style="top:auto; bottom:0.1rem">开始新人生</button>
|
||||
</div>
|
||||
`);
|
||||
|
||||
propertyPage.mounted = ()=>{
|
||||
propertyPage
|
||||
.find('#talentSelectedView').append(
|
||||
$(Array.from(this.#talentSelected)
|
||||
.map(({name,description})=>`<li class="grade0b">${name}(${description})</li>`)
|
||||
.join(''))
|
||||
)
|
||||
}
|
||||
const groups = {};
|
||||
const total = ()=>{
|
||||
let t = 0;
|
||||
@@ -478,6 +496,9 @@ class App{
|
||||
$('#main').detach();
|
||||
p.clear();
|
||||
p.page.appendTo('body');
|
||||
if(typeof p.page.mounted === 'function'){
|
||||
p.page.mounted()
|
||||
}
|
||||
}
|
||||
|
||||
hint(message, type='info') {
|
||||
|
||||
Reference in New Issue
Block a user