update achievement

This commit is contained in:
Vick Scarlet
2021-11-12 19:48:58 +08:00
parent c94e9e7433
commit 660739530b
6 changed files with 331 additions and 96 deletions

View File

@@ -16,6 +16,8 @@ export default ({
UI_Error: 'Error',
UI_Colon: ':',
UI_Times: 'Times',
UI_Count: '',
UI_Property_Charm: 'CHR',
UI_Property_Intelligence: 'INT',
@@ -48,6 +50,11 @@ export default ({
UI_Final_Age: 'Age',
UI_Total_Judge: 'Judge',
'UI_Achievement_Count': 'Achievement',
'UI_Remake_Times': 'Remake Times',
'UI_Event_Collection_Rate': 'Event Collection',
'UI_Talent_Collection_Rate': 'Talent Collection',
'UI_Judge_Level_0': '地狱',
'UI_Judge_Level_1': '折磨',
'UI_Judge_Level_2': '不佳',

View File

@@ -16,6 +16,8 @@ export default ({
UI_Error: '错误',
UI_Colon: '',
UI_Times: '次',
UI_Count: '个',
UI_Property_Charm: '颜值',
UI_Property_Intelligence: '智力',
@@ -47,6 +49,12 @@ export default ({
UI_Final_Age: '享年',
UI_Total_Judge: '总评',
'UI_Achievement_Count': '获得成就',
'UI_Remake_Times': '重开次数',
'UI_Event_Collection_Rate': '事件收集率',
'UI_Talent_Collection_Rate': '天赋收集率',
'UI_Statistics': '统计',
'UI_Judge_Level_0': '地狱',
'UI_Judge_Level_1': '折磨',
'UI_Judge_Level_2': '不佳',
@@ -86,4 +94,18 @@ export default ({
'UI_Strength_Judge_Level_9': '金丹',
'UI_Strength_Judge_Level_10': '元婴',
'UI_Strength_Judge_Level_11': '仙体',
'UI_Remake_Times_Judge_Level_0': '抽到紫色概率不变',
'UI_Remake_Times_Judge_Level_1': '抽到紫色概率翻倍',
'UI_Remake_Times_Judge_Level_2': '抽到紫色概率三倍',
'UI_Remake_Times_Judge_Level_3': '抽到紫色概率四倍',
'UI_Remake_Times_Judge_Level_4': '抽到紫色概率五倍',
'UI_Remake_Times_Judge_Level_5': '抽到紫色概率六倍',
'UI_Achievement_Count_Judge_Level_0': '抽到橙色概率不变',
'UI_Achievement_Count_Judge_Level_1': '抽到橙色概率翻倍',
'UI_Achievement_Count_Judge_Level_2': '抽到橙色概率三倍',
'UI_Achievement_Count_Judge_Level_3': '抽到橙色概率四倍',
'UI_Achievement_Count_Judge_Level_4': '抽到橙色概率五倍',
'UI_Achievement_Count_Judge_Level_5': '抽到橙色概率六倍',
});

View File

@@ -199,7 +199,7 @@ class Life {
);
}
get status() {
get statistics() {
const pt = this.PropertyTypes;
return this.#getJudges( pt.TMS,

File diff suppressed because one or more lines are too long

View File

@@ -2,9 +2,105 @@ export default class cyberAchievement extends CyberAchievementUI {
constructor() {
super();
this.btnBack.on(Laya.Event.CLICK, this, () => UIManager.getInstance().switchView(UIManager.getInstance().themes.MAIN));
const min = Math.min(this.btnAchievement.fontSize, this.btnStatistics.fontSize);
const max = Math.max(this.btnAchievement.fontSize, this.btnStatistics.fontSize);
this.#state = {min, max};
this.btnStatistics.on(Laya.Event.CLICK, this, ()=>this.switch('statistics'));
this.btnAchievement.on(Laya.Event.CLICK, this, ()=>this.switch('achievement'));
this.listAchievements.renderHandler = new Laya.Handler(this, this.onRenderAchievement);
this.listAchievements.scrollBar.elasticDistance = 150;
}
#state;
#tweens;
get colorGrades() {
return [
this.colorGrade0.color,
this.colorGrade1.color,
this.colorGrade2.color,
this.colorGrade3.color,
];
}
get colorFilters() {
return [
this.colorGrade0.text,
this.colorGrade1.text,
this.colorGrade2.text,
this.colorGrade3.text,
]
}
init() {
const status = core.status;
this.switch('statistics', 0);
const {statistics, achievements, PropertyTypes: pt} = core;
this.listAchievements.array = achievements;
this.labRemakeTimes.text = statistics[pt.TMS].value;
this.labRemakeTimesJudge.text = statistics[pt.TMS].judge;
this.labAchievementCountJudge.color = this.colorGrades[statistics[pt.TMS].grade];
this.labAchievementCount.text = statistics[pt.CACHV].value;
this.labAchievementCountJudge.text = statistics[pt.CACHV].judge;
this.labAchievementCountJudge.color = this.colorGrades[statistics[pt.CACHV].grade];
this.labEventRate.text = parseInt(statistics[pt.REVT].value*100)+'%';
this.prgEventRate.value = statistics[pt.REVT].value;
this.labTalentRate.text = parseInt(statistics[pt.RTLT].value*100)+'%';
this.prgTalentRate.value = statistics[pt.RTLT].value;
}
switch(page, time=300) {
if(this.#tweens) {
this.#tweens.forEach(tween => Laya.Tween.clear(tween));
}
this.#tweens = [];
switch (page) {
case 'statistics':
time = - this.boxPage.x / this.width * time;
this.#tweens.push(
Laya.Tween.to(this.boxPage, {x: 0}, time, Laya.Ease.backOut, Laya.Handler.create(this, () => this.#tweens = null)),
Laya.Tween.to(this.btnStatistics, {fontSize: this.#state.max, anchorX: 0.5, anchorY: 1}, time, Laya.Ease.backOut),
Laya.Tween.to(this.btnAchievement, {fontSize: this.#state.min, anchorX: 0.5, anchorY: 1}, time, Laya.Ease.backOut),
);
break;
case 'achievement':
time = (this.width + this.boxPage.x) / this.width * time;
this.#tweens.push(
Laya.Tween.to(this.boxPage, {x: - this.width}, time, Laya.Ease.backOut, Laya.Handler.create(this, () => this.#tweens = null)),
Laya.Tween.to(this.btnStatistics, {fontSize: this.#state.min, anchorX: 0.5, anchorY: 1}, time, Laya.Ease.backOut),
Laya.Tween.to(this.btnAchievement, {fontSize: this.#state.max, anchorX: 0.5, anchorY: 1}, time, Laya.Ease.backOut),
);
break;
}
}
onRenderAchievement(box, index) {
const dataSource = box.dataSource;
const name = box.getChildByName('name');
const description = box.getChildByName('description');
const completed = box.getChildByName('completed');
const uncomplete = box.getChildByName('uncomplete');
if(dataSource.isAchieved) {
name.text = dataSource.name;
description.text = dataSource.description;
completed.visible = true;
uncomplete.visible = false;
} else {
name.text = dataSource.hide? '???': dataSource.name;
description.text = dataSource.hide? '???': dataSource.description;
completed.visible = false;
uncomplete.visible = true;
}
box.colorFilter = this.colorFilters[dataSource.grade];
}
}