add thanks

This commit is contained in:
Vick Scarlet
2021-11-28 13:17:41 +08:00
parent e1e2ab4701
commit 0e272ffd99
12 changed files with 388 additions and 116 deletions
+42 -1
View File
@@ -20,6 +20,44 @@ class App{
};
#initLaya() {
/**
*...特殊的字符,如泰文,必须重新实现这个类
*/
//class laya.webgl.text.CharSegment
var CharSegment=(function(){
function CharSegment(){
this._sourceStr=null;
}
Laya.class(CharSegment,'laya.webgl.text.CharSegment');
var __proto=CharSegment.prototype;
Laya.imps(__proto,{"laya.webgl.text.ICharSegment":true})
__proto.textToSpit=function(str){
this._sourceStr=str;
var texLen = str.length;
var idx = -1;
this._words = [];
while (++idx < texLen) {
var character = str.charAt(idx);
var code = str.charCodeAt(idx);
if (code >= 0xD800 && code <= 0xDBFF) {
this._words.push(character + str.charAt(++idx));
} else {
this._words.push(character);
}
}
}
__proto.getChar=function(i){
return this._words;
}
__proto.getCharCode=function(i){
return this._words[i].codePointAt(0);
}
__proto.length=function(){
return this._words.length;
}
return CharSegment;
})()
// Laya.init(1125, 2436, Laya.WebGL);
Laya.Config.isAntialias = true;
Laya.init(...this.#fitScreen, Laya.WebGL);
@@ -91,7 +129,10 @@ class App{
await this.#setLanguage(language);
await $ui.setLoading(UI.pages.LOADING);
await $ui.switchView(UI.pages.LOADING);
await core.initial(dataSet=>Laya.promises.loader.load(`data/${this.#language}/${dataSet}.json`, null, Laya.Loader.JSON));
await core.initial(
dataSet=>Laya.promises.loader.load(`data/${this.#language}/${dataSet}.json`, null, Laya.Loader.JSON),
dataSet=>Laya.promises.loader.load(`data/${dataSet}.json`, null, Laya.Loader.JSON),
);
await $ui.switchView(UI.pages.MAIN);
}
}
+3
View File
@@ -116,6 +116,9 @@ export default ({
UI_Achievement_Count_Judge_Level_4: 'Orange rate Quintuple',
UI_Achievement_Count_Judge_Level_5: 'Orange rate Sextuple',
UI_Support_Programmer: 'Programmer',
UI_Support_Designer: 'Designer',
F_RemakeTimes: 'Remake {0} Times',
F_AchievementCount: 'Achievement {0}',
F_TalentSelection: '{name} ({description})',
+3
View File
@@ -116,6 +116,9 @@ export default ({
UI_Achievement_Count_Judge_Level_4: '抽到橙色概率五倍',
UI_Achievement_Count_Judge_Level_5: '抽到橙色概率六倍',
UI_Support_Programmer: '打赏程序(顿顿饭)',
UI_Support_Designer: '打赏策划(爱发电)',
F_RemakeTimes: '已重开{0}次',
F_AchievementCount: '成就达成{0}个',
F_TalentSelection: '{name}{description}',
+2
View File
@@ -6,6 +6,8 @@ globalThis.goto = async tag => {
switch(tag) {
case 'github': url = 'https://github.com/VickScarlet/lifeRestart'; break;
case 'discord': url = 'https://discord.gg/U3qrf49NMQ'; break;
case 'sponsor_afd': url = 'https://afdian.net/@LifeRestart'; break;
case 'sponsor_ddf': url = 'https://dun.mianbaoduo.com/@vickscarlet'; break;
}
try {
window.open(url, '_blank');
+10 -6
View File
@@ -21,14 +21,17 @@ class Life {
#talentSelectLimit;
#propertyAllocateLimit;
#defaultPropertys;
#specialThanks;
async initial(loadJSON) {
const [age, talents, events, achievements] = await Promise.all([
loadJSON('age'),
loadJSON('talents'),
loadJSON('events'),
loadJSON('achievement'),
async initial(i18nLoad, commonLoad) {
const [age, talents, events, achievements, specialThanks] = await Promise.all([
i18nLoad('age'),
i18nLoad('talents'),
i18nLoad('events'),
i18nLoad('achievement'),
commonLoad('specialthanks'),
]);
this.#specialThanks = specialThanks;
const total = {
[this.PropertyTypes.TACEV]: this.#achievement.initial({achievements}),
@@ -246,6 +249,7 @@ class Life {
this.#property
)
}
get specialThanks() { return this.#specialThanks; }
}
export default Life;
File diff suppressed because one or more lines are too long
-6
View File
@@ -1,6 +0,0 @@
export default class CyberThanks extends CyberThanksUI {
constructor() {
super();
this.btnBack.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.MAIN));
}
}
+53
View File
@@ -2,5 +2,58 @@ export default class Thanks extends ThanksUI {
constructor() {
super();
this.btnBack.on(Laya.Event.CLICK, this, ()=>$ui.switchView(UI.pages.MAIN));
this.listSupports.renderHandler = Laya.Handler.create(this, this.renderSupport, null, false);
this.panelTopSupports.vScrollBar.elasticDistance = 150;
this.listSupports.scrollBar.elasticDistance = 150;
this.btnAFD.on(Laya.Event.CLICK, this, goto, ['sponsor_afd']);
this.btnDDF.on(Laya.Event.CLICK, this, goto, ['sponsor_ddf']);
}
static #createComponent = plugin.extractComponents(Thanks.uiView, ['boxTopSupport']);
#createTopSupportItem() {
const item = Thanks.#createComponent('boxTopSupport');
item.name = item.getChildByName('name');
item.comment = item.getChildByName('comment');
$_.deepMapSet(item, $ui.common.topSupportItem);
return item;
}
#topSupports;
init() {
const supports = [];
this.#topSupports = [];
core.specialThanks
.sort(()=>0.5-Math.random())
.forEach(({group, name, comment, color})=>
group == 2
? supports.push({name, color})
: this.renderTopSupport(name, comment, color)
);
this.listSupports.array = supports;
}
renderTopSupport(name, comment, color) {
const item = this.#createTopSupportItem();
item.name.text = name;
item.comment.text = comment;
item.name.color = color || '#000000';
this.vboxTopSupports.addChild(item);
this.#topSupports.push(item);
this.#topSupports.forEach((item, index) => item.y = index);
}
renderSupport(label) {
const {name, color} = label.dataSource;
label.text = name;
label.color = color || $ui.common.defaultFontColor;
}
close() {
this.#topSupports.forEach(item => {
item.removeSelf();
item.destroy();
});
this.#topSupports = null;
}
}
+90 -11
View File
@@ -22,7 +22,7 @@ const cyber = {
[pages.TRAJECTORY]: "cyber/trajectory",
[pages.SUMMARY]: "cyber/summary",
[pages.ACHIEVEMENT]: "cyber/achievement",
[pages.THANKS]: "cyber/thanks",
[pages.THANKS]: "default/thanks",
},
popups: {
[popups.ACHIEVEMENT]: "cyber/popup/achievementPopup",
@@ -30,6 +30,13 @@ const cyber = {
configs: {
bgColor: '#04131f',
common: {
topSupportItem: {
defaultColor: '#ffa500',
defaultStroke: '#ffa500',
hoverColor: '#ffc500',
hoverStroke: '#ffa500',
},
defaultFontColor: '#cccccc',
grade: [
'#cccccc',
'#55fffe',
@@ -43,6 +50,40 @@ const cyber = {
'#ffce45ff',
],
},
pages: {
[pages.THANKS]: {
vars: {
btnBack: {
defaultColor: '#5865f2',
defaultStroke: '#eeeeee',
defaultLabel: '#eeeeee',
hoverColor: '#1160b0',
hoverStroke: '#eeeeee',
hoverLabel: '#eeeeee',
lineWidth: 0,
radius: 4,
},
btnAFD: {
defaultColor: '#8764de',
defaultStroke: '#8764de',
defaultLabel: '#ffffff',
hoverColor: '#9774ee',
hoverStroke: '#9774ee',
hoverLabel: '#ffffff',
radius: 4,
},
btnDDF: {
defaultColor: '#cc6699',
defaultStroke: '#cc6699',
defaultLabel: '#ffffff',
hoverColor: '#dc76a9',
hoverStroke: '#dc76a9',
hoverLabel: '#ffffff',
radius: 4,
},
},
}
}
}
}
@@ -68,15 +109,19 @@ const dark = {
box: {
defaultColor: '#4a5361',
defaultStroke: '#4a5361',
defaultLabel: '#eeeeee',
hoverColor: '#4a5361',
hoverStroke: '#4a5361',
hoverLabel: '#eeeeee',
filters: ()=>[new Laya.GlowFilter("#eeeeee", 8, 0, 0)],
},
ageColor: '#ffffee',
contentColor: '#eeeeee',
},
topSupportItem: {
defaultColor: '#ffa500',
defaultStroke: '#ffa500',
hoverColor: '#ffc500',
hoverStroke: '#ffa500',
},
grade: [
'#cccccc',
'#55fffe',
@@ -381,6 +426,24 @@ const dark = {
[pages.THANKS]: {
vars: {
btnBack: 'btn_small',
btnAFD: {
defaultColor: '#8764de',
defaultStroke: '#8764de',
defaultLabel: '#ffffff',
hoverColor: '#9774ee',
hoverStroke: '#9774ee',
hoverLabel: '#ffffff',
radius: 4,
},
btnDDF: {
defaultColor: '#cc6699',
defaultStroke: '#cc6699',
defaultLabel: '#ffffff',
hoverColor: '#dc76a9',
hoverStroke: '#dc76a9',
hoverLabel: '#ffffff',
radius: 4,
},
},
}
},
@@ -419,19 +482,17 @@ const light = {
defaultFontColor: '#000000',
trajectoryItem: {
box: {
defaultColor: '#ffffff',
defaultStroke: '#ffffff',
defaultLabel: '#000000',
hoverColor: '#ffffff',
hoverStroke: '#ffffff',
hoverLabel: '#000000',
lineWidth: 0,
radius: 0,
filters: ()=>[new Laya.GlowFilter("#b1b1b1", 8, 0, 0)],
},
ageColor: '#000000',
contentColor: '#000000',
},
topSupportItem: {
defaultColor: '#ffa500',
defaultStroke: '#ffa500',
hoverColor: '#ffc500',
hoverStroke: '#ffa500',
},
grade: [
'#000000',
'#55fffe',
@@ -734,6 +795,24 @@ const light = {
[pages.THANKS]: {
vars: {
btnBack: 'btn_small',
btnAFD: {
defaultColor: '#8764de',
defaultStroke: '#8764de',
defaultLabel: '#ffffff',
hoverColor: '#9774ee',
hoverStroke: '#9774ee',
hoverLabel: '#ffffff',
radius: 4,
},
btnDDF: {
defaultColor: '#cc6699',
defaultStroke: '#cc6699',
defaultLabel: '#ffffff',
hoverColor: '#dc76a9',
hoverStroke: '#dc76a9',
hoverLabel: '#ffffff',
radius: 4,
}
},
}
},