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.
102 lines
3.9 KiB
102 lines
3.9 KiB
1 week ago
|
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
||
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
||
|
import User from "../../FrameWork/User/User";
|
||
|
import Common5 from "../../Platform/th/Common5";
|
||
|
import BagScript from "../Beibao/BagScript";
|
||
|
import BagManager from "../Manager/BagManager";
|
||
|
import UserManager from "../Manager/UserManager";
|
||
|
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
|
||
|
import ChatManager from "./ChatManager";
|
||
|
import JuQingManager from "./JuQingManager";
|
||
|
import TaskManager, { MainTaskDataInfo, MainTaskIdEnum } from "./TaskManager";
|
||
|
|
||
|
|
||
|
const { ccclass, property } = cc._decorator;
|
||
|
|
||
|
@ccclass
|
||
|
export default class NeedGoodQiPao extends cc.Component {
|
||
|
|
||
|
@property(cc.Node)
|
||
|
iconSpFrame: cc.Node = null
|
||
|
|
||
|
// @property(cc.Label)
|
||
|
// qiPaoStr:cc.Label = null
|
||
|
|
||
|
@property([cc.Integer])
|
||
|
goodIdTab: number[] = []
|
||
|
|
||
|
// onLoad () {}
|
||
|
|
||
|
start() {
|
||
|
this.setCurWuPinQiPaoVisible()
|
||
|
EventMgr.onEvent_custom(ryw_Event.RefreshJuQingDuiHua, () => {
|
||
|
this.setCurWuPinQiPaoVisible()
|
||
|
}, this)
|
||
|
|
||
|
}
|
||
|
|
||
|
onClickOpenBag() {
|
||
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
||
|
let mainId = mainTaskInfo.Id
|
||
|
let tiJiaoCallFunc = () => {
|
||
|
|
||
|
if (mainId != MainTaskIdEnum.MainTask_None && mainId) {
|
||
|
let taskConfig = TaskManager.getTaskConfigById(mainId)
|
||
|
if (taskConfig.needGoodId && this.goodIdTab.indexOf(taskConfig.needGoodId) > -1) {
|
||
|
// User.setNianHuoExistIdTab(taskConfig.needGoodId)
|
||
|
if (!taskConfig.isNotAutoFinish) {
|
||
|
TaskManager.finishCurMainTask(mainId)
|
||
|
}
|
||
|
//解锁下一个任务
|
||
|
if (taskConfig.jieSuoNextTaskId) {
|
||
|
TaskManager.setCurUnLockMainTaskInfo(taskConfig.jieSuoNextTaskId)
|
||
|
}
|
||
|
EventMgr.emitEvent_custom(ryw_Event.RefreshJuQingDuiHua);
|
||
|
// //完成当前任务
|
||
|
// }else{
|
||
|
// if(mainId == MainTaskIdEnum.MainTask_543){
|
||
|
// User.setNewRoomStatus(2)
|
||
|
// }
|
||
|
|
||
|
// EventMgr.emitEvent_custom(ryw_Event.RefreshJuQingDuiHua);
|
||
|
// }
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (mainId != MainTaskIdEnum.MainTask_None && mainId) {
|
||
|
let taskConfig = TaskManager.getTaskConfigById(mainId)
|
||
|
let goodNum = BagManager.getBagGoodNums(taskConfig.needGoodId)
|
||
|
if (goodNum > 0) {
|
||
|
// PrefabManage.loadPrefabByType(GameType.BeiBao,null,(prefabNode)=>{
|
||
|
// prefabNode.getComponent(BagScript).setHandIn(true,taskConfig.needGoodId,tiJiaoCallFunc)
|
||
|
// })
|
||
|
// BagManager.subBagList(taskConfig.needGoodId)
|
||
|
tiJiaoCallFunc()
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
|
||
|
PrefabManage.showTextTips('当前背包没有该物品')
|
||
|
}
|
||
|
|
||
|
//物品气泡是否显示
|
||
|
setCurWuPinQiPaoVisible() {
|
||
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
||
|
let mainId = mainTaskInfo.Id
|
||
|
if (mainId != MainTaskIdEnum.MainTask_None && mainId) {
|
||
|
let taskConfig = TaskManager.getTaskConfigById(mainId)
|
||
|
if (taskConfig.needGoodId && this.goodIdTab.indexOf(taskConfig.needGoodId) > -1) {
|
||
|
// Common5.getSpriteFrameFromBundle("GoodIcon",
|
||
|
// "icon/"+taskConfig.needGoodId,this.iconSpFrame.getComponent(cc.Sprite)
|
||
|
// );
|
||
|
Common5.setRemoteSpriteFrame(this.iconSpFrame.getComponent(cc.Sprite), 'GoodIcon/' + taskConfig.needGoodId)
|
||
|
this.node.active = true
|
||
|
// this.qiPaoStr.string = taskConfig.TaskDesc
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
this.node.active = false
|
||
|
}
|
||
|
// update (dt) {}
|
||
|
}
|