mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-03-25 08:34:16 +08:00
Compare commits
5 Commits
eff286199f
...
84785f3e40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84785f3e40 | ||
|
|
1b7ae5f1ff | ||
|
|
4a5127fecf | ||
|
|
1c8628bb3d | ||
|
|
160aab5bc2 |
File diff suppressed because one or more lines are too long
37
src/app.js
37
src/app.js
@@ -101,6 +101,9 @@ class App{
|
|||||||
if(li.hasClass('selected')) {
|
if(li.hasClass('selected')) {
|
||||||
li.removeClass('selected')
|
li.removeClass('selected')
|
||||||
this.#talentSelected.delete(talent);
|
this.#talentSelected.delete(talent);
|
||||||
|
if(this.#talentSelected.size<3) {
|
||||||
|
talentPage.find('#next').text('请选择3个')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(this.#talentSelected.size==3) {
|
if(this.#talentSelected.size==3) {
|
||||||
this.hint('只能选3个天赋');
|
this.hint('只能选3个天赋');
|
||||||
@@ -122,6 +125,9 @@ class App{
|
|||||||
}
|
}
|
||||||
li.addClass('selected');
|
li.addClass('selected');
|
||||||
this.#talentSelected.add(talent);
|
this.#talentSelected.add(talent);
|
||||||
|
if(this.#talentSelected.size==3) {
|
||||||
|
talentPage.find('#next').text('开始新人生')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -139,18 +145,31 @@ class App{
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Property
|
// Property
|
||||||
const propertyPage = $(`
|
// hint of extension tobermory.es6-string-html
|
||||||
|
const propertyPage = $(/*html*/`
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<div class="head" style="font-size: 1.6rem">
|
<div class="head" style="font-size: 1.6rem">
|
||||||
调整初始属性<br>
|
调整初始属性<br>
|
||||||
<div id="total" style="font-size:1rem; font-weight:normal;">可用属性点:0</div>
|
<div id="total" style="font-size:1rem; font-weight:normal;">可用属性点:0</div>
|
||||||
</div>
|
</div>
|
||||||
<ul id="propertyAllocation" class="propinitial"></ul>
|
<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="random" class="mainbtn" style="top:auto; bottom:7rem">随机分配</button>
|
||||||
<button id="start" class="mainbtn" style="top:auto; bottom:0.1rem">开始新人生</button>
|
<button id="start" class="mainbtn" style="top:auto; bottom:0.1rem">开始新人生</button>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
|
propertyPage.mounted = ()=>{
|
||||||
|
propertyPage
|
||||||
|
.find('#talentSelectedView').append(
|
||||||
|
`<li>已选天赋</li>` +
|
||||||
|
Array.from(this.#talentSelected)
|
||||||
|
.map(({name,description})=>`<li class="grade0b">${name}(${description})</li>`)
|
||||||
|
.join('')
|
||||||
|
)
|
||||||
|
}
|
||||||
const groups = {};
|
const groups = {};
|
||||||
const total = ()=>{
|
const total = ()=>{
|
||||||
let t = 0;
|
let t = 0;
|
||||||
@@ -303,11 +322,11 @@ class App{
|
|||||||
// Update properties if not die yet
|
// Update properties if not die yet
|
||||||
const property = this.#life.getLastRecord();
|
const property = this.#life.getLastRecord();
|
||||||
$("#lifeProperty").html(`
|
$("#lifeProperty").html(`
|
||||||
<li>颜值:${property.CHR} </li>
|
<li>颜值:${property.CHR} </li>
|
||||||
<li>智力:${property.INT} </li>
|
<li>智力:${property.INT} </li>
|
||||||
<li>体质:${property.STR} </li>
|
<li>体质:${property.STR} </li>
|
||||||
<li>家境:${property.MNY} </li>
|
<li>家境:${property.MNY} </li>
|
||||||
<li>快乐:${property.STR} </li>`);
|
<li>快乐:${property.SPR} </li>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -389,6 +408,9 @@ class App{
|
|||||||
page: propertyPage,
|
page: propertyPage,
|
||||||
clear: ()=>{
|
clear: ()=>{
|
||||||
freshTotal();
|
freshTotal();
|
||||||
|
propertyPage
|
||||||
|
.find('#talentSelectedView')
|
||||||
|
.empty();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
trajectory: {
|
trajectory: {
|
||||||
@@ -478,6 +500,9 @@ class App{
|
|||||||
$('#main').detach();
|
$('#main').detach();
|
||||||
p.clear();
|
p.clear();
|
||||||
p.page.appendTo('body');
|
p.page.appendTo('body');
|
||||||
|
if(typeof p.page.mounted === 'function'){
|
||||||
|
p.page.mounted()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hint(message, type='info') {
|
hint(message, type='info') {
|
||||||
|
|||||||
Reference in New Issue
Block a user