add message popup

This commit is contained in:
Vick Scarlet
2021-12-01 16:07:03 +08:00
parent eb02d1ee6f
commit f0317eaf14
13 changed files with 141 additions and 6 deletions
+1
View File
@@ -7,6 +7,7 @@ export default class CyberAchievement extends ui.view.CyberTheme.CyberAchievemen
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.btnRank.on(Laya.Event.CLICK, this, $$event, ['message', ['M_NoRank']]);
this.listAchievements.renderHandler = new Laya.Handler(this, this.onRenderAchievement);
this.listAchievements.scrollBar.elasticDistance = 150;
+3 -2
View File
@@ -57,8 +57,9 @@ export default class CyberProperty extends ui.view.CyberTheme.CyberPropertyUI {
}
next() {
if (this.total < this.#propertyPoints) {
return;
const left = this.#propertyPoints - this.total;
if (left > 0) {
return $$event('message', ['F_PropertyPointLeft', left]);
}
$ui.switchView(
UI.pages.TRAJECTORY,
+11 -1
View File
@@ -36,7 +36,7 @@ export default class CyberTalent extends ui.view.CyberTheme.CyberTalentUI {
onClickNext() {
if(this.#selected.size < core.talentSelectLimit) {
return;
return $$event('message', ['F_TalentSelectNotComplect', core.talentSelectLimit]);
}
const talents = [...this.#selected].map(index => this.listTalents.array[index]);
@@ -97,6 +97,16 @@ export default class CyberTalent extends ui.view.CyberTheme.CyberTalentUI {
this.#selected.delete(index);
} else {
if(this.#selected.size >= core.talentSelectLimit) {
return $$event('message', ['F_TalentSelectLimit', core.talentSelectLimit]);
}
const exclusive = core.exclusive(
[...this.#selected].map(index => this.listTalents.array[index].id),
this.listTalents.array[index].id
);
if(exclusive != null) {
for(const {name, id} of this.listTalents.array)
if(exclusive == id)
return $$event('message', ['F_TalentConflict', name]);
return;
}
this.#selected.add(index);
+1
View File
@@ -2,6 +2,7 @@ export default class Achievement extends ui.view.DefaultTheme.AchievementUI {
constructor() {
super();
this.btnBack.on(Laya.Event.CLICK, this, () => $ui.switchView(UI.pages.MAIN));
this.btnRank.on(Laya.Event.CLICK, this, $$event, ['message', ['M_NoRank']]);
this.listAchievements.renderHandler = new Laya.Handler(this, this.onRenderAchievement);
this.listAchievements.scrollBar.elasticDistance = 150;
}
+3 -2
View File
@@ -57,8 +57,9 @@ export default class Property extends ui.view.DefaultTheme.PropertyUI {
}
next() {
if (this.total < this.#propertyPoints) {
return;
const left = this.#propertyPoints - this.total;
if (left > 0) {
return $$event('message', ['F_PropertyPointLeft', left]);
}
$ui.switchView(
UI.pages.TRAJECTORY,
+11 -1
View File
@@ -26,7 +26,7 @@ export default class Talent extends ui.view.DefaultTheme.TalentUI {
onClickNext() {
if(this.#selected.size < core.talentSelectLimit) {
return;
return $$event('message', ['F_TalentSelectNotComplect', core.talentSelectLimit]);
}
const talents = [...this.#selected].map(index => this.listTalents.array[index]);
@@ -53,6 +53,16 @@ export default class Talent extends ui.view.DefaultTheme.TalentUI {
this.#selected.delete(index);
} else {
if(this.#selected.size >= core.talentSelectLimit) {
return $$event('message', ['F_TalentSelectLimit', core.talentSelectLimit]);
}
const exclusive = core.exclusive(
[...this.#selected].map(index => this.listTalents.array[index].id),
this.listTalents.array[index].id
);
if(exclusive != null) {
for(const {name, id} of this.listTalents.array)
if(exclusive == id)
return $$event('message', ['F_TalentConflict', name]);
return;
}
this.#selected.add(index);
+18
View File
@@ -0,0 +1,18 @@
export default class MessagePopup extends ui.view.MessagePopupUI {
constructor() {
super();
this.left = this.right = 0;
this.boxBg.defaultColor = "#000000";
this.boxBg.hoverColor = "#000000";
this.boxBg.radius = 20;
}
async popup({message}, parent) {
Laya.Tween.clearAll(this);
this.alpha = 0;
this.y = - 2 * this.height;
this.message.text = message;
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);
}
}
+4
View File
@@ -11,6 +11,7 @@ const pages = {
const popups = {
ACHIEVEMENT: 'POPUP_ACHIEVEMENT',
MESSAGE: 'POPUP_MESSAGE',
};
const cyber = {
@@ -26,6 +27,7 @@ const cyber = {
},
popups: {
[popups.ACHIEVEMENT]: "cyber/popup/achievementPopup",
[popups.MESSAGE]: "message",
},
configs: {
bgColor: '#04131f',
@@ -100,6 +102,7 @@ const dark = {
},
popups: {
[popups.ACHIEVEMENT]: "default/popup/achievementPopup",
[popups.MESSAGE]: "message",
},
configs: {
bgColor: '#222831',
@@ -475,6 +478,7 @@ const light = {
},
popups: {
[popups.ACHIEVEMENT]: "default/popup/achievementPopup",
[popups.MESSAGE]: "message",
},
configs: {
bgColor: '#ffffff',