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.
623 lines
24 KiB
623 lines
24 KiB
import EventMgr from "../../../../FrameWork/Event/EventMgr";
|
|
import { ryw_Event } from "../../../../FrameWork/Event/EventEnum";
|
|
import Common5 from "../../../../Platform/th/Common5";
|
|
import Game from "../../../../Scripts/WenZiRes/ui/Game";
|
|
import Common from "../../../../FrameWork/Util/Common";
|
|
import DaDianScript from "../../../../FrameWork/Base/DaDianScript";
|
|
import GameReport from "../../../../FrameWork/Report/ZyZyReport";
|
|
import WordGameBaseComponent from "../../../../FrameWork/Base/WordGameBaseComptent";
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
enum YeYeStatus{
|
|
xuehua,
|
|
beixin,
|
|
mianfu,
|
|
}
|
|
|
|
|
|
// "toolTip": "1.将钱拖动到三轮车\n2.将钱拖动到柴火堆",
|
|
// "answer": "n\n\n7.将爷爷拖动到垃圾桶上\n8.爷爷拖动到垃圾桶上之后,再将钱拖动到垃圾桶上\n\n\n\n\n13.将钱拖动到右墙\n14.将钱拖动到墙上的海报\n15.将钱拖动到老鼠洞\n16.将钱拖动到鸡身上",
|
|
|
|
|
|
let answer = [
|
|
'将钱拖动到三轮车', //0
|
|
'将钱拖动到柴火堆',//1
|
|
'将钱拖动到桌子',//2
|
|
'上划盒饭打开,再将钱拖动到馒头',//3
|
|
'将钱拖到雪堆爷爷身上',//4
|
|
'将钱第二次拖动爷爷',//5
|
|
'将爷爷拖动到垃圾桶上,再将钱拖动到垃圾桶上',//6
|
|
'将钱拖动奶奶',//7
|
|
'将钱拖动到凉席',//8
|
|
'将钱拖动到盖在奶奶的报纸上',//9
|
|
'将钱拖动到地面',//10
|
|
'将钱拖动到墙壁',//11
|
|
'将钱拖动到墙上的海报',//12
|
|
'将钱拖动到老鼠洞',//13
|
|
'将钱拖动到鸡身上',//14
|
|
'将龙虾拖到地上,将钱拖给老鼠'//15
|
|
]
|
|
|
|
|
|
|
|
let CurGameConfig = {
|
|
CheckNode:[
|
|
'jiji_check',
|
|
'check_sanlun',
|
|
'check_qiangbi1',
|
|
'yeyeanmo_check',
|
|
'check_qiangbi2',
|
|
'check_qiangbi3',
|
|
'yeyexue_check',
|
|
'火堆',
|
|
'yeyezuo_check',
|
|
'垃圾桶Check',
|
|
'普通老鼠洞',
|
|
'nainaizuo_check',
|
|
'nainaitang_check',
|
|
'liangxi_check',
|
|
'普通桌子',
|
|
'发霉馒头',
|
|
'男模海报',
|
|
'泥土地面',
|
|
'老鼠fixedNode'
|
|
],
|
|
|
|
|
|
}
|
|
@ccclass
|
|
export default class QiaoXiaLaoren extends WordGameBaseComponent{
|
|
@property(cc.Node)
|
|
maskNode:cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
mapNode:cc.Node = null;
|
|
|
|
gameInfo = null
|
|
bundle = null
|
|
mapNodeFixedScale:number = 0.6//固定缩放(图片太大了)
|
|
touchStartTime:number = 0//触摸开始时间
|
|
originalTouchDistance:number = 0 //起始双指触摸间距
|
|
lastScale:number = 1//上次缩放值
|
|
curScale:number = 1//当前缩放值
|
|
touchId1:number = -1
|
|
touchId2:number = -2
|
|
|
|
curFinishNum:number = 0
|
|
isStepRight:boolean = true
|
|
isKaiChuang:boolean = false
|
|
|
|
YeYeCurStatus = YeYeStatus.xuehua
|
|
yeyeMove = false
|
|
yeyeAnmo: boolean = false;
|
|
|
|
nainaiIsTang = false
|
|
isAnmoNan: boolean = false;
|
|
onLoad(){
|
|
DaDianScript.userEnterDaDian()
|
|
Common.Type = 3;
|
|
Common.subLevel = 0;
|
|
Common.GameSubTipConfigs=answer//[Common5.gameConfig.zmGameConfig[Common5.selectGameNum].toolTip]
|
|
// Common.GameSubAnswerConfigs=[Common5.gameConfig.zmGameConfig[Common5.selectGameNum].answer]
|
|
|
|
|
|
|
|
this.bundle = Common5.gameConfig.zmGameConfig[Common5.selectGameNum].bundle
|
|
EventMgr.onEvent_custom(ryw_Event.timeOut, (tab) => {
|
|
Game.ins.showFail();;
|
|
}, this);
|
|
EventMgr.onEvent_custom(ryw_Event.DirectTouchMoveCheck, (data_) => {
|
|
// if(data_.targetNode.name == '窗户关'){
|
|
// this.isKaiChuang = true
|
|
// }
|
|
}, this);
|
|
}
|
|
start(){
|
|
super.start();
|
|
cc.macro.ENABLE_MULTI_TOUCH = true;
|
|
this.initMapNodeTouchEvent()
|
|
Common5.playMusicCustom('qiaoxialaoren','sound/背景音')
|
|
EventMgr.onEvent_custom(ryw_Event.NormalTouchMoveCheck, (data_) => {
|
|
this.normalTouchCallback(data_.targetNode);
|
|
}, this);
|
|
|
|
}
|
|
|
|
normalTouchCallback(targetNode){
|
|
this.yeyeMove = true
|
|
|
|
if(this.YeYeCurStatus == YeYeStatus.beixin){
|
|
|
|
this.mapNode.getChildByName('爷爷坐').getComponent(sp.Skeleton).setAnimation(0,'背心', true)
|
|
}else if(this.YeYeCurStatus == YeYeStatus.mianfu){
|
|
this.mapNode.getChildByName('爷爷坐').getComponent(sp.Skeleton).setAnimation(0,'棉服', true)
|
|
this.mapNode.getChildByName('yeyezuo_check').active = false
|
|
}
|
|
|
|
if(this.yeyeAnmo){
|
|
this.mapNode.getChildByName('按摩女').active = false
|
|
this.mapNode.getChildByName('按摩女2').active = true
|
|
}
|
|
}
|
|
|
|
//初始化触摸监听
|
|
initMapNodeTouchEvent(){
|
|
this.initMouseEvent();
|
|
this.mapNode.on(cc.Node.EventType.TOUCH_START, this.touchStart_mapNode,this)
|
|
this.mapNode.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove_mapNode,this)
|
|
this.mapNode.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd_mapNode,this)
|
|
this.mapNode.on(cc.Node.EventType.TOUCH_END, this.touchEnd_mapNode,this)
|
|
|
|
let prefabWidth = this.mapNode.width
|
|
let prefabHeight = this.mapNode.height
|
|
|
|
let maskWidth = this.maskNode.width
|
|
let maskHeight = this.maskNode.height
|
|
|
|
let widthScale = maskWidth/prefabWidth
|
|
let heightScale = maskHeight/prefabHeight
|
|
|
|
|
|
|
|
if(prefabWidth<prefabHeight){
|
|
this.mapNodeFixedScale = widthScale
|
|
}else{
|
|
this.mapNodeFixedScale = heightScale
|
|
}
|
|
|
|
this.mapNode.scale = this.mapNodeFixedScale
|
|
|
|
this.curScale = this.mapNodeFixedScale
|
|
this.lastScale = this.mapNodeFixedScale
|
|
this.specialNodeTouchEvent()
|
|
}
|
|
touchStart_mapNode(event){
|
|
Common5.playEffect("click")
|
|
if(this.touchId1 < 0){
|
|
this.touchId1 = event.touch.getID()
|
|
}else if(this.touchId2 < 0){
|
|
this.touchId2 = event.touch.getID()
|
|
}
|
|
if(this.touchId1 >= 0 && this.touchId2 >= 0){
|
|
// console.log("邵阳1—双点触摸开始")
|
|
}
|
|
|
|
this.touchStartTime = Date.now()
|
|
}
|
|
touchMove_mapNode(event){
|
|
let touches = event.getTouches()
|
|
if(touches.length == 2){ //缩放
|
|
if(this.originalTouchDistance == 0){
|
|
this.originalTouchDistance = this.getDistance(touches[0].getLocation(),touches[1].getLocation())
|
|
}
|
|
|
|
//获取双指移动数据
|
|
let curDistance = this.getDistance(touches[0].getLocation(),touches[1].getLocation())
|
|
let tempScale = curDistance/this.originalTouchDistance
|
|
let y = 0.5*tempScale + 0.5
|
|
let scale = y * this.lastScale
|
|
|
|
if(scale < this.mapNodeFixedScale){
|
|
scale = this.mapNodeFixedScale
|
|
}else if(scale > 3){
|
|
scale = 3
|
|
}else{
|
|
}
|
|
this.mapNode.scale = scale
|
|
this.curScale = scale
|
|
this.goToBoundary();
|
|
}else if(touches.length == 1){ //拖动
|
|
let delta = event.getDelta()
|
|
this.mapNode.x += delta.x
|
|
this.mapNode.y += delta.y
|
|
// console.log(this.mapNode.scale,this.mapNode.x,this.mapNode.y);
|
|
|
|
this.goToBoundary()
|
|
}
|
|
}
|
|
touchEnd_mapNode(event){
|
|
console.log('touchEnd===')
|
|
let dateNow = Date.now()
|
|
if(dateNow - this.touchStartTime > 0.2 * 1000){
|
|
// console.log('0.2===')
|
|
// //补丁,长按两秒
|
|
// if(dateNow - this.touchStartTime > 1.5 * 1000){
|
|
// console.log('2===')
|
|
// let wl_fangzi = this.mapNode.getChildByName('wl_房子')
|
|
// let chuanghuguan = wl_fangzi.getChildByName('窗户关')
|
|
// let chuanghukai = wl_fangzi.getChildByName('窗户开')
|
|
// let rect = chuanghuguan.getBoundingBoxToWorld()
|
|
// if(wl_fangzi.active && chuanghuguan.active && rect.contains(event.getLocation())){
|
|
// chuanghuguan.active = false
|
|
// chuanghukai.active = true
|
|
// this.isKaiChuang = true
|
|
// }
|
|
// }
|
|
}else{
|
|
// this.isFind = false;
|
|
let touchPos = event.getLocation();
|
|
this.checkIsInAreaNewVersion(touchPos)
|
|
}
|
|
|
|
if(event.touch.getID() == this.touchId1){
|
|
this.touchId1 = -1
|
|
}else if(event.touch.getID() == this.touchId2){
|
|
this.touchId2 = -2
|
|
}
|
|
|
|
if(this.touchId1 < 0 && this.touchId2 < 0){
|
|
this.originalTouchDistance = 0
|
|
this.lastScale = this.curScale
|
|
// this.goToBoundary()
|
|
}
|
|
}
|
|
//距离
|
|
getDistance(startPos,endPos){
|
|
var pos = cc.v2(startPos.x - endPos.x,startPos.y - endPos.y)
|
|
var dis = Math.sqrt(pos.x * pos.x + pos.y * pos.y)
|
|
return dis
|
|
}
|
|
//检测边界
|
|
goToBoundary(){
|
|
let widthMask = this.maskNode.width
|
|
let heightMask = this.maskNode.height
|
|
|
|
let widthMap = this.mapNode.width*this.curScale
|
|
let heightMap = this.mapNode.height*this.curScale
|
|
|
|
//右边界
|
|
if(this.mapNode.x + widthMap/2 <= widthMask/2){
|
|
this.mapNode.x = widthMask/2 - widthMap/2
|
|
//左边界
|
|
}else if(this.mapNode.x - widthMap/2>= -widthMask/2){
|
|
this.mapNode.x = -widthMask/2 + widthMap/2
|
|
}
|
|
//上边界
|
|
if(this.mapNode.y + heightMap/2 <= heightMask/2){
|
|
this.mapNode.y = heightMask/2 - heightMap/2
|
|
//下边界
|
|
}else if(this.mapNode.y - heightMap/2 >= -heightMask/2){
|
|
this.mapNode.y = -heightMask/2 + heightMap/2
|
|
}
|
|
|
|
}
|
|
initMouseEvent(){
|
|
this.mapNode.on(cc.Node.EventType.MOUSE_WHEEL,function(event){//监听名称+事件参数
|
|
console.log(event);
|
|
let tmpscale = this.mapNode.scale;
|
|
if (event._scrollY > 0){
|
|
if (this.mapNode.scale < 3){
|
|
tmpscale+=0.2;
|
|
this.mapNode.scale = tmpscale
|
|
this.curScale = tmpscale
|
|
this.lastScale = tmpscale
|
|
}
|
|
}
|
|
else {
|
|
if (this.mapNode.scale > this.mapNodeFixedScale){
|
|
tmpscale-=0.2;
|
|
this.mapNode.scale = tmpscale
|
|
this.curScale = tmpscale
|
|
this.lastScale = tmpscale
|
|
}
|
|
}
|
|
// console.log(this.mapNode.scale,this.mapNode.x,this.mapNode.y);
|
|
this.goToBoundary();
|
|
},this);
|
|
|
|
}
|
|
//检测node是否进入target区域(新版)
|
|
checkIsInAreaNewVersion(pos){
|
|
// //茬点触碰逻辑
|
|
// let childrens = this.mapNode.getChildByName("chaDianNode").children
|
|
// for(var i =0;i<childrens.length;i++){
|
|
// let rect = childrens[i].getBoundingBoxToWorld()
|
|
// if(rect.contains(pos)){
|
|
// if(this.gameInfo.ChaNode[childrens[i].name].isFindOut){
|
|
// continue
|
|
// }else{
|
|
// //暂不可点击
|
|
// if(!this.gameInfo.ChaNode[childrens[i].name].isCanTouch){
|
|
// continue
|
|
// }
|
|
// this.gameInfo.ChaNode[childrens[i].name].isFindOut = true
|
|
// if (this.gameInfo.PrefabInfo.zhaoChaType == ZhaoChaType.Type6){
|
|
// this.findOnChaDian(childrens[i],this.gameId)
|
|
// }
|
|
// else {
|
|
// this.findOnChaDian(childrens[i])
|
|
// }
|
|
// this.isFind = true
|
|
// }
|
|
// break
|
|
// }else{
|
|
// //点错这里需要减5s
|
|
// }
|
|
// }
|
|
// this.handSpecialGameLogic(pos)
|
|
}
|
|
|
|
|
|
//特殊节点的点击事件(主要处理节点可以移动的问题)
|
|
specialNodeTouchEvent(){
|
|
let qianbiNodes = this.mapNode.getChildByName("qianbiNodes")
|
|
for(let i=0;i<qianbiNodes.childrenCount;i++){
|
|
this.openTouchEvent(qianbiNodes.children[i],CurGameConfig.CheckNode)
|
|
}
|
|
|
|
}
|
|
openTouchEvent(node, checkNodeTab){
|
|
var attrs = {
|
|
isCanMove:true,
|
|
checkNodeTab: checkNodeTab,
|
|
startPos: node.getPosition(),//初始位置
|
|
};
|
|
node.attr(attrs)
|
|
node.on(cc.Node.EventType.TOUCH_START,this.touchStartSpecicalNode,this)
|
|
node.on(cc.Node.EventType.TOUCH_MOVE,this.touchMoveSpecicalNode,this)
|
|
node.on(cc.Node.EventType.TOUCH_CANCEL,this.touchEndSpecicalNode,this)
|
|
node.on(cc.Node.EventType.TOUCH_END,this.touchEndSpecicalNode,this)
|
|
}
|
|
|
|
closeTouchEvent(node){
|
|
node.off(cc.Node.EventType.TOUCH_START,this.touchStartSpecicalNode,this)
|
|
node.off(cc.Node.EventType.TOUCH_MOVE,this.touchMoveSpecicalNode,this)
|
|
node.off(cc.Node.EventType.TOUCH_CANCEL,this.touchEndSpecicalNode,this)
|
|
node.off(cc.Node.EventType.TOUCH_END,this.touchEndSpecicalNode,this)
|
|
}
|
|
|
|
private specialTouchTime = Date.now();
|
|
touchStartSpecicalNode(event){
|
|
Common5.playEffect("click")
|
|
|
|
this.specialTouchTime = Date.now();
|
|
}
|
|
touchMoveSpecicalNode(event){
|
|
|
|
let target = event.target;
|
|
if(!target.isCanMove){
|
|
return
|
|
}
|
|
let posi = event.getLocation()//世界坐标
|
|
posi = target.parent.convertToNodeSpaceAR(posi)
|
|
target.setPosition(posi)
|
|
}
|
|
|
|
// let answer = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ]
|
|
|
|
touchEndSpecicalNode(event){
|
|
// event.target.zIndex = 0
|
|
|
|
let target = event.target;
|
|
let checkTarget = this.checkArea(target,target.checkNodeTab)
|
|
if (checkTarget) {
|
|
|
|
GameReport.BtnsReport(checkTarget.name, Common5.selectGameInfo.titleUrl);
|
|
|
|
|
|
|
|
target.active = false
|
|
checkTarget.active = false
|
|
|
|
|
|
if(checkTarget.name == '泥土地面'){
|
|
this.unlockLevel(10)
|
|
|
|
|
|
this.mapNode.getChildByName('荷塘').active = true
|
|
this.mapNode.getChildByName('木地板').active = true
|
|
|
|
}else if(checkTarget.name == 'check_sanlun'){
|
|
this.mapNode.getChildByName('三轮车').active = false
|
|
this.mapNode.getChildByName('豪车').active = true
|
|
|
|
this.unlockLevel(0)
|
|
}else if(checkTarget.name == 'check_qiangbi1' || checkTarget.name == 'check_qiangbi2' || checkTarget.name == 'check_qiangbi3'){
|
|
this.unlockLevel(11)
|
|
this.mapNode.getChildByName('check_qiangbi1').active = false
|
|
this.mapNode.getChildByName('check_qiangbi2').active = false
|
|
this.mapNode.getChildByName('check_qiangbi3').active = false
|
|
this.mapNode.getChildByName('地面上墙壁').active = false
|
|
this.mapNode.getChildByName('豪华装修墙壁').active = true
|
|
this.mapNode.getChildByName('雪').active = false
|
|
}else if(checkTarget.name == 'yeyexue_check'){
|
|
this.mapNode.getChildByName('爷爷').active = false
|
|
this.mapNode.getChildByName('爷爷zuo').active = true
|
|
this.mapNode.getChildByName('垃圾桶MoveCheck').active = true
|
|
this.mapNode.getChildByName('jiji_check').active = true
|
|
if(this.YeYeCurStatus == YeYeStatus.beixin){
|
|
this.YeYeCurStatus = YeYeStatus.mianfu
|
|
this.mapNode.getChildByName('yeyexue_check').active = false
|
|
this.unlockLevel(5)
|
|
this.mapNode.getChildByName('爷爷zuo').getChildByName('爷爷').getComponent(sp.Skeleton).setAnimation(0,'棉服爷爷烤火', true)
|
|
}else if(this.YeYeCurStatus == YeYeStatus.xuehua){
|
|
this.YeYeCurStatus = YeYeStatus.beixin
|
|
this.mapNode.getChildByName('yeyexue_check').active = true
|
|
this.unlockLevel(4)
|
|
}
|
|
|
|
}else if(checkTarget.name == '垃圾桶Check'){
|
|
this.mapNode.getChildByName('垃圾桶').active = false
|
|
this.mapNode.getChildByName('爷爷坐').active = false
|
|
this.mapNode.getChildByName('爷爷按摩椅').active = true
|
|
this.mapNode.getChildByName('按摩女').active = false
|
|
this.mapNode.getChildByName('按摩女2').active = false
|
|
this.mapNode.getChildByName('按摩女3').active = false
|
|
if(this.yeyeAnmo){
|
|
this.mapNode.getChildByName('按摩女3').active = true
|
|
}
|
|
this.unlockLevel(6)
|
|
if( this.YeYeCurStatus == YeYeStatus.mianfu){
|
|
|
|
this.mapNode.getChildByName('爷爷按摩椅').getComponent(sp.Skeleton).setAnimation(0,'棉服', true)
|
|
this.mapNode.getChildByName('yeyezuo_check').active = false
|
|
this.mapNode.getChildByName('yeyeanmo_check').active = false
|
|
|
|
}else{
|
|
this.mapNode.getChildByName('爷爷按摩椅').getComponent(sp.Skeleton).setAnimation(0,'背心', true)
|
|
this.mapNode.getChildByName('yeyezuo_check').active = false
|
|
this.mapNode.getChildByName('yeyeanmo_check').active = true
|
|
}
|
|
|
|
|
|
}else if(checkTarget.name == 'yeyezuo_check'){
|
|
this.YeYeCurStatus = YeYeStatus.mianfu
|
|
if(this.mapNode.getChildByName('爷爷坐').active){
|
|
this.unlockLevel(5)
|
|
this.mapNode.getChildByName('爷爷坐').getComponent(sp.Skeleton).setAnimation(0,'棉服', true)
|
|
}
|
|
if(this.mapNode.getChildByName('爷爷按摩椅').active){
|
|
this.unlockLevel(5)
|
|
this.mapNode.getChildByName('爷爷按摩椅').getComponent(sp.Skeleton).setAnimation(0,'棉服', true)
|
|
}
|
|
|
|
|
|
}else if(checkTarget.name == '普通老鼠洞'){
|
|
this.mapNode.getChildByName('普通老鼠洞').active = false
|
|
this.mapNode.getChildByName('豪华老鼠洞').active = true
|
|
this.unlockLevel(13)
|
|
}else if(checkTarget.name == 'liangxi_check'){
|
|
this.mapNode.getChildByName('凉席').active = false
|
|
this.mapNode.getChildByName('床').active = true
|
|
this.unlockLevel(8)
|
|
}else if(checkTarget.name == 'nainaizuo_check'){
|
|
|
|
this.unlockLevel(7)
|
|
this.mapNode.getChildByName('nainaizuo_check').active = false
|
|
this.mapNode.getChildByName('nainaitang_check').active = true
|
|
this.mapNode.getChildByName('奶奶').getComponent(sp.Skeleton).setAnimation(0,'报纸发抖', true)
|
|
if(this.isAnmoNan){
|
|
this.mapNode.getChildByName('按摩男待机').active = true
|
|
this.mapNode.getChildByName('按摩男').active = false
|
|
}
|
|
|
|
this.nainaiIsTang = true
|
|
}else if(checkTarget.name == 'nainaitang_check'){
|
|
this.unlockLevel(9)
|
|
this.mapNode.getChildByName('nainaitang_check').active = false
|
|
this.nainaiIsTang = true
|
|
this.mapNode.getChildByName('奶奶').getComponent(sp.Skeleton).setAnimation(0,'被子待机', true)
|
|
if(this.isAnmoNan){
|
|
this.mapNode.getChildByName('按摩男待机').active = true
|
|
this.mapNode.getChildByName('按摩男').active = false
|
|
}
|
|
}else if(checkTarget.name == '普通桌子'){
|
|
this.mapNode.getChildByName('金桌子').active = true
|
|
this.unlockLevel(2)
|
|
|
|
}else if(checkTarget.name == '发霉馒头'){
|
|
this.mapNode.getChildByName('发霉馒头').active = false
|
|
this.mapNode.getChildByName('豪华菜品').active = true
|
|
this.mapNode.getChildByName('龙虾').active = true
|
|
this.mapNode.getChildByName('龙虾fixedArea').active = true
|
|
this.openTouchEvent(this.mapNode.getChildByName('龙虾'),['龙虾fixedArea'])
|
|
this.unlockLevel(3)
|
|
}else if(checkTarget.name == '男模海报'){
|
|
this.isAnmoNan = true
|
|
this.unlockLevel(12)
|
|
if(this.nainaiIsTang){
|
|
this.mapNode.getChildByName('按摩男').active = false
|
|
this.mapNode.getChildByName('按摩男待机').active = true
|
|
}else{
|
|
this.mapNode.getChildByName('按摩男').active = true
|
|
this.mapNode.getChildByName('按摩男待机').active = false
|
|
}
|
|
|
|
|
|
}else if(checkTarget.name == '火堆'){
|
|
this.unlockLevel(1)
|
|
this.mapNode.getChildByName('烤火炉').active = true
|
|
|
|
}else if(checkTarget.name == 'jiji_check'){
|
|
this.yeyeAnmo = true
|
|
this.unlockLevel(14)
|
|
this.mapNode.getChildByName('鸡').active = false
|
|
if(this.yeyeMove){
|
|
this.mapNode.getChildByName('按摩女').active = false
|
|
this.mapNode.getChildByName('按摩女2').active = true
|
|
}else{
|
|
this.mapNode.getChildByName('按摩女').active = true
|
|
this.mapNode.getChildByName('按摩女2').active = false
|
|
}
|
|
if(this.mapNode.getChildByName('爷爷按摩椅').active){
|
|
this.mapNode.getChildByName('按摩女2').active = false
|
|
this.mapNode.getChildByName('按摩女3').active = true
|
|
}
|
|
}else if(checkTarget.name == 'yeyeanmo_check'){
|
|
this.unlockLevel(5)
|
|
this.mapNode.getChildByName('爷爷按摩椅').getComponent(sp.Skeleton).setAnimation(0,'棉服', true)
|
|
this.mapNode.getChildByName('yeyezuo_check').active = false
|
|
this.mapNode.getChildByName('yeyeanmo_check').active = false
|
|
}else if(checkTarget.name == '龙虾fixedArea'){
|
|
this.mapNode.getChildByName('龙虾fixedArea').active = false
|
|
this.mapNode.getChildByName('龙虾').active = true
|
|
this.closeTouchEvent(this.mapNode.getChildByName('龙虾'))
|
|
this.mapNode.getChildByName('龙虾').setPosition(this.mapNode.getChildByName('龙虾fixedArea').getPosition())
|
|
let nodePos = this.mapNode.getChildByName('老鼠fixedNode').getPosition()
|
|
let laoShu = this.mapNode.getChildByName('老鼠spine')
|
|
laoShu.active = true
|
|
laoShu.getComponent(sp.Skeleton).setAnimation(0,'原地',true)
|
|
cc.tween(laoShu)
|
|
.to(0.8,{x:nodePos.x,y:nodePos.y})
|
|
.call(()=>{
|
|
laoShu.getComponent(sp.Skeleton).clearTracks()
|
|
this.mapNode.getChildByName('老鼠fixedNode').active = true
|
|
})
|
|
.start()
|
|
return
|
|
}else if(checkTarget.name == '老鼠fixedNode'){
|
|
this.unlockLevel(15)
|
|
this.mapNode.getChildByName('老鼠衣服').active = true
|
|
}
|
|
|
|
this.curFinishNum ++
|
|
|
|
console.log(checkTarget.name, 'checkTarget.name+++++====')
|
|
console.log('this.curFinishNum===',this.curFinishNum)
|
|
|
|
this.checkIsFinish()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
}
|
|
checkArea(node,checkNodeTab){
|
|
let checkIndex = null
|
|
for(let i=0;i<checkNodeTab.length;i++){
|
|
let target = this.mapNode.getChildByName(checkNodeTab[i])
|
|
|
|
if(target && target.active && Common5.checkContainsNode(target,node)){
|
|
checkIndex = target
|
|
break
|
|
}
|
|
}
|
|
return checkIndex
|
|
}
|
|
checkIsFinish(){
|
|
if(this.curFinishNum >= 16){
|
|
console.log('结算+++===',this.curFinishNum)
|
|
this.scheduleOnce(()=>{
|
|
if(this.curFinishNum >= 16){
|
|
if(this.isStepRight){
|
|
Game.ins.showSuccess()
|
|
}else{
|
|
Game.ins.showFail()
|
|
}
|
|
}
|
|
},2)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
unlockLevel(sublevel){
|
|
Game.ins.tipUnlock(sublevel)
|
|
}
|
|
} |