You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
549 lines
21 KiB
549 lines
21 KiB
|
1 week ago
|
|
||
|
|
import { GEvent } from '../../mx/module/event/GEvent';
|
||
|
|
import { Singleton } from '../../mx/tools/Singleton';
|
||
|
|
import { TableNames } from '../game/ConfigTableData';
|
||
|
|
import { OtherDataType } from '../game/GameData';
|
||
|
|
import { ChapterDifficulty } from './ChapterDataManager';
|
||
|
|
|
||
|
|
// 1 通关普通关卡第x关
|
||
|
|
// 2 通关困难关卡第x关
|
||
|
|
// 3 通关地狱关卡第x关
|
||
|
|
// 4 商店购买碎片x次
|
||
|
|
// 5 商店开启宝箱x数
|
||
|
|
// 6 任意武器升级x次
|
||
|
|
// 7 指定武器升级高于x级
|
||
|
|
// 8 任意武器升级高于x级
|
||
|
|
// 9 指定品质任意武器升级高于x级
|
||
|
|
// 10 角色养成x次
|
||
|
|
// 11 战力达到x
|
||
|
|
// 12 武器上阵x次
|
||
|
|
// 13 使用指定武器参与战斗x次,携带对应武器上阵战斗即统计次数
|
||
|
|
// 14 完成每日任务80进度宝箱x次
|
||
|
|
// 15 参与武器副本x次
|
||
|
|
// 16 参与金币副本x次
|
||
|
|
// 17 解锁武器xxx
|
||
|
|
// 18 参与副本x次,所有副本都算
|
||
|
|
// 19 领取普通关卡进度宝箱
|
||
|
|
// 20 领取困难关卡进度宝箱
|
||
|
|
// 21 领取地狱关卡进度宝箱
|
||
|
|
// 22 领取x次挂机收益
|
||
|
|
// 23 获得x只宠物
|
||
|
|
// 24 宠物升级x次
|
||
|
|
// 25 获得xxx皮肤
|
||
|
|
// 26 皮肤升级x次
|
||
|
|
// 27 完成每日抽签x次
|
||
|
|
// 28 扫荡x次
|
||
|
|
// 29 上阵x个丧尸
|
||
|
|
export enum TargetTaskType {
|
||
|
|
/**通关普通关卡第x关 */
|
||
|
|
passNormal = 1,
|
||
|
|
/**通关困难关卡第x关 */
|
||
|
|
passHard = 2,
|
||
|
|
/**通关地狱关卡第x关 */
|
||
|
|
passHell = 3,
|
||
|
|
/**商店购买碎片x次 */
|
||
|
|
buyFragment = 4,
|
||
|
|
/**商店开启宝箱x数 */
|
||
|
|
openBox = 5,
|
||
|
|
/**任意武器升级x次 */
|
||
|
|
upgradeAnyWeapon = 6,
|
||
|
|
/**指定武器升级高于x级 */
|
||
|
|
upgradeSpecWeapon = 7,
|
||
|
|
/**任意武器升级高于x级 */
|
||
|
|
upgradeAnyWeaponSpecLevel = 8,
|
||
|
|
/**指定品质任意武器升级高于x级 */
|
||
|
|
upgradeSpecQualityAnyWeaponSpecLevel = 9,
|
||
|
|
/**角色养成x次 */
|
||
|
|
roleEvolve = 10,
|
||
|
|
/**战斗力达到x */
|
||
|
|
combatPower = 11,
|
||
|
|
/**武器上阵x次 */
|
||
|
|
weaponInTeam = 12,
|
||
|
|
/**使用指定武器参与战斗x次,携带对应武器上阵战斗即统计次数 */
|
||
|
|
fightSpecWeapon = 13,
|
||
|
|
/**完成每日任务80进度宝箱x次 */
|
||
|
|
dailyTaskBox = 14,
|
||
|
|
/**参与武器副本x次 */
|
||
|
|
weaponCopy = 15,
|
||
|
|
/**参与金币副本x次 */
|
||
|
|
goldCopy = 16,
|
||
|
|
/**解锁武器xxx */
|
||
|
|
unlockWeapon = 17,
|
||
|
|
/**参与副本x次,所有副本都算 */
|
||
|
|
anyCopy = 18,
|
||
|
|
/**领取普通关卡进度宝箱 */
|
||
|
|
getNormalBox = 19,
|
||
|
|
/**领取困难关卡进度宝箱 */
|
||
|
|
getHardBox = 20,
|
||
|
|
/**领取地狱关卡进度宝箱 */
|
||
|
|
getHellBox = 21,
|
||
|
|
/**领取x次挂机收益 */
|
||
|
|
getHangUpReward = 22,
|
||
|
|
/**获得x只宠物 */
|
||
|
|
getPet = 23,
|
||
|
|
/**宠物升级x次 */
|
||
|
|
petUpgrade = 24,
|
||
|
|
/**获得xxx皮肤 */
|
||
|
|
getSkin = 25,
|
||
|
|
/**皮肤升级x次 */
|
||
|
|
skinUpgrade = 26,
|
||
|
|
/**完成每日抽签x次 */
|
||
|
|
drawLottery = 27,
|
||
|
|
/**扫荡x次 */
|
||
|
|
sweep = 28,
|
||
|
|
/**上阵x个丧尸 */
|
||
|
|
putZombie = 29,
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
export class TargetTaskManager extends Singleton {
|
||
|
|
//目标任务 任务id&任务进度&任务完成状态
|
||
|
|
curConfig: ITableTarTask = null;
|
||
|
|
|
||
|
|
public getAllConstList(){
|
||
|
|
let list = gg.data.table.getTableList<ITableTarTask>(TableNames.TargetTask);
|
||
|
|
// console.log('allList===',list)
|
||
|
|
return list
|
||
|
|
}
|
||
|
|
//TargetTaskData = 67,目标任务 任务id&任务进度&任务完成状态
|
||
|
|
// 获取当前任务的配置
|
||
|
|
initCurTargetTaskConfig(){
|
||
|
|
//
|
||
|
|
// //测试代码
|
||
|
|
// gg.data.setStringData(OtherDataType.StatisticalData, '0&0&0&61&38&50&0&0&0&58&0&36&18&11180&3&3&0&9&0&0&0&50&0&3&0&4&0&3&14')
|
||
|
|
// gg.data.setStringData(OtherDataType.TargetTaskData,'104,0,0')
|
||
|
|
// //
|
||
|
|
|
||
|
|
let length = Object.keys(TargetTaskType).length / 2
|
||
|
|
let statisticalDataStr = gg.data.getStringData(OtherDataType.StatisticalData)
|
||
|
|
//补齐0
|
||
|
|
console.log(' 获取当前任务的配置 statisticalDataStr',statisticalDataStr)
|
||
|
|
|
||
|
|
if(statisticalDataStr == ''){
|
||
|
|
//如果为空,补齐0使用&分开
|
||
|
|
statisticalDataStr = '0'.repeat(length).replace(/(.)/g, '$1&')
|
||
|
|
//保存到数据
|
||
|
|
//去掉尾巴的&
|
||
|
|
statisticalDataStr = statisticalDataStr.replace(/&$/, '')
|
||
|
|
|
||
|
|
console.log('statisticalDataStr11',statisticalDataStr)
|
||
|
|
|
||
|
|
gg.data.setStringData(OtherDataType.StatisticalData, statisticalDataStr)
|
||
|
|
}else{
|
||
|
|
let data = statisticalDataStr.split('&')
|
||
|
|
if(data.length < length){
|
||
|
|
//补齐0使用&分开
|
||
|
|
statisticalDataStr = '0'.repeat(length-data.length).replace(/(.)/g, '$1&') + statisticalDataStr
|
||
|
|
//去掉尾巴的&
|
||
|
|
statisticalDataStr = statisticalDataStr.replace(/&$/, '')
|
||
|
|
console.log('statisticalDataStr22',statisticalDataStr)
|
||
|
|
gg.data.setStringData(OtherDataType.StatisticalData, statisticalDataStr)
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
let netData = gg.data.getStringData(OtherDataType.TargetTaskData)
|
||
|
|
console.log(' 获取当前任务的配置 netData',netData)
|
||
|
|
|
||
|
|
if(netData == ''){
|
||
|
|
netData = '0,0,0'
|
||
|
|
gg.data.setStringData(OtherDataType.TargetTaskData, netData)
|
||
|
|
GEvent.Ins.emit(GEvent.TargetTaskUpdate);
|
||
|
|
}
|
||
|
|
|
||
|
|
console.log('this.curConfig1111',this.curConfig)
|
||
|
|
|
||
|
|
if(!this.curConfig){
|
||
|
|
let configs = this.getAllConstList()
|
||
|
|
|
||
|
|
this.curConfig = configs.find(x => (x.id) == Number(netData.split(',')[0]))
|
||
|
|
console.log('this.curConfig2222',this.curConfig)
|
||
|
|
return this.curConfig
|
||
|
|
}
|
||
|
|
console.log('this.curConfig3333',this.curConfig)
|
||
|
|
return this.curConfig
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//设置当前任务进度 有特定条件,需要判断是否满足条件,才能增加进度
|
||
|
|
//关卡id,武器id,品质id,皮肤id
|
||
|
|
|
||
|
|
|
||
|
|
// setProgressWithCondition(taskId, progress, anyId){
|
||
|
|
// if(!this.curConfig){
|
||
|
|
// this.initCurTargetTaskConfig()
|
||
|
|
// }
|
||
|
|
// if(this.curConfig.id == taskId && anyId == this.curConfig.par1){
|
||
|
|
// let netData = gg.data.getStringData(OtherDataType.TargetTaskData).split(',')
|
||
|
|
// let pro = Number(netData[1])+progress
|
||
|
|
// netData[1] = pro.toString()
|
||
|
|
|
||
|
|
// if(Number(netData[1]) >= this.curConfig.par2){
|
||
|
|
// netData[2] = '1'
|
||
|
|
// }
|
||
|
|
// gg.data.setStringData(OtherDataType.TargetTaskData, netData.join(','))
|
||
|
|
// }else{
|
||
|
|
// console.log('任务id或anyId错误',this.curConfig.id,taskId, this.curConfig.par1,anyId)
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
|
||
|
|
|
||
|
|
//设置当前任务进度,没有特定条件,直接增加进度
|
||
|
|
setProgress(taskId, progress){
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
}
|
||
|
|
console.log('设置当前任务进度 taskId',taskId,'progress',progress)
|
||
|
|
|
||
|
|
|
||
|
|
let netData = gg.data.getStringData(OtherDataType.TargetTaskData).split(',')
|
||
|
|
let pro = progress
|
||
|
|
netData[1] = progress.toString()
|
||
|
|
|
||
|
|
//发送进度的消息
|
||
|
|
let isFinish = false
|
||
|
|
if(Number(netData[1]) >= this.curConfig.par2){
|
||
|
|
netData[2] = '1'
|
||
|
|
//发送完成任务的消息
|
||
|
|
isFinish = true
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
gg.data.setStringData(OtherDataType.TargetTaskData, netData.join(','))
|
||
|
|
GEvent.Ins.emit(GEvent.TargetTaskUpdate, pro, isFinish);
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//完成任务领取奖励
|
||
|
|
finishTask(){
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
}
|
||
|
|
let netData = gg.data.getStringData(OtherDataType.TargetTaskData).split(',')
|
||
|
|
if(netData[2] == '1'){
|
||
|
|
//领取奖励
|
||
|
|
let id = netData[0]
|
||
|
|
let rewardData = this.curConfig.rewards.split(',')
|
||
|
|
let itemId = Number(rewardData[0])
|
||
|
|
let itemNum = Number(rewardData[1])
|
||
|
|
|
||
|
|
if(itemId == 1){
|
||
|
|
console.log('任务奖励金币++++',itemNum)
|
||
|
|
}else if(itemId == 3){
|
||
|
|
console.log('任务奖励钻石++++',itemNum)
|
||
|
|
}else if(itemId == 4){
|
||
|
|
console.log('任务奖励体力++++',itemNum)
|
||
|
|
}
|
||
|
|
|
||
|
|
gg.data.addItemNum(itemId, itemNum)
|
||
|
|
|
||
|
|
netData[0] = (Number(id)+1).toString()
|
||
|
|
netData[1] = '0'
|
||
|
|
netData[2] = '0'
|
||
|
|
let str = netData.join(',')
|
||
|
|
gg.data.setStringData(OtherDataType.TargetTaskData, str)
|
||
|
|
this.updateCurTargetTaskConfig()
|
||
|
|
GEvent.Ins.emit(GEvent.TargetTaskUpdate);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//完成任务->领取奖励->更新当前任务配置
|
||
|
|
updateCurTargetTaskConfig(){
|
||
|
|
let configs = this.getAllConstList()
|
||
|
|
let netData = gg.data.getStringData(OtherDataType.TargetTaskData).split(',')
|
||
|
|
this.curConfig = configs.find(x => (x.id) == Number(netData[0]))
|
||
|
|
if(this.curConfig && this.curConfig.counttype == 1){
|
||
|
|
let statisticalDataStr = gg.data.getStringData(OtherDataType.StatisticalData).split('&').map(x => Number(x))
|
||
|
|
statisticalDataStr[this.curConfig.type-1] = 0 //需要重新统计所以这个数据重置为0
|
||
|
|
console.log('需要重新统计所以这个数据重置为0 statisticalDataStr',statisticalDataStr)
|
||
|
|
gg.data.setStringData(OtherDataType.StatisticalData, statisticalDataStr.join('&'))
|
||
|
|
}
|
||
|
|
this.checkTask()
|
||
|
|
//GEvent.Ins.emit(GEvent.TargetTaskUpdate);
|
||
|
|
}
|
||
|
|
|
||
|
|
getCurTargetTaskConfig(){
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
}
|
||
|
|
return this.curConfig
|
||
|
|
}
|
||
|
|
//当前任务id
|
||
|
|
getCurTargetTaskId(){
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
}
|
||
|
|
return this.curConfig.id
|
||
|
|
}
|
||
|
|
//获取当前任务的进度
|
||
|
|
getCurTargetTaskProgress(){
|
||
|
|
console.log('任务 getCurTargetTaskProgress',gg.data.getStringData(OtherDataType.TargetTaskData))
|
||
|
|
|
||
|
|
return Number(gg.data.getStringData(OtherDataType.TargetTaskData).split(',')[1])
|
||
|
|
}
|
||
|
|
|
||
|
|
//获取当前任务的目标
|
||
|
|
getCurTargetTaskTarget(){
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
}
|
||
|
|
return this.curConfig.par2
|
||
|
|
}
|
||
|
|
//获取当前任务的完成状态
|
||
|
|
getCurTargetTaskCompleteStatus(){
|
||
|
|
return Number(gg.data.getStringData(OtherDataType.TargetTaskData).split(',')[2])
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//统计数据,根据类型累计增加的
|
||
|
|
statisticalData(type: TargetTaskType, progress){
|
||
|
|
//根据类型统计数据
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
}
|
||
|
|
|
||
|
|
if(!this.curConfig){
|
||
|
|
console.log('没有任务配置')
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
let statisticalDataStr = gg.data.getStringData(OtherDataType.StatisticalData).split('&').map(x => Number(x))
|
||
|
|
console.log('statisticalDataStr',statisticalDataStr)
|
||
|
|
|
||
|
|
if(type == TargetTaskType.fightSpecWeapon){
|
||
|
|
//
|
||
|
|
let weaponId = this.curConfig.par1
|
||
|
|
//判断是不是携带了目标武器
|
||
|
|
let isWeaponEquipped = gg.data.project.isWeaponEquipped(weaponId)
|
||
|
|
if(isWeaponEquipped == -1){
|
||
|
|
//没有携带目标武器
|
||
|
|
|
||
|
|
}else{
|
||
|
|
//携带了目标武器
|
||
|
|
statisticalDataStr[type-1] += progress
|
||
|
|
gg.data.setStringData(OtherDataType.StatisticalData, statisticalDataStr.join('&'))
|
||
|
|
this.checkTask()
|
||
|
|
}
|
||
|
|
|
||
|
|
}else{
|
||
|
|
|
||
|
|
statisticalDataStr[type-1] += progress
|
||
|
|
gg.data.setStringData(OtherDataType.StatisticalData, statisticalDataStr.join('&'))
|
||
|
|
this.checkTask()
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
//获取是不是没有任务了
|
||
|
|
getIsNoTask(){
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
|
||
|
|
}
|
||
|
|
if(!this.curConfig){
|
||
|
|
//没有任务了
|
||
|
|
return true
|
||
|
|
}else{
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
checkTask(){
|
||
|
|
if(!this.curConfig){
|
||
|
|
this.initCurTargetTaskConfig()
|
||
|
|
}
|
||
|
|
if(!this.curConfig){
|
||
|
|
//没有任务了
|
||
|
|
return
|
||
|
|
}
|
||
|
|
let statisticalDataStr = gg.data.getStringData(OtherDataType.StatisticalData).split('&').map(x => Number(x))
|
||
|
|
let netAddNum = statisticalDataStr[this.curConfig.type-1]
|
||
|
|
if(this.curConfig.type == TargetTaskType.passNormal){
|
||
|
|
//外部数据
|
||
|
|
let putongGuanka = gg.data.project.getCurentLevelChapterId(ChapterDifficulty.Normal)
|
||
|
|
if(putongGuanka > this.curConfig.par1){
|
||
|
|
//完成普通关卡任务
|
||
|
|
console.log('完成普通关卡任务 putongGuanka',putongGuanka)
|
||
|
|
|
||
|
|
this.setProgress(this.curConfig.id, putongGuanka)
|
||
|
|
}
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.passHard){
|
||
|
|
//外部数据
|
||
|
|
let hardGuanka = gg.data.project.getCurentLevelChapterId(ChapterDifficulty.Hard)
|
||
|
|
if(hardGuanka > this.curConfig.par1){
|
||
|
|
//完成普通关卡任务
|
||
|
|
this.setProgress(this.curConfig.id, hardGuanka)
|
||
|
|
}
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.passHell){
|
||
|
|
//外部数据
|
||
|
|
|
||
|
|
let hellGuanka = gg.data.project.getCurentLevelChapterId(ChapterDifficulty.Hell)
|
||
|
|
if(hellGuanka > this.curConfig.par1){
|
||
|
|
//完成普通关卡任务
|
||
|
|
this.setProgress(this.curConfig.id, hellGuanka)
|
||
|
|
}
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.buyFragment){
|
||
|
|
//获取统计数据
|
||
|
|
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.openBox){
|
||
|
|
//获取统计数据
|
||
|
|
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.upgradeAnyWeapon){
|
||
|
|
//获取统计数据
|
||
|
|
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.upgradeSpecWeapon){
|
||
|
|
//获取统计数据
|
||
|
|
//升级指定武器次数
|
||
|
|
let weaponId = this.curConfig.par1
|
||
|
|
//获取当前武器的等级
|
||
|
|
let weaponLevel = gg.data.project.getWeaponLevel(weaponId);
|
||
|
|
//判断是否升级到目标等级不需要统计数据
|
||
|
|
this.setProgress(this.curConfig.id, weaponLevel)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.upgradeAnyWeaponSpecLevel){
|
||
|
|
//获取统计数据
|
||
|
|
//任意武器升级到目标等级
|
||
|
|
let weaponLevel = gg.data.project.getMaxLevelWeapon();
|
||
|
|
//判断是否升级到目标等级不需要统计数据
|
||
|
|
this.setProgress(this.curConfig.id, weaponLevel)
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.upgradeSpecQualityAnyWeaponSpecLevel){
|
||
|
|
//获取统计数据
|
||
|
|
//指定品质武器升级到目标等级
|
||
|
|
let weaponLevel = gg.data.project.getMaxLevelWeaponByQuality(this.curConfig.par1);
|
||
|
|
//判断是否升级到目标等级不需要统计数据
|
||
|
|
this.setProgress(this.curConfig.id, weaponLevel)
|
||
|
|
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.roleEvolve){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.combatPower){
|
||
|
|
//获取统计数据
|
||
|
|
//当前战力
|
||
|
|
let curPower = gg.data.getCurPower()
|
||
|
|
this.setProgress(this.curConfig.id, curPower)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.weaponInTeam){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.fightSpecWeapon){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.dailyTaskBox){
|
||
|
|
//每日任务完成到80%
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.weaponCopy){
|
||
|
|
//获取统计数据 局外判断 fix me
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.goldCopy){
|
||
|
|
//获取统计数据 局外判断 fix me
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.unlockWeapon){
|
||
|
|
//获取统计数据
|
||
|
|
let weaponId = this.curConfig.par1
|
||
|
|
//判断是不是解锁了目标武器
|
||
|
|
let isWeaponUnlocked = gg.data.project.isWeaponUnlocked(weaponId)
|
||
|
|
if(isWeaponUnlocked){
|
||
|
|
this.setProgress(this.curConfig.id, 1)
|
||
|
|
}else{
|
||
|
|
this.setProgress(this.curConfig.id, 0)
|
||
|
|
}
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.anyCopy){
|
||
|
|
//获取统计数据 局外判断 fix me
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.getNormalBox){
|
||
|
|
//获取统计数据 领取宝箱三个宝箱
|
||
|
|
|
||
|
|
//判断是不是领取了目标宝箱 2才是领取状态
|
||
|
|
let isBoxReceived = gg.data.project.getChapterStatus(this.curConfig.par1, ChapterDifficulty.Normal, 2)
|
||
|
|
if(isBoxReceived == 2){
|
||
|
|
this.setProgress(this.curConfig.id, 1)
|
||
|
|
}else{
|
||
|
|
this.setProgress(this.curConfig.id, 0)
|
||
|
|
}
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.getHardBox){
|
||
|
|
//获取统计数据
|
||
|
|
//判断是不是领取了目标宝箱
|
||
|
|
let isBoxReceived = gg.data.project.getChapterStatus(this.curConfig.par1, ChapterDifficulty.Hard, 2)
|
||
|
|
if(isBoxReceived == 2){
|
||
|
|
this.setProgress(this.curConfig.id, 1)
|
||
|
|
}else{
|
||
|
|
this.setProgress(this.curConfig.id, 0)
|
||
|
|
}
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.getHellBox){
|
||
|
|
//获取统计数据
|
||
|
|
//判断是不是领取了目标宝箱
|
||
|
|
let isBoxReceived = gg.data.project.getChapterStatus(this.curConfig.par1, ChapterDifficulty.Hell, 2)
|
||
|
|
if(isBoxReceived == 2){
|
||
|
|
this.setProgress(this.curConfig.id, 1)
|
||
|
|
}else{
|
||
|
|
this.setProgress(this.curConfig.id, 0)
|
||
|
|
}
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.getHangUpReward){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.getPet){
|
||
|
|
//获取统计数据
|
||
|
|
// let havePet = gg.pet.getHavePets().length
|
||
|
|
// this.setProgress(this.curConfig.id, havePet)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.petUpgrade){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.getSkin){
|
||
|
|
//获取统计数据
|
||
|
|
//根据皮肤id获取状态
|
||
|
|
//皮肤id转换
|
||
|
|
|
||
|
|
let skinid = this.curConfig.par1
|
||
|
|
//皮肤id装换
|
||
|
|
skinid = gg.role.getSkinIdFromReward(skinid)
|
||
|
|
|
||
|
|
//通过皮肤id获取需要的itemid
|
||
|
|
let skinConfig = gg.skin.getSkinConfigBySkinId(skinid)
|
||
|
|
let itemId = gg.role.getSkinItemIdFromReward(skinConfig.itemid)
|
||
|
|
|
||
|
|
let isSkinReceived = gg.data.getItemNum(itemId)>0
|
||
|
|
if(isSkinReceived){
|
||
|
|
this.setProgress(this.curConfig.id, 1)
|
||
|
|
}else{
|
||
|
|
this.setProgress(this.curConfig.id, 0)
|
||
|
|
}
|
||
|
|
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.skinUpgrade){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.drawLottery){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.sweep){
|
||
|
|
//获取统计数据
|
||
|
|
this.setProgress(this.curConfig.id, netAddNum)
|
||
|
|
}else if(this.curConfig.type == TargetTaskType.putZombie){
|
||
|
|
//获取统计数据
|
||
|
|
//上阵丧尸数量
|
||
|
|
// let arr1 = gg.zombie.getZombieListUp(ZombieType.normal);
|
||
|
|
// let arr2 = gg.zombie.getZombieListUp(ZombieType.normal);
|
||
|
|
// let arr3 = gg.zombie.getZombieListUp(ZombieType.normal);
|
||
|
|
// let all = arr1.length + arr2.length + arr3.length;
|
||
|
|
// console.log('上阵丧尸数量 all', all, netAddNum)
|
||
|
|
// this.setProgress(this.curConfig.id, all)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//
|
||
|
|
}
|
||
|
|
|
||
|
|
|