add game mode

This commit is contained in:
Vick Scarlet
2022-01-25 18:15:22 +08:00
parent 0e3c885ad3
commit 286828abe7
84 changed files with 6244 additions and 135 deletions

View File

@@ -1,3 +1,4 @@
import './ui/laya.patch.js';
import './ui/runtime.js';
import './ui/pluginFunction.js'
import './ui/promisesLaya.js'

View File

@@ -27,7 +27,7 @@ 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 晰晰',
@@ -125,17 +125,26 @@ export default ({
UI_Write: 'Paste',
UI_CopySuccess: 'Copy to clipboard success',
UI_CopyFaild: 'Copy to clipboard faild',
UI_CopyFailed: 'Copy to clipboard Failed',
UI_PasteSuccessDecodeSuccess: 'Load Success!',
UI_PasteSuccessDecodeFaild: 'Paste success, but load faild!',
UI_PasteFaildDecodeSuccess: 'Paste faild, use input load success!',
UI_PasteFaildDecodeFaild: 'Paste faild, use input load faild!',
UI_PasteSuccessDecodeFailed: 'Paste success, but load Failed!',
UI_PasteFailedDecodeSuccess: 'Paste Failed, use input load success!',
UI_PasteFailedDecodeFailed: 'Paste Failed, use input load Failed!',
UI_LoadSuccess: 'Load Success!',
UI_LoadFaild: 'Load Faild!',
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',
M_NoRank: 'There is no rank',
M_PleaseSelectOne: 'Please Select One',
M_DisableExtendTalent: 'Celebrity mode can\'t extends talent',
F_RemakeTimes: 'Remake {0} Times',
F_AchievementCount: 'Achievement {0}',
@@ -145,4 +154,5 @@ export default ({
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}'
});

View File

@@ -27,7 +27,7 @@ export default ({
UI_Title_Remake: '人生重开模拟器',
UI_Title_Subsequent: '这垃圾人生一秒也不想待了',
UI_Remake: '立即重开',
UI_Remake: '立即重开',
UI_Thanks: '感谢',
UI_Achievement: '成就',
UI_Cyber_Theme_Art_Design: 'UI 设计 by 晰晰',
@@ -125,17 +125,27 @@ export default ({
UI_Write: '粘贴',
UI_LoadSuccess: '读档成功!',
UI_LoadFaild: '读档失败!',
UI_LoadFailed: '读档失败!',
UI_CopySuccess: '成功复制存档到剪贴板',
UI_CopyFaild: '复制存档到剪贴板失败,请手动复制存档内容',
UI_CopyFailed: '复制存档到剪贴板失败,请手动复制存档内容',
UI_PasteSuccessDecodeSuccess: '读档成功!',
UI_PasteSuccessDecodeFaild: '粘贴剪贴板存档内容成功,但剪贴板内容读档失败',
UI_PasteFaildDecodeSuccess: '粘贴剪贴板存档内容失败,使用输入的内容读档成功',
UI_PasteFaildDecodeFaild: '粘贴剪贴板存档内容失败,使用输入的内容读档失败',
UI_PasteSuccessDecodeFailed: '粘贴剪贴板存档内容成功,但剪贴板内容读档失败',
UI_PasteFailedDecodeSuccess: '粘贴剪贴板存档内容失败,使用输入的内容读档成功',
UI_PasteFailedDecodeFailed: '粘贴剪贴板存档内容失败,使用输入的内容读档失败',
UI_Title_Celebrity: '你的前世是...',
UI_CustomMode: '经典模式',
UI_CustomModeDescription: '10连抽天赋\n自由分配属性',
UI_CelebrityMode: '名人模式',
UI_CelebrityModeDescription: '前世是古代名人\n重开到了现代',
UI_AllNot: '↻都不是',
M_NoRank: '别卷了,没有排行榜',
M_PleaseSelectOne: '请选择一个名人',
M_DisableExtendTalent: '名人模式不能继承天赋',
F_RemakeTimes: '已重开{0}次',
F_AchievementCount: '成就达成{0}个',
@@ -145,4 +155,5 @@ export default ({
F_TalentSelectNotComplect: '要选满{0}个天赋',
F_PropertyPointLeft: '你还有 {0} 属性点没有分配完',
F_TalentReplace: '天赋替换【{source.name}】->【{target.name}】',
F_PropertyStr: '颜值{CHR} 智力{INT} 体质{STR} 家境{MNY}'
});

71
src/modules/character.js Normal file
View File

@@ -0,0 +1,71 @@
import { clone, weightRandom } from '../functions/util.js';
class Character {
constructor() {}
#characters;
#characterPullCount;
#rateableKnife;
#rate;
initial({characters}) {
this.#characters = characters;
return this.count;
}
get count() {
return Object.keys(this.#characters).length;
}
config({
characterPullCount = 3,
rateableKnife = 10,
} = {}) {
this.#characterPullCount = characterPullCount;
this.#rateableKnife = rateableKnife;
}
random() {
return this.rateable();
}
rateable() {
if(!this.#rate) {
this.#rate = {};
for(const id in this.#characters) {
this.#rate[id] = 1;
}
}
const r = [];
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=>clone(this.#characters[id]));
}
}
export default Character;

View File

@@ -3,6 +3,7 @@ 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() {
@@ -10,12 +11,14 @@ class Life {
this.#event = new Event();
this.#talent = new Talent();
this.#achievement = new Achievement();
this.#character = new Character();
}
#property;
#event;
#talent;
#achievement;
#character;
#triggerTalents;
#defaultPropertyPoints;
#talentSelectLimit;
@@ -25,11 +28,12 @@ class Life {
#initialData;
async initial(i18nLoad, commonLoad) {
const [age, talents, events, achievements, specialThanks] = await Promise.all([
const [age, talents, events, achievements, characters, specialThanks] = await Promise.all([
i18nLoad('age'),
i18nLoad('talents'),
i18nLoad('events'),
i18nLoad('achievement'),
i18nLoad('character'),
commonLoad('specialthanks'),
]);
this.#specialThanks = specialThanks;
@@ -39,8 +43,8 @@ class Life {
[this.PropertyTypes.TEVT]: this.#event.initial({events}),
[this.PropertyTypes.TTLT]: this.#talent.initial({talents}),
};
this.#property.initial({age, total});
this.#character.initial({characters});
}
config({
@@ -50,6 +54,7 @@ class Life {
defaultPropertys = {}, // default propertys
talentConfig, // config for talent
propertyConfig, // config for property
characterConfig, // config for character
} = {}) {
this.#defaultPropertyPoints = defaultPropertyPoints;
this.#talentSelectLimit = talentSelectLimit;
@@ -57,6 +62,7 @@ class Life {
this.#defaultPropertys = defaultPropertys;
this.#talent.config(talentConfig);
this.#property.config(propertyConfig);
this.#character.config(characterConfig);
}
remake(talents) {
@@ -173,12 +179,22 @@ class Life {
);
}
characterRandom() {
const characters = this.#character.random();
characters.forEach(
v=>v.talent=v.talent.map(
id=>this.#talent.get(id)
)
);
return characters;
}
talentExtend(talentId) {
this.#property.set(this.PropertyTypes.EXT, talentId);
}
exclusive(talents, exclusive) {
return this.#talent.exclusive(talents, exclusive);
exclude(talents, exclusive) {
return this.#talent.exclude(talents, exclusive);
}
#getJudges(...types) {

View File

@@ -411,7 +411,7 @@ class Property {
lsget(key) {
const data = localStorage.getItem(key);
if(data === null) return;
if(data === null || data === 'undefined') return;
return JSON.parse(data);
}

View File

@@ -61,11 +61,11 @@ class Talent {
return { grade, name, description };
}
exclusive(talends, exclusiveId) {
const { exclusive } = this.get(exclusiveId);
if(!exclusive) return null;
for(const talent of talends) {
for(const e of exclusive) {
exclude(talents, excludeId) {
const { exclude } = this.get(excludeId);
if(!exclude) return null;
for(const talent of talents) {
for(const e of exclude) {
if(talent == e) return talent;
}
}
@@ -103,13 +103,14 @@ 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 } = this.#talents[talentId];
const { id, grade, name, description, exclusive } = this.#talents[talentId];
if(!!exclusive) continue;
if(id == include) {
include = { grade, name, description, id };
continue;
@@ -155,14 +156,14 @@ class Talent {
if(replacement.grade) {
this.forEach(({id, grade})=>{
if(!replacement.grade[grade]) return;
if(this.exclusive(talents, id)) return;
if(this.exclude(talents, id)) return;
list.push([id, replacement.grade[grade]]);
})
}
if(replacement.talent) {
for(let id in replacement.talent) {
id = Number(id);
if(this.exclusive(talents, id)) continue;
if(this.exclude(talents, id)) continue;
list.push([id, replacement.talent[id]]);
}
}

47
src/ui/laya.patch.js Normal file
View File

@@ -0,0 +1,47 @@
// 滚动条太灵敏
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,6 +475,12 @@ 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 =
@@ -534,4 +540,32 @@ 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

@@ -0,0 +1,87 @@
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;
}
#characters;
#selected;
static #createComponent = Laya.plugin.extractComponents(CyberCelebrity.uiView, ['boxCharacter','boxTalent']);
#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;
vboxStates.getChildByName('label').text = $_.format($lang.F_PropertyStr, property);
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;
}
init() {
this.random();
}
close() {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
}
random() {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
this.#characters = core.characterRandom();
this.#characters.forEach(character => {
const item = this.#createCharacterItem(character);
this.vboxCharacter.addChild(item);
item.click(()=>{
if(this.#selected) this.#selected.switch(false);
this.#selected = item;
item.switch(true);
item.event(Laya.Event.RESIZE);
});
});
}
next() {
if(!this.#selected) {
$$event('message', ['M_PleaseSelectOne']);
return;
}
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.TALENT));
this.btnRemake.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.MODE));
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']);

View File

@@ -0,0 +1,7 @@
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

@@ -67,6 +67,7 @@ export default class CyberProperty extends ui.view.CyberTheme.CyberPropertyUI {
{
propertyAllocate: this.#propertyAllocate,
talents: this.listSelectedTalents.array,
enableExtend: true,
}
);
}

View File

@@ -6,6 +6,7 @@ export default class CyberSummary extends ui.view.CyberTheme.CyberSummaryUI {
}
#selectedTalent;
#enableExtend;
onAgain() {
core.talentExtend(this.#selectedTalent);
@@ -13,8 +14,10 @@ export default class CyberSummary extends ui.view.CyberTheme.CyberSummaryUI {
$ui.switchView(UI.pages.MAIN);
}
init({talents}) {
init({talents, enableExtend}) {
const {summary, lastExtendTalent} = core;
this.#enableExtend = enableExtend;
const gradeFilters = $ui.common.filter;
const gradeColors = $ui.common.grade;
@@ -68,7 +71,11 @@ export default class CyberSummary extends ui.view.CyberTheme.CyberSummaryUI {
if(b == lastExtendTalent) return 1;
return bg - ag;
});
this.#selectedTalent = talents[0].id;
if(this.#enableExtend) {
this.#selectedTalent = talents[0].id;
} else {
this.#selectedTalent = lastExtendTalent;
}
this.listSelectedTalents.array = talents;
}
@@ -115,6 +122,9 @@ 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 });
$ui.switchView(UI.pages.PROPERTY, { talents, enableExtend: true});
}
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.exclusive(
const exclusive = core.exclude(
[...this.#selected].map(index => this.listTalents.array[index].id),
this.listTalents.array[index].id
);

View File

@@ -109,16 +109,17 @@ 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();
}
@@ -141,7 +142,7 @@ export default class CyberTrajectory extends ui.view.CyberTheme.CyberTrajectoryU
);
this.vboxTrajectory.addChild(item);
this.#trajectoryItems.push(item);
this.#trajectoryItems.forEach((item, index) => item.y = index);
item.y = this.vboxTrajectory.height;
}
onSummary() {

View File

@@ -0,0 +1,89 @@
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;
}
#characters;
#selected;
static #createComponent = Laya.plugin.extractComponents(Celebrity.uiView, ['boxCharacter','boxTalent']);
#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;
vboxStates.label = $_.format($lang.F_PropertyStr, property);
$_.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;
}
init() {
this.random();
}
close() {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
}
random() {
this.#selected = null;
this.vboxCharacter.destroyChildren(true);
this.#characters = core.characterRandom();
this.#characters.forEach(character => {
const item = this.#createCharacterItem(character);
this.vboxCharacter.addChild(item);
item.click(()=>{
if(this.#selected) this.#selected.switch(false);
this.#selected = item;
item.switch(true);
item.event(Laya.Event.RESIZE);
});
});
}
next() {
if(!this.#selected) {
$$event('message', ['M_PleaseSelectOne']);
return;
}
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.TALENT));
this.btnRemake.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.MODE));
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']);

View File

@@ -0,0 +1,7 @@
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

@@ -67,6 +67,7 @@ export default class Property extends ui.view.DefaultTheme.PropertyUI {
{
propertyAllocate: this.#propertyAllocate,
talents: this.listSelectedTalents.array,
enableExtend: true,
}
);
}

View File

@@ -7,6 +7,7 @@ export default class Summary extends ui.view.DefaultTheme.SummaryUI {
}
#selectedTalent;
#enableExtend;
onAgain() {
core.talentExtend(this.#selectedTalent);
@@ -14,8 +15,9 @@ export default class Summary extends ui.view.DefaultTheme.SummaryUI {
$ui.switchView(UI.pages.MAIN);
}
init({talents}) {
init({talents, enableExtend}) {
const {summary, lastExtendTalent} = core;
this.#enableExtend = enableExtend;
this.listSummary.array = [
[core.PropertyTypes.HCHR, $lang.UI_Property_Charm],
@@ -38,7 +40,11 @@ export default class Summary extends ui.view.DefaultTheme.SummaryUI {
if(b == lastExtendTalent) return 1;
return bg - ag;
});
this.#selectedTalent = talents[0].id;
if(this.#enableExtend) {
this.#selectedTalent = talents[0].id;
} else {
this.#selectedTalent = lastExtendTalent;
}
this.listSelectedTalents.array = talents;
}
renderSummary(box) {
@@ -57,6 +63,9 @@ export default class Summary extends ui.view.DefaultTheme.SummaryUI {
}
onSelectTalent(talentId) {
if(!this.#enableExtend) {
return $$event('message', ['M_DisableExtendTalent']);
}
if(talentId == this.#selectedTalent) {
this.#selectedTalent = null;
} else {

View File

@@ -8,7 +8,6 @@ export default class Talent extends ui.view.DefaultTheme.TalentUI {
}
#selected = new Set();
init() {
this.pageDrawCard.visible = true;
this.pageResult.visible = false;
@@ -30,7 +29,7 @@ export default class Talent extends ui.view.DefaultTheme.TalentUI {
}
const talents = [...this.#selected].map(index => this.listTalents.array[index]);
$ui.switchView(UI.pages.PROPERTY, { talents });
$ui.switchView(UI.pages.PROPERTY, { talents, enableExtend: true });
}
renderTalent(box, index) {
@@ -55,7 +54,7 @@ export default class Talent extends ui.view.DefaultTheme.TalentUI {
if(this.#selected.size >= core.talentSelectLimit) {
return $$event('message', ['F_TalentSelectLimit', core.talentSelectLimit]);
}
const exclusive = core.exclusive(
const exclusive = core.exclude(
[...this.#selected].map(index => this.listTalents.array[index].id),
this.listTalents.array[index].id
);

View File

@@ -88,16 +88,17 @@ export default class Trajectory extends ui.view.DefaultTheme.TrajectoryUI {
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();
}
@@ -117,7 +118,7 @@ export default class Trajectory extends ui.view.DefaultTheme.TrajectoryUI {
item.grade(content[content.length - 1].grade);
this.vboxTrajectory.addChild(item);
this.#trajectoryItems.push(item);
this.#trajectoryItems.forEach((item, index) => item.y = index);
item.y = this.vboxTrajectory.height;
}
onSummary() {

View File

@@ -14,7 +14,7 @@ export default class MessagePopup extends ui.view.MessagePopupUI {
Laya.Tween.clearAll(this);
this.alpha = 0;
this.y = - 2 * this.height;
await Laya.promises.Tween.to(this, { y: 0, alpha: 1 }, 300, Laya.Ease.backOut),
await Laya.promises.Tween.to(this, { y: 0, alpha: 1 }, 300, Laya.Ease.backOut);
await Laya.promises.Tween.to(this, { alpha: 0}, 300, Laya.Ease.strongIn, 3000);
}
}

View File

@@ -7,22 +7,22 @@ export default class SaveLoad extends ui.view.SaveLoadUI {
});
this.btnRead.on(Laya.Event.CLICK, this, async ()=>{
const result = await $$copy(this.input.text = this.data);
$$event('message', [result? 'UI_CopySuccess': 'UI_CopyFaild']);
$$event('message', [result? 'UI_CopySuccess': 'UI_CopyFailed']);
});
this.btnWrite.on(Laya.Event.CLICK, this, async ()=>{
const text = await $$read();
if(text == false) {
this.data = [
this.input.text,
'UI_PasteFaildDecodeSuccess',
'UI_PasteFaildDecodeFaild'
'UI_PasteFailedDecodeSuccess',
'UI_PasteFailedDecodeFailed'
];
} else {
this.input.text = text;
this.data = [
text,
'UI_PasteSuccessDecodeSuccess',
'UI_PasteSuccessDecodeFaild'
'UI_PasteSuccessDecodeFailed'
];
}
});
@@ -79,7 +79,7 @@ export default class SaveLoad extends ui.view.SaveLoadUI {
return JSON.stringify(data);
}
set data([v, success = 'UI_LoadSuccess', faild = 'UI_LoadFaild']) {
set data([v, success = 'UI_LoadSuccess', Failed = 'UI_LoadFailed']) {
try {
const data = JSON.parse(v);
for(const key in data)
@@ -89,7 +89,7 @@ export default class SaveLoad extends ui.view.SaveLoadUI {
this.btnClose.event(Laya.Event.CLICK);
} catch (e) {
console.error(e);
$$event('message', [faild]);
$$event('message', [Failed]);
}
}
}

View File

@@ -9,6 +9,8 @@ const pages = {
THANKS: 'THANKS',
THEMES: 'THEMES',
SAVELOAD: 'SAVELOAD',
MODE: 'MODE',
CELEBRITY: 'CELEBRITY'
};
const popups = {
@@ -28,6 +30,8 @@ const cyber = {
[pages.THANKS]: "default/thanks",
[pages.THEMES]: 'themes',
[pages.SAVELOAD]: 'saveload',
[pages.MODE]: 'cyber/mode',
[pages.CELEBRITY]: 'cyber/celebrity',
},
popups: {
[popups.ACHIEVEMENT]: "cyber/popup/achievementPopup",
@@ -57,20 +61,22 @@ const cyber = {
],
gradeBlk: [
{
defaultColor: '#cccccc',
hoverColor: '#cccccc',
visible: false,
},
{
defaultColor: '#55fffe',
hoverColor: '#55fffe',
visible: true,
},
{
defaultColor: '#b17cff',
hoverColor: '#b17cff',
visible: true,
},
{
defaultColor: '#ffce45',
hoverColor: '#ffce45',
visible: true,
},
]
},
@@ -190,6 +196,8 @@ const dark = {
[pages.THANKS]: "default/thanks",
[pages.THEMES]: 'themes',
[pages.SAVELOAD]: 'saveload',
[pages.MODE]: 'default/mode',
[pages.CELEBRITY]: 'default/celebrity',
},
popups: {
[popups.ACHIEVEMENT]: "default/popup/achievementPopup",
@@ -201,7 +209,10 @@ const dark = {
defaultFontColor: '#eeeeee',
trajectoryItem: {
box: {
filters: ()=>[new Laya.GlowFilter("#eeeeee", 8, 0, 0)],
// filters: ()=>[new Laya.GlowFilter("#eeeeee", 8, 0, 0)],
defaultStroke: '#eeeeee',
hoverStroke: '#eeeeee',
lineWidth: 2,
},
grade: [
{
@@ -411,7 +422,28 @@ const dark = {
lineWidth: 4,
radius: 0,
}
]
],
characterItem: {
name: {
defaultColor: '#393e46',
defaultStroke: '#eeeeee',
defaultLabel: '#eeeeee',
hoverColor: '#ff7878',
hoverStroke: '#eeeeee',
hoverLabel: '#eeeeee',
lineWidth: 2,
},
state: {
defaultColor: '#393e46',
defaultStroke: '#eeeeee',
defaultLabel: '#eeeeee',
hoverColor: '#393e46',
hoverStroke: '#eeeeee',
hoverLabel: '#eeeeee',
lineWidth: 2,
},
propertyColor: '#000000',
},
},
class: {
btn_main: {
@@ -616,6 +648,18 @@ const dark = {
}
}
},
[pages.MODE]: {
names: {
font_default: 'font_default',
btn: 'btn_main',
}
},
[pages.CELEBRITY]: {
vars: {
btnRetry: 'btn_main',
btnNext: 'btn_main',
}
},
},
popups: {
[popups.ACHIEVEMENT]: {
@@ -644,6 +688,8 @@ const light = {
[pages.THANKS]: "default/thanks",
[pages.THEMES]: 'themes',
[pages.SAVELOAD]: 'saveload',
[pages.MODE]: 'default/mode',
[pages.CELEBRITY]: 'default/celebrity',
},
popups: {
[popups.ACHIEVEMENT]: "default/popup/achievementPopup",
@@ -655,7 +701,10 @@ const light = {
defaultFontColor: '#000000',
trajectoryItem: {
box: {
filters: ()=>[new Laya.GlowFilter("#b1b1b1", 8, 0, 0)],
// filters: ()=>[new Laya.GlowFilter("#b1b1b1", 8, 0, 0)],
defaultStroke: '#b1b1b1',
hoverStroke: '#b1b1b1',
lineWidth: 2,
},
grade: [
{},
@@ -860,7 +909,28 @@ const light = {
lineWidth: 4,
radius: 0,
}
]
],
characterItem: {
name: {
defaultColor: '#ffffff',
defaultStroke: '#cccccc',
defaultLabel: '#000000',
hoverColor: '#ff7878',
hoverStroke: '#cccccc',
hoverLabel: '#ffffff',
lineWidth: 2,
},
state: {
defaultColor: '#ffffff',
defaultStroke: '#cccccc',
defaultLabel: '#000000',
hoverColor: '#ffffff',
hoverStroke: '#cccccc',
hoverLabel: '#000000',
lineWidth: 2,
},
propertyColor: '#000000',
},
},
class: {
btn_main: {
@@ -1065,6 +1135,18 @@ const light = {
}
}
},
[pages.MODE]: {
names: {
font_default: 'font_default',
btn: 'btn_main',
}
},
[pages.CELEBRITY]: {
vars: {
btnRetry: 'btn_main',
btnNext: 'btn_main',
}
},
},
popups: {
[popups.ACHIEVEMENT]: {