|
@@ -9,15 +9,16 @@ cc.Class({
|
|
|
extends: cc.Component,
|
|
|
|
|
|
properties: {
|
|
|
- titleText: cc.RichText,
|
|
|
+ titleText: cc.Label,
|
|
|
confirmButton: cc.Button,
|
|
|
- confirmText: cc.RichText,
|
|
|
+ confirmText: cc.Label,
|
|
|
pageView: cc.PageView,
|
|
|
levelUpNode: cc.Node,
|
|
|
bgNode: cc.Node,
|
|
|
top: cc.Node,
|
|
|
|
|
|
consume: cc.Node,
|
|
|
+ consumeLevelUp: cc.Node,
|
|
|
user: cc.Node,
|
|
|
|
|
|
myActorList: [],
|
|
@@ -42,6 +43,8 @@ cc.Class({
|
|
|
}
|
|
|
|
|
|
this.consume.getComponent('Consume').setConfirmButton(this.confirmButton);
|
|
|
+
|
|
|
+ this.consumeLevelUp.getComponent('Consume').setConfirmButton(this.confirmButton);
|
|
|
},
|
|
|
|
|
|
start() {
|
|
@@ -82,8 +85,8 @@ cc.Class({
|
|
|
this.pageViewScript = this.pageView.getComponent('PVCtrl');
|
|
|
this.pageViewScript.bind(this.actorInfo.jobId, this.actorInfo.gender);
|
|
|
|
|
|
- this.titleText.string = '<b>职业转换</b>';
|
|
|
- this.confirmText.string = '<outline color=#690802 width=1><b>转职</b></outline>';
|
|
|
+ this.titleText.string = '职业转换';
|
|
|
+ this.confirmText.string = '转职';
|
|
|
|
|
|
JobApi.changeJobList(this.actorInfo.uid,
|
|
|
(response) => {
|
|
@@ -117,37 +120,36 @@ cc.Class({
|
|
|
this.pageViewScript = this.pageView.getComponent('PVCtrl');
|
|
|
this.pageViewScript.bind(0, this.actorInfo.gender);
|
|
|
|
|
|
- this.titleText.string = '<b>选择职业</b>';
|
|
|
- this.confirmText.string = '<outline color=#690802 width=1><b>确定</b></outline>';
|
|
|
+ this.titleText.string = '选择职业';
|
|
|
+ this.confirmText.string = '确定';
|
|
|
|
|
|
this.pageViewScript.bindSelectedJobText();
|
|
|
this.bindChooseJob(this.actorInfo);
|
|
|
},
|
|
|
|
|
|
levelUp() {
|
|
|
- this.consume.active = true;
|
|
|
+ this.consume.active = false;
|
|
|
+ this.consumeLevelUp.active = true;
|
|
|
this.user.active = false;
|
|
|
this.pageView.node.active = false;
|
|
|
this.levelUpNode.active = true;
|
|
|
|
|
|
- this.titleText.string = '<b>进阶</b>';
|
|
|
- this.confirmText.string = '<outline color=#690802 width=1><b>进阶</b></outline>';
|
|
|
+ this.titleText.string = '进阶';
|
|
|
+ this.confirmText.string = '进阶';
|
|
|
|
|
|
|
|
|
this.currentJobLevel = null;
|
|
|
this.nextJobLevel = null;
|
|
|
+
|
|
|
+ this.currentJobLevel = jobLevelList.find(n => {
|
|
|
+ return this.actorInfo.jobId == n.jobId && this.actorInfo.jobLevel == n.level
|
|
|
+ })
|
|
|
|
|
|
- for (var i = 0; i < jobLevelList.length; i++) {
|
|
|
- let jobLevelInfo = jobLevelList[i];
|
|
|
- if (this.actorInfo.jobId === jobLevelInfo.jobId && this.actorInfo.jobLevel === jobLevelInfo.level) {
|
|
|
- this.currentJobLevel = jobLevelInfo;
|
|
|
- if (i >= jobLevelList.length - 1) {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.nextJobLevel = jobLevelList[i + 1];
|
|
|
- this.spend = this.nextJobLevel.salary;
|
|
|
- }
|
|
|
- }
|
|
|
+ this.nextJobLevel = jobLevelList.find(n => {
|
|
|
+ return this.actorInfo.jobId == n.jobId && this.actorInfo.jobLevel == n.level - 1
|
|
|
+ })
|
|
|
+
|
|
|
+ this.spend = this.currentJobLevel.salary
|
|
|
|
|
|
let needCard = '';
|
|
|
let itemKey = Object.keys(this.nextJobLevel.itemInfo)[0];
|
|
@@ -164,7 +166,7 @@ cc.Class({
|
|
|
let self = this;
|
|
|
JobApi.levelUpInfo(this.actorInfo.uid,
|
|
|
(response) => {
|
|
|
- this.consume.getComponent('Consume').bindDataLevelUp(self.nextJobLevel.salary, needCard, response.userPack);
|
|
|
+ this.consumeLevelUp.getComponent('Consume').bindDataLevelUp(self.currentJobLevel.salary, needCard, response.userPack);
|
|
|
this.levelUpNode.getComponent('LevelUp').bind(self.actorInfo, self.nextJobLevel, response.wish);
|
|
|
},
|
|
|
(code, msg) => {
|
|
@@ -267,7 +269,8 @@ cc.Class({
|
|
|
|
|
|
|
|
|
onLevelUpSuccess() {
|
|
|
- GameModule.userInfo.grossIncome -= this.spend;
|
|
|
+ // 进阶不用扣钱
|
|
|
+ // GameModule.userInfo.grossIncome -= this.spend;
|
|
|
let self = this;
|
|
|
this.levelUpSuccess = cc.instantiate(this.levelUpSuccessPrefab);
|
|
|
this.levelUpSuccess = this.levelUpSuccess.getComponent('JobLevelUpSuccess');
|