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.
4351 lines
202 KiB
4351 lines
202 KiB
|
|
import EventMgr from "../../../FrameWork/Event/EventMgr";
|
|
import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
|
|
import Common5 from "../../../Platform/th/Common5";
|
|
import Game from "../../../Scripts/Game";
|
|
import ZhaoChaConfig_v4 from "./ZhaoChaConfig_v4";
|
|
import Common from "../../../FrameWork/Util/Common";
|
|
import DaDianScript from "../../../FrameWork/Base/DaDianScript";
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
|
|
@ccclass
|
|
export default class ZhaoCha extends cc.Component{
|
|
gameId:number = 0;
|
|
gameInfo = null
|
|
originalTouchDistance:number = 0 //起始双指触摸间距
|
|
lastScale:number = 1//上次缩放值
|
|
curScale:number = 1//当前缩放值
|
|
touchId1:number = -1
|
|
touchId2:number = -2
|
|
findTimes:number = 0//已找出个数
|
|
mapNode: cc.Node = null; //map图片
|
|
mapNodeFixedScale:number = 0.6//固定缩放(图片太大了)
|
|
touchStartTime:number = 0//触摸开始时间
|
|
isFind = false;
|
|
curZIndex:number = 100;
|
|
allMoneyNum_ = 0
|
|
@property(cc.Node)
|
|
timeNode:cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
maskNode:cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
markSp: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
answerNodeType1: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
answerNodeType2: cc.Node = null;
|
|
startTime_: number = 0;
|
|
endTime_ :number = 0
|
|
endclickIndex = 0
|
|
startPosi: any;
|
|
|
|
subBundle = null
|
|
subUrl = null
|
|
isFailShow = false;
|
|
isSuccessShow=false;
|
|
update(dt: number){
|
|
|
|
}
|
|
|
|
onLoad(){
|
|
Common.Type = 2;
|
|
Common.subLevel = 0;
|
|
Common.GameSubTipConfigs=[Common5.gameConfig.zmGameConfig[Common5.selectGameNum].toolTip]
|
|
this.subBundle = Common5.gameConfig.zmGameConfig[Common5.selectGameNum].subbundle
|
|
this.subUrl = Common5.gameConfig.zmGameConfig[Common5.selectGameNum].suburl
|
|
this.gameId = Common5.gameConfig.zmGameConfig[Common5.selectGameNum].gameId
|
|
this.gameInfo = ZhaoChaConfig_v4.getInstance().getHideGoodsInfo(this.gameId)
|
|
|
|
EventMgr.onEvent_custom(ryw_Event.timeOut, (tab) => {
|
|
Game.ins.showFail();;
|
|
}, this);
|
|
DaDianScript.userEnterDaDian()
|
|
}
|
|
start(){
|
|
cc.macro.ENABLE_MULTI_TOUCH = true;
|
|
this.init_line()
|
|
this.initMapNodeTouchEvent()
|
|
this.setTimeNode()
|
|
}
|
|
|
|
setTimeNode(){
|
|
let worldPos = this.timeNode.getPosition()
|
|
Game.ins.setTimePos(worldPos.x,worldPos.y)
|
|
Game.ins.setTimeScale(0.7)
|
|
}
|
|
init_line(){
|
|
let answerNode = null
|
|
if(this.gameInfo.PrefabInfo.zhaoChaType == ZhaoChaConfig_v4.getInstance().getZhaoChaType().Type1){
|
|
answerNode = this.answerNodeType1
|
|
}else if(this.gameInfo.PrefabInfo.zhaoChaType == ZhaoChaConfig_v4.getInstance().getZhaoChaType().Type2){
|
|
answerNode = this.answerNodeType2
|
|
}
|
|
answerNode.active = true
|
|
for(var i=0;i<this.gameInfo.PrefabInfo.num;i++){
|
|
answerNode.getChildByName("xhx_"+i).active = true
|
|
}
|
|
}
|
|
//初始化触摸监听
|
|
initMapNodeTouchEvent(){
|
|
Common5.getPrefabFromBundle(this.subBundle,this.subUrl,this.maskNode,(prefabNode)=>{
|
|
this.mapNode = prefabNode
|
|
|
|
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")
|
|
this.startTime_ = new Date().getTime();
|
|
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
|
|
|
|
}else if(touches.length == 1){ //拖动
|
|
let delta = event.getDelta()
|
|
this.mapNode.x += delta.x
|
|
this.mapNode.y += delta.y
|
|
|
|
this.goToBoundary()
|
|
}
|
|
}
|
|
touchEnd_mapNode(event){
|
|
if(Date.now() - this.touchStartTime > 0.2 * 1000){
|
|
|
|
}else{
|
|
this.isFind = false;
|
|
let touchPos = event.getLocation();
|
|
this.checkIsInAreaNewVersion(touchPos)
|
|
|
|
|
|
if(!this.isFind && this.gameInfo.PrefabInfo.AddTime){
|
|
let pos = Common5.getPosInWorld_custom(this.timeNode);
|
|
pos.x = pos.x + 80;
|
|
|
|
Common5.showTips_customTimeNew(this.gameInfo.PrefabInfo.AddTime.toString(), 0.3, pos);
|
|
Game.ins.addTick(this.gameInfo.PrefabInfo.AddTime);
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
//距离
|
|
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
|
|
}
|
|
|
|
}
|
|
//找到一个茬点
|
|
findOnChaDian(curNode){
|
|
let markParent = curNode
|
|
Common5.playEffect("success2")
|
|
if(this.gameInfo.PrefabInfo.isShowMark){
|
|
let mark = cc.instantiate(this.markSp)
|
|
mark.active = true
|
|
markParent.addChild(mark)
|
|
}
|
|
|
|
let parentNode = null
|
|
if(this.gameInfo.PrefabInfo.zhaoChaType == ZhaoChaConfig_v4.getInstance().getZhaoChaType().Type1){
|
|
parentNode = this.answerNodeType1
|
|
}else if(this.gameInfo.PrefabInfo.zhaoChaType == ZhaoChaConfig_v4.getInstance().getZhaoChaType().Type2){
|
|
parentNode = this.answerNodeType2
|
|
}
|
|
let childNode = parentNode.getChildByName("xhx_"+this.findTimes)
|
|
let answerIcon = cc.instantiate(curNode.getChildByName("childIcon"));
|
|
answerIcon.active = true;
|
|
answerIcon.parent = childNode
|
|
Common5.setNodeToTargetPos(answerIcon,curNode.getChildByName("childIcon"))
|
|
|
|
this.findTimes += 1
|
|
// answerIcon.scale = 0
|
|
let endDelay = 0.4
|
|
if(this.findTimes >= this.gameInfo.PrefabInfo.num){
|
|
endDelay = this.gameInfo.PrefabInfo.endDelay||1
|
|
cc.tween(answerIcon)
|
|
.to(0.4,{x:0,y:0})
|
|
.delay(endDelay)
|
|
.call(()=>{
|
|
if(!cc.isValid(childNode)){
|
|
return
|
|
}
|
|
childNode.getChildByName("desc").active = true
|
|
childNode.getChildByName("desc").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].desc
|
|
//console.log("已完成个数==",this.findTimes)
|
|
if(this.findTimes >= this.gameInfo.PrefabInfo.num){
|
|
//console.log("完成任务===")
|
|
if(this.gameInfo.PrefabInfo.startMoney || this.gameInfo.PrefabInfo.targetMoney){
|
|
if(this.node["allMoney"] != this.gameInfo.PrefabInfo.targetMoney){
|
|
this.scheduleOnce(()=>{
|
|
this.endGameView(0)
|
|
},2)
|
|
return
|
|
}
|
|
}
|
|
let timeNum = 0.1
|
|
this.scheduleOnce(()=>{
|
|
this.endGameView(1)
|
|
},timeNum)
|
|
return
|
|
}
|
|
})
|
|
.start()
|
|
}else{
|
|
cc.tween(answerIcon)
|
|
.to(0.4,{x:0,y:0})
|
|
.call(()=>{
|
|
childNode.getChildByName("desc").active = true
|
|
childNode.getChildByName("desc").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].desc
|
|
//console.log("已完成个数==",this.findTimes)
|
|
if(this.findTimes >= this.gameInfo.PrefabInfo.num){
|
|
//console.log("完成任务===")
|
|
if(this.gameInfo.PrefabInfo.startMoney || this.gameInfo.PrefabInfo.targetMoney){
|
|
if(this.node["allMoney"] != this.gameInfo.PrefabInfo.targetMoney){
|
|
this.scheduleOnce(()=>{
|
|
this.endGameView(0)
|
|
},2)
|
|
return
|
|
}
|
|
}
|
|
let timeNum = 0.1
|
|
this.scheduleOnce(()=>{
|
|
this.endGameView(1)
|
|
},timeNum)
|
|
return
|
|
}
|
|
})
|
|
.start()
|
|
}
|
|
|
|
|
|
this.findChaDianSpecialLogic(curNode,answerIcon)
|
|
}
|
|
//检测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
|
|
this.findOnChaDian(childrens[i])
|
|
this.isFind = true
|
|
}
|
|
break
|
|
}
|
|
}
|
|
this.handSpecialGameLogic(pos)
|
|
}
|
|
//特殊节点的点击事件(主要处理节点可以移动的问题)
|
|
specialNodeTouchEvent(){
|
|
if(this.gameId == 1201){
|
|
// this.node["dianHuo"] = "no"
|
|
// this.node["kaiChuangLian"] = "no"
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"开头语音");
|
|
this.node["allMoney"] = 50000
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "功德币:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+"亿"
|
|
let huoyanSpine = this.mapNode.getChildByName('huoyanSpine')
|
|
let huoPenTouchArea = huoyanSpine.getChildByName('huoPenTouchArea');
|
|
//打火机
|
|
let daHuoJi = this.mapNode.getChildByName('daHuoJi');
|
|
//方便面
|
|
let fangBianMian = this.mapNode.getChildByName('fangBianMian');
|
|
//电脑
|
|
let dianNao = this.mapNode.getChildByName('dianNao');
|
|
//纸钱
|
|
let zhiQian = this.mapNode.getChildByName('zhiQian');
|
|
//肾宝片
|
|
let shenBao = this.mapNode.getChildByName('shenBao');
|
|
//空调
|
|
let kongTiao = this.mapNode.getChildByName('kongTiao');
|
|
//辣条
|
|
let laTiao = this.mapNode.getChildByName('laTiao');
|
|
//音效
|
|
let yinXiang = this.mapNode.getChildByName('yinXiang');
|
|
//动物世界
|
|
let dongWuShiJie = this.mapNode.getChildByName('dongWuShiJie');
|
|
//鬼差证
|
|
let guiChaiZheng = this.mapNode.getChildByName('guiChaiZheng')
|
|
//胡椒
|
|
let huJiao = this.mapNode.getChildByName("huJiao")
|
|
//手机
|
|
let shouJi = this.mapNode.getChildByName("shouJi")
|
|
//烟
|
|
let yan = this.mapNode.getChildByName("yan")
|
|
//房产证
|
|
let fangChanZheng = this.mapNode.getChildByName("fangChanZheng")
|
|
//咖啡
|
|
let kaFei = this.mapNode.getChildByName("kaFei")
|
|
|
|
let commonFunc = (chaNode)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+this.gameInfo.ChaNode[chaNode.name].sound);
|
|
huoyanSpine.getComponent(sp.Skeleton).setAnimation(0,"dahuo",false)
|
|
this.scheduleOnce(()=>{
|
|
huoyanSpine.getComponent(sp.Skeleton).setAnimation(0,"xiaohuo",true)
|
|
},1.2)
|
|
}
|
|
let daHuoJiAttrs = {
|
|
startPos:daHuoJi.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
callFunction: ()=>{
|
|
// Common5.playMusicCustom('WordGame',this.gameInfo.PrefabInfo.soundurl+"爆燃")
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"爆燃");
|
|
daHuoJi["bSwitch"] = true
|
|
huoyanSpine.getComponent(sp.Skeleton).setAnimation(0,"xiaohuo",true)
|
|
}
|
|
}
|
|
let fangBianMianAttrs = {
|
|
startPos:fangBianMian.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('FangBianMian')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let dianNaoAttrs = {
|
|
startPos:dianNao.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('DianNao')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let zhiQianAttrs = {
|
|
startPos:zhiQian.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('ZhiQian')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let shenBaoAttrs = {
|
|
startPos:shenBao.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('ShenBaoPian')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let kongTiaoAttrs = {
|
|
startPos:kongTiao.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('KongTiao')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let laTiaoAttrs = {
|
|
startPos:laTiao.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('LaTiao')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let yinXiangAttrs = {
|
|
startPos:yinXiang.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('YinXiang')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"小苹果");
|
|
this.mapNode.getChildByName('sudaqiang').getComponent(sp.Skeleton).setAnimation(0,"tiaowu1",true)
|
|
this.scheduleOnce(()=>{
|
|
this.mapNode.getChildByName('sudaqiang').getComponent(sp.Skeleton).setAnimation(0,"daiji",true)
|
|
},7)
|
|
}
|
|
}
|
|
let dongWuShiJieAttrs = {
|
|
startPos:dongWuShiJie.getPosition(),
|
|
touchArea:this.mapNode.getChildByName('feiChaDianNode').getChildByName('chuangHuTouchArea'),
|
|
bindNode:this.mapNode.getChildByName('feiChaDianNode').getChildByName('chuangHuTouchArea'),
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"春天到了");
|
|
Common5.setNodeToTargetPos(guiChaiZheng,this.mapNode.getChildByName('niuTou'))
|
|
guiChaiZheng.active = true
|
|
guiChaiZheng.scale = 0
|
|
cc.tween(guiChaiZheng)
|
|
.delay(2)
|
|
.call(()=>{
|
|
this.mapNode.getChildByName('niuTou').active = false
|
|
})
|
|
.to(0.4,{x:190,y:-630,scale:1})
|
|
.start()
|
|
}
|
|
}
|
|
let guiChaiZhengAttrs = {
|
|
startPos:guiChaiZheng.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('GuiChaiZheng')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let huJiaoAttrs = {
|
|
startPos:huJiao.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('HuJiao')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let shouJiAttrs = {
|
|
startPos:shouJi.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
bindNode:daHuoJi,
|
|
callFunction: ()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('ShouJi')
|
|
commonFunc(chaNode)
|
|
this.findOnChaDian(chaNode)
|
|
}
|
|
}
|
|
let yanAttrs = {
|
|
startPos:yan.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"香烟");
|
|
}
|
|
}
|
|
let fangChanZhengAttrs = {
|
|
startPos:fangChanZheng.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"房产证");
|
|
}
|
|
}
|
|
let kaFeiAttrs = {
|
|
startPos:kaFei.getPosition(),
|
|
touchArea:huoPenTouchArea,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"咖啡");
|
|
}
|
|
}
|
|
|
|
this.openTouchEvent(daHuoJi,daHuoJiAttrs)
|
|
this.openTouchEvent(fangBianMian,fangBianMianAttrs)
|
|
this.openTouchEvent(dianNao,dianNaoAttrs)
|
|
this.openTouchEvent(zhiQian,zhiQianAttrs)
|
|
this.openTouchEvent(shenBao,shenBaoAttrs)
|
|
this.openTouchEvent(kongTiao,kongTiaoAttrs)
|
|
this.openTouchEvent(laTiao,laTiaoAttrs)
|
|
this.openTouchEvent(yinXiang,yinXiangAttrs)
|
|
this.openTouchEvent(dongWuShiJie,dongWuShiJieAttrs)
|
|
this.openTouchEvent(guiChaiZheng,guiChaiZhengAttrs)
|
|
this.openTouchEvent(huJiao,huJiaoAttrs)
|
|
this.openTouchEvent(shouJi,shouJiAttrs)
|
|
|
|
this.openTouchEvent(yan,yanAttrs)
|
|
this.openTouchEvent(fangChanZheng,fangChanZhengAttrs)
|
|
this.openTouchEvent(kaFei,kaFeiAttrs)
|
|
}else if(this.gameId == 1202){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"我给高老板送了这么多次鱼(0)");
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "佣金费:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
|
|
//人影
|
|
let renYing = this.mapNode.getChildByName('renYing');
|
|
//高启强
|
|
let gaoQiQiang = this.mapNode.getChildByName('gaoQiQiang');
|
|
//大嫂
|
|
let daSao = this.mapNode.getChildByName('daSao');
|
|
//黑蒜
|
|
let heiSuan = this.mapNode.getChildByName('heiSuan');
|
|
//佣金
|
|
let yongJin = this.mapNode.getChildByName('yongJin');
|
|
let heiSuanAttrs = {
|
|
startPos:heiSuan.getPosition(),
|
|
touchArea:daSao,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"大嫂呕吐音效(0)");
|
|
daSao.getChildByName("dasaoSpine").getComponent(sp.Skeleton).setAnimation(0,"tu",false)
|
|
this.scheduleOnce(()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"老婆,你没事吧(0)");
|
|
cc.tween(gaoQiQiang)
|
|
.to(0.4,{y:400})
|
|
.start()
|
|
|
|
let zuanJie = this.mapNode.getChildByName('zuanJie');
|
|
zuanJie.active = true
|
|
this.gameInfo.ChaNode["ZuanJie"].isCanTouch = true
|
|
|
|
daSao.getChildByName("dasaoSpine").getComponent(sp.Skeleton).setAnimation(0,"daijiku",true)
|
|
let daSaoAttrs = {
|
|
startPos:daSao.getPosition(),
|
|
touchArea:gaoQiQiang,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"等我东山再起房里的东西都归你了(0)");
|
|
gaoQiQiang.active = false
|
|
renYing.active = true
|
|
cc.tween(renYing)
|
|
.delay(0.5)
|
|
.by(2,{x:600})
|
|
.call(()=>{
|
|
yongJin.active = true
|
|
yongJin.scale = 0.3
|
|
cc.tween(yongJin)
|
|
.to(0.6,{x:-208,y:-575,scale:1})
|
|
.call(()=>{
|
|
this.gameInfo.ChaNode["YongJin"].isCanTouch = true
|
|
})
|
|
.start()
|
|
})
|
|
.start()
|
|
Common5.setNodeToTargetPos(yongJin,gaoQiQiang)
|
|
|
|
}
|
|
}
|
|
this.openTouchEvent(daSao,daSaoAttrs)
|
|
},1)
|
|
}
|
|
}
|
|
this.openTouchEvent(heiSuan,heiSuanAttrs)
|
|
//床
|
|
let chuangTouchArea = this.mapNode.getChildByName('chuangTouchArea');
|
|
|
|
let qingShu = this.mapNode.getChildByName('qingShu');
|
|
let poDiBan = this.mapNode.getChildByName('poDiBan');
|
|
let chuang = this.mapNode.getChildByName('chuang');
|
|
let poChuang = this.mapNode.getChildByName('poChuang');
|
|
let dongYu = this.mapNode.getChildByName('dongYu');
|
|
|
|
//地砖
|
|
let diZhuan = this.mapNode.getChildByName('diZhuan');
|
|
//锤子
|
|
let chuiZi = this.mapNode.getChildByName('chuiZi');
|
|
let chuiZiAttrs = {
|
|
startPos:chuiZi.getPosition(),
|
|
touchArea1:chuangTouchArea,
|
|
touchArea2:diZhuan,
|
|
callFunction1: ()=>{
|
|
chuang.active = false
|
|
poChuang.active = true
|
|
dongYu.active = true
|
|
this.gameInfo.ChaNode["DongYu"].isCanTouch = true
|
|
},
|
|
callFunction2: ()=>{
|
|
diZhuan.active = false
|
|
qingShu.active = true
|
|
poDiBan.active = true
|
|
this.gameInfo.ChaNode["QingShu"].isCanTouch = true
|
|
}
|
|
}
|
|
this.openTouchEvent(chuiZi,chuiZiAttrs)
|
|
//八音盒
|
|
let baYinHe = this.mapNode.getChildByName('baYinHe');
|
|
//汉堡
|
|
let hanBao = this.mapNode.getChildByName('hanBao');
|
|
//老八汉堡
|
|
let laBaHanBao = this.mapNode.getChildByName('laBaHanBao');
|
|
let hanBaoAttrs = {
|
|
startPos:hanBao.getPosition(),
|
|
touchArea:baYinHe,
|
|
callFunction: ()=>{
|
|
baYinHe.active = false
|
|
laBaHanBao.active = true
|
|
this.gameInfo.ChaNode["MiZhiXiaoHanBao"].isCanTouch = true
|
|
this.gameInfo.ChaNode["BaYinHeWanJu"].isCanTouch = false
|
|
}
|
|
}
|
|
this.openTouchEvent(hanBao,hanBaoAttrs)
|
|
}else if(this.gameId == 1203){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"开头语音");
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "房价:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
//黄油漆
|
|
let huangYouQi = this.mapNode.getChildByName('huangYouQi');
|
|
//马桶
|
|
let maTong = this.mapNode.getChildByName('maTong');
|
|
//金马桶
|
|
let jinMaTong = this.mapNode.getChildByName('jinMaTong');
|
|
let huangYouQiAttrs = {
|
|
startPos:huangYouQi.getPosition(),
|
|
touchArea:maTong,
|
|
callFunction: ()=>{
|
|
maTong.active = false
|
|
jinMaTong.active = true
|
|
this.gameInfo.ChaNode["HuangJinMaTong"].isCanTouch = true
|
|
}
|
|
}
|
|
this.openTouchEvent(huangYouQi,huangYouQiAttrs)
|
|
|
|
//菜刀
|
|
let caiDao = this.mapNode.getChildByName('caiDao');
|
|
let daoSpine = this.mapNode.getChildByName('daoSpine');
|
|
//水管
|
|
let shuiGuan = this.mapNode.getChildByName('shuiGuan');
|
|
//破水管
|
|
let poShuiGuan = this.mapNode.getChildByName('poShuiGuan');
|
|
//房间水
|
|
let fangJianShui = this.mapNode.getChildByName('fangJianShui');
|
|
let caiDaoAttrs = {
|
|
startPos:caiDao.getPosition(),
|
|
touchArea:shuiGuan,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"刀砍管路(0)");
|
|
daoSpine.active = true
|
|
daoSpine.getComponent(sp.Skeleton).setAnimation(0,"animation",false)
|
|
daoSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
this.gameInfo.ChaNode["TianRanYongChi"].isCanTouch = true
|
|
shuiGuan.active = false
|
|
poShuiGuan.active = true
|
|
fangJianShui.active = true
|
|
fangJianShui.opacity = 0
|
|
cc.tween(fangJianShui)
|
|
.to(1.5,{opacity:255})
|
|
.start()
|
|
daoSpine.active = false
|
|
})
|
|
}
|
|
}
|
|
this.openTouchEvent(caiDao,caiDaoAttrs)
|
|
|
|
//狗衣服
|
|
let gouYiFu = this.mapNode.getChildByName('gouYiFu');
|
|
//狗身上衣服
|
|
let gouShenShangYi = this.mapNode.getChildByName('gouShenShangYi');
|
|
//狗
|
|
let gou = this.mapNode.getChildByName('gou');
|
|
let gouYiFuAttrs = {
|
|
startPos:gouYiFu.getPosition(),
|
|
touchArea:gou,
|
|
callFunction: ()=>{
|
|
gouShenShangYi.active = true
|
|
this.gameInfo.ChaNode["AnBaoQuan"].isCanTouch = true
|
|
}
|
|
}
|
|
this.openTouchEvent(gouYiFu,gouYiFuAttrs)
|
|
|
|
//剪刀
|
|
let jianDao = this.mapNode.getChildByName('jianDao');
|
|
//盆栽
|
|
let penZai = this.mapNode.getChildByName('penZai');
|
|
let jianshuzhiSpine = penZai.getChildByName('jianshuzhiSpine');
|
|
let jianDaoAttrs = {
|
|
startPos:jianDao.getPosition(),
|
|
touchArea:penZai,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"剪子修剪盆栽(0)");
|
|
jianshuzhiSpine.getComponent(sp.Skeleton).setAnimation(0,"jianshuzhi",false)
|
|
jianshuzhiSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
this.gameInfo.ChaNode["PenZai"].isCanTouch = true
|
|
})
|
|
}
|
|
}
|
|
this.openTouchEvent(jianDao,jianDaoAttrs)
|
|
|
|
//螺丝刀
|
|
let luoSiDao = this.mapNode.getChildByName('luoSiDao');
|
|
//螺丝
|
|
let ningLuoSiSpine = this.mapNode.getChildByName('ningLuoSiSpine');
|
|
//床
|
|
let chuangSpine = this.mapNode.getChildByName('chuangSpine');
|
|
let luoSiDaoAttrs = {
|
|
startPos:luoSiDao.getPosition(),
|
|
touchArea:ningLuoSiSpine,
|
|
callFunction: ()=>{
|
|
ningLuoSiSpine.getComponent(sp.Skeleton).setAnimation(0,"animation",false)
|
|
ningLuoSiSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"床摇的声音(0)");
|
|
this.gameInfo.ChaNode["YaoYaoChuang"].isCanTouch = true
|
|
chuangSpine.getComponent(sp.Skeleton).setAnimation(0,"animation",true)
|
|
})
|
|
}
|
|
}
|
|
this.openTouchEvent(luoSiDao,luoSiDaoAttrs)
|
|
|
|
//砖头
|
|
let zhuanTou = this.mapNode.getChildByName('zhuanTou');
|
|
//电视机
|
|
let dianShiJi = this.mapNode.getChildByName('dianShiJi');
|
|
//电视机
|
|
let dianshijiSpine = dianShiJi.getChildByName('dianshijiSpine');
|
|
let zhuanTouAttrs = {
|
|
startPos:zhuanTou.getPosition(),
|
|
touchArea:dianShiJi,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"板砖拍电视(0)");
|
|
dianshijiSpine.getComponent(sp.Skeleton).setAnimation(0,"paidianshi",false)
|
|
dianshijiSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
this.gameInfo.ChaNode["DianShiJi"].isCanTouch = true
|
|
})
|
|
}
|
|
}
|
|
this.openTouchEvent(zhuanTou,zhuanTouAttrs)
|
|
|
|
//锤子
|
|
let chuiZi = this.mapNode.getChildByName('chuiZi');
|
|
//雕像
|
|
let diaoXiang = this.mapNode.getChildByName('diaoXiang');
|
|
//雕像
|
|
let diaoxiangSpine = diaoXiang.getChildByName('diaoxiangSpine');
|
|
let chuiZiAttrs = {
|
|
startPos:chuiZi.getPosition(),
|
|
touchArea:diaoXiang,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤子砸雕塑(0)");
|
|
diaoxiangSpine.getComponent(sp.Skeleton).setAnimation(0,"animation",false)
|
|
diaoxiangSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
this.gameInfo.ChaNode["DuBiDiaoXiang"].isCanTouch = true
|
|
})
|
|
}
|
|
}
|
|
this.openTouchEvent(chuiZi,chuiZiAttrs)
|
|
|
|
//葫芦
|
|
let huLuAn = this.mapNode.getChildByName('huLuAn');
|
|
let huLuLiang = this.mapNode.getChildByName('huLuLiang');
|
|
//王多鱼
|
|
let wangduoyu = this.mapNode.getChildByName('wangduoyu');
|
|
//王多鱼
|
|
let wangduoyuSpine = wangduoyu.getChildByName('wangduoyuSpine');
|
|
let huLuAttrs = {
|
|
startPos:huLuAn.getPosition(),
|
|
touchArea:wangduoyu,
|
|
callFunction: ()=>{
|
|
wangduoyuSpine.getComponent(sp.Skeleton).setAnimation(0,"panhulu",false)
|
|
this.scheduleOnce(()=>{
|
|
this.gameInfo.ChaNode["HuLu"].isCanTouch = true
|
|
huLuLiang.active = true
|
|
wangduoyuSpine.getComponent(sp.Skeleton).setAnimation(0,"daiji",true)
|
|
},1.2)
|
|
}
|
|
}
|
|
this.openTouchEvent(huLuAn,huLuAttrs)
|
|
}else if(this.gameId == 1301){
|
|
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前售价:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1301Game()
|
|
}else if(this.gameId == 1302){
|
|
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前售价:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1302Game()
|
|
}else if(this.gameId == 1303){
|
|
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前金额:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1303Game()
|
|
}else if(this.gameId == 1304){
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前金额:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1304Game()
|
|
}else if(this.gameId == 1305){
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前金额:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1305Game()
|
|
}else if(this.gameId == 1306){
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前金额:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1306Game()
|
|
}else if(this.gameId == 1307){
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前身价:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1307Game()
|
|
}else if(this.gameId == 1308){
|
|
this.node["allMoney"] = this.gameInfo.PrefabInfo.startMoney
|
|
this.node.getChildByName("msg").active = true
|
|
this.node.getChildByName("msg").getChildByName("title").getComponent(cc.Label).string = "当前心情:"
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
this.firstInit1308Game()
|
|
}
|
|
}
|
|
|
|
|
|
firstInit1308Game(){
|
|
|
|
|
|
this.node["qiPaoEffect"] = (node,soundUrl,delay1)=>{
|
|
|
|
|
|
console.log(delay1,'delay1')
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl)
|
|
node.active = true
|
|
node.scale = 0
|
|
node.getChildByName("str").getComponent(cc.Label).string = soundUrl
|
|
cc.tween(node)
|
|
.to(0.2,{scale:1})
|
|
.delay(delay1)
|
|
.to(0.2,{scale:0})
|
|
.call(()=>{
|
|
node.active = false
|
|
})
|
|
.start()
|
|
}
|
|
|
|
this.node["dialogFunc"] = (qiPao1,soundUrl_1,delay1,qiPao2?:cc.Node,soundUrl_2?:string)=>{
|
|
this.node.stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNvRen').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNvRen2').stopAllActions()
|
|
|
|
this.mapNode.getChildByName('qiPaoNvRen').active = false
|
|
this.mapNode.getChildByName('qiPaoNvRen2').active = false
|
|
|
|
if(qiPao2){
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1,delay1)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao2,soundUrl_2,delay1)
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
// qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
// taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
})
|
|
.start()
|
|
}else{
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1,delay1)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
//移动的
|
|
let kaoji = this.mapNode.getChildByName('烤鸡冰箱')
|
|
let kaoxiangMen = this.mapNode.getChildByName('烤箱门关闭')
|
|
let kaojisheng = this.mapNode.getChildByName('烤鸡生')
|
|
let kaojiAttrs ={
|
|
startPos:kaoji.getPosition(),
|
|
touchArea:kaoxiangMen,
|
|
callFunction: ()=>{
|
|
if(this.gameInfo.FeiChanDian['weiboguanArea'].isCanTouch){
|
|
kaojisheng.active =true
|
|
}else{
|
|
kaoji.active = true
|
|
kaoji.setPosition(kaoji['startPos'])
|
|
this.openTouchEvent1(kaoji)
|
|
}
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(kaoji,kaojiAttrs)
|
|
//
|
|
let yaoshiNode = this.mapNode.getChildByName('钥匙')
|
|
let liubingxie = this.mapNode.getChildByName('溜冰鞋')
|
|
let suo = liubingxie.getChildByName('锁')
|
|
let yaoshiAttrs ={
|
|
startPos:yaoshiNode.getPosition(),
|
|
touchArea:liubingxie,
|
|
callFunction: ()=>{
|
|
suo.active =false
|
|
this.gameInfo.ChaNode["liubingxie"].isCanTouch = true
|
|
},
|
|
}
|
|
this.openTouchEvent(yaoshiNode,yaoshiAttrs)
|
|
|
|
let sizhi = this.mapNode.getChildByName('sizhi')
|
|
let laji = this.mapNode.getChildByName('垃圾桶装满碎纸')
|
|
let xuexiJihua = this.mapNode.getChildByName('学习计划')
|
|
|
|
let sizhiAttrs ={
|
|
startPos:sizhi.getPosition(),
|
|
touchArea:sizhi,
|
|
callFunction: ()=>{
|
|
console.log('1111111')
|
|
xuexiJihua.active = false
|
|
sizhi.getComponent(sp.Skeleton).setAnimation(0,'2si',false)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"撕纸");
|
|
sizhi.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
sizhi.getComponent(cc.Animation).play('sizhiAnim')
|
|
sizhi.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
laji.active = true
|
|
this.gameInfo.FeiChanDian["jihuaBiaoArea"].isCanTouch = false
|
|
sizhi.active = false
|
|
xuexiJihua['istouch'] = true
|
|
this.scheduleOnce(()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('xuexiJihuaBiao')
|
|
this.findOnChaDian(chaNode)
|
|
},0.5)
|
|
|
|
})
|
|
})
|
|
},
|
|
}
|
|
this.openTouchEvent(sizhi,sizhiAttrs)
|
|
|
|
let menpiao = this.mapNode.getChildByName('游乐园门票')
|
|
let menpiaoAttrs ={
|
|
startPos:menpiao.getPosition(),
|
|
touchArea:menpiao,
|
|
callFunction: ()=>{
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(menpiao,menpiaoAttrs)
|
|
|
|
let kechenbiao = this.mapNode.getChildByName('kechenbiao')
|
|
menpiaoAttrs ={
|
|
startPos:kechenbiao.getPosition(),
|
|
touchArea:kechenbiao,
|
|
callFunction: ()=>{
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(kechenbiao,menpiaoAttrs)
|
|
|
|
let guanggao = this.mapNode.getChildByName('招生广告放大')
|
|
menpiaoAttrs ={
|
|
startPos:guanggao.getPosition(),
|
|
touchArea:guanggao,
|
|
callFunction: ()=>{
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(guanggao,menpiaoAttrs)
|
|
|
|
let shouji = this.mapNode.getChildByName('手机放大')
|
|
menpiaoAttrs ={
|
|
startPos:shouji.getPosition(),
|
|
touchArea:shouji,
|
|
callFunction: ()=>{
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(shouji,menpiaoAttrs)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
firstInit1307Game(){
|
|
|
|
this.node["qiPaoEffect"] = (node,soundUrl)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl)
|
|
node.active = true
|
|
node.scale = 0
|
|
node.getChildByName("str").getComponent(cc.Label).string = soundUrl
|
|
cc.tween(node)
|
|
.to(0.2,{scale:1})
|
|
.delay(2.0)
|
|
.to(0.2,{scale:0})
|
|
.call(()=>{
|
|
node.active = false
|
|
})
|
|
.start()
|
|
}
|
|
|
|
this.node["dialogFunc"] = (qiPao1,soundUrl_1,qiPao2?:cc.Node,soundUrl_2?:string)=>{
|
|
this.node.stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNanRen').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNanRen2').stopAllActions()
|
|
|
|
this.mapNode.getChildByName('qiPaoNanRen').active = false
|
|
this.mapNode.getChildByName('qiPaoNanRen2').active = false
|
|
|
|
if(qiPao2){
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao2,soundUrl_2)
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
// qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
// taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
})
|
|
.start()
|
|
}else{
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
let mabu = this.mapNode.getChildByName('抹布')
|
|
let jinyizi = this.mapNode.getChildByName('金椅子')
|
|
|
|
let mabuAttrs ={
|
|
startPos:mabu.getPosition(),
|
|
touchArea:jinyizi,
|
|
callFunction: ()=>{
|
|
jinyizi.getComponent(sp.Skeleton).setAnimation(0,'2mabu',false)
|
|
jinyizi.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
this.gameInfo.ChaNode["jinYizi"].isCanTouch = true
|
|
})
|
|
},
|
|
}
|
|
this.openTouchEvent(mabu,mabuAttrs)
|
|
|
|
|
|
|
|
let erguotou = this.mapNode.getChildByName('黑桃A')
|
|
let heitaoA = this.mapNode.getChildByName('二锅头')
|
|
|
|
let erguotouAttrs ={
|
|
startPos:erguotou.getPosition(),
|
|
touchArea:heitaoA,
|
|
callFunction: ()=>{
|
|
this.gameInfo.ChaNode["hetao"].isCanTouch = true
|
|
},
|
|
}
|
|
this.openTouchEvent(erguotou,erguotouAttrs)
|
|
|
|
|
|
|
|
let yiyuanNode= this.mapNode.getChildByName('yiyuanNode')
|
|
let huojiNode= this.mapNode.getChildByName('huojiNode')
|
|
let yingbiNode= this.mapNode.getChildByName('yingbiNode')
|
|
|
|
let yingbiIns = yingbiNode.getChildByName('硬币')
|
|
let huojiIns= huojiNode.getChildByName('火机')
|
|
let yiyuanIns= yiyuanNode.getChildByName('一元')
|
|
|
|
|
|
let juzishu = this.mapNode.getChildByName('橘子树')
|
|
let youlianArea = this.mapNode.getChildByName('youlianArea') // 2da2 yiyuanIns/huojiIns
|
|
let zuolianArea = this.mapNode.getChildByName('zuolianArea') // 2da1
|
|
let canyingPai = this.mapNode.getChildByName('苍蝇拍')
|
|
let cangyingpaiAttrs = {
|
|
startPos:canyingPai.getPosition(),
|
|
touchArea1:juzishu,
|
|
touchArea2:youlianArea, //2da2 yiyuanIns/huojiIns
|
|
touchArea3:zuolianArea, //2da1 yingbiIns
|
|
callFunction1:()=>{
|
|
canyingPai.setPosition(canyingPai['startPos'])
|
|
canyingPai.active = true
|
|
},
|
|
|
|
callFunction2:()=>{
|
|
//掉落1
|
|
let randNum = Common5.getRandomNum(0,2)
|
|
let icon = null
|
|
let animName = ''
|
|
if(randNum == 0){
|
|
if(huojiIns.parent.childrenCount>10){
|
|
let node_ = huojiIns.parent.children[huojiIns.parent.childrenCount-1]
|
|
node_.removeFromParent()
|
|
}
|
|
|
|
this.gameInfo.ChaNode["daHuoji"].isCanTouch = true
|
|
icon = cc.instantiate(huojiIns)
|
|
icon.active = true
|
|
icon.parent = huojiIns.parent
|
|
animName = 'anim03'
|
|
}else if(randNum == 1){
|
|
|
|
if(yiyuanIns.parent.childrenCount>10){
|
|
let node_ = yiyuanIns.parent.children[yiyuanIns.parent.childrenCount-1]
|
|
node_.removeFromParent()
|
|
}
|
|
|
|
this.gameInfo.ChaNode["yiKuaiqian"].isCanTouch = true
|
|
icon = cc.instantiate(yiyuanIns)
|
|
icon.active = true
|
|
icon.parent = yiyuanIns.parent
|
|
animName = 'anim02'
|
|
}
|
|
|
|
icon.getComponent(cc.Animation).play(animName)
|
|
icon.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
let x = Common5.getRandomNum(-80,80)
|
|
let y = Common5.getRandomNum(-80,80)
|
|
icon.setPosition(cc.v2(x,y))
|
|
})
|
|
},
|
|
|
|
callFunction3:()=>{
|
|
//掉落2
|
|
if(yingbiIns.parent.childrenCount>10){
|
|
let node_ = yingbiIns.parent.children[yingbiIns.parent.childrenCount-1]
|
|
node_.removeFromParent()
|
|
}
|
|
this.gameInfo.ChaNode["wumaoQian"].isCanTouch = true
|
|
let icon = cc.instantiate(yingbiIns)
|
|
icon.active = true
|
|
icon.parent = yingbiIns.parent
|
|
icon.getComponent(cc.Animation).play('anim01')
|
|
icon.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
let x = Common5.getRandomNum(-80,80)
|
|
let y = Common5.getRandomNum(-80,80)
|
|
icon.setPosition(cc.v2(x,y))
|
|
})
|
|
}
|
|
}
|
|
this.openTouchEvent(canyingPai,cangyingpaiAttrs)
|
|
|
|
|
|
let xiangshuiArea = this.mapNode.getChildByName('xiangshuiArea')
|
|
let xiangshui = this.mapNode.getChildByName('香水')
|
|
let xiangshuiSpine = this.mapNode.getChildByName('xiangshuiSpine')
|
|
let wenziSpine = this.mapNode.getChildByName('wenziSpine')
|
|
|
|
let xiangshuiAttrs ={
|
|
startPos:xiangshui.getPosition(),
|
|
touchArea:xiangshuiArea,
|
|
callFunction: ()=>{
|
|
xiangshuiSpine.active = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"喷香水");
|
|
xiangshuiSpine.getComponent(sp.Skeleton).setAnimation(0,"2pen",false)
|
|
this.scheduleOnce(()=>{
|
|
xiangshuiSpine.active = false
|
|
wenziSpine.getComponent(sp.Skeleton).setAnimation(0,"3si",false)
|
|
this.scheduleOnce(()=>{
|
|
wenziSpine.getComponent(cc.Animation).play('wenziDiaoluo')
|
|
wenziSpine.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
this.gameInfo.ChaNode["liuShenXiangshui"].isCanTouch = true
|
|
xiangshui.setPosition(xiangshui['startPos'])
|
|
xiangshui.active = true
|
|
xiangshui.getComponent(cc.BlockInputEvents).enabled = false
|
|
})
|
|
},0.5)
|
|
},1.0)
|
|
},
|
|
}
|
|
this.openTouchEvent(xiangshui,xiangshuiAttrs)
|
|
|
|
|
|
let jinXiangLian = this.mapNode.getChildByName('金项链')
|
|
let ciTieNode = this.mapNode.getChildByName('tieNode')
|
|
let xianglianAttrs = {
|
|
startPos:ciTieNode.getPosition(),
|
|
touchArea:jinXiangLian,
|
|
callFunction:()=>{
|
|
jinXiangLian.active = false
|
|
let jinXiangLian2 = ciTieNode.getChildByName('金项链2')
|
|
jinXiangLian2.active = true
|
|
this.gameInfo.ChaNode["dajinXianglian"].isCanTouch = true
|
|
ciTieNode.getComponent(cc.BlockInputEvents).enabled = false
|
|
}
|
|
}
|
|
this.openTouchEvent(ciTieNode,xianglianAttrs)
|
|
|
|
|
|
let jiabiaojiemianNode= this.mapNode.getChildByName('假表界面')
|
|
let shoubiaoArea = this.mapNode.getChildByName('shoubiaoArea')
|
|
let saomaJiemian = this.mapNode.getChildByName('扫码界面')
|
|
let saomaAttrs = {
|
|
startPos:saomaJiemian.getPosition(),
|
|
touchArea:shoubiaoArea,
|
|
callFunction:()=>{
|
|
saomaJiemian.getComponent(cc.Animation).play('saomaAnim')
|
|
saomaJiemian.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
//this.gameInfo.ChaNode["daJinBiao"].isCanTouch = true
|
|
saomaJiemian.active = false
|
|
jiabiaojiemianNode.active = true
|
|
jiabiaojiemianNode.zIndex = this.curZIndex++
|
|
// this.scheduleOnce(()=>{
|
|
// let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('daJinBiao')
|
|
// this.findOnChaDian(chaNode)
|
|
// jiabiaojiemianNode.active = false
|
|
// },2.0)
|
|
})
|
|
}
|
|
}
|
|
this.openTouchEvent(saomaJiemian,saomaAttrs)
|
|
|
|
let jucheHetong= this.mapNode.getChildByName('租车合同')
|
|
let jieqianJiemian= this.mapNode.getChildByName('借钱界面')
|
|
|
|
let attars = {}
|
|
this.openTouchEvent(jucheHetong,attars)
|
|
this.openTouchEvent(jieqianJiemian,attars)
|
|
this.openTouchEvent(jiabiaojiemianNode,attars)
|
|
|
|
|
|
}
|
|
|
|
|
|
firstInit1306Game(){
|
|
|
|
let laba = this.mapNode.getChildByName('labaSpine')
|
|
laba.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",true)
|
|
this.scheduleOnce(()=>{
|
|
laba.getComponent(sp.Skeleton).setAnimation(0,"1jingzhi",false)
|
|
},2)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"喇叭喊话");
|
|
|
|
|
|
this.node["qiPaoEffect"] = (node,soundUrl)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl)
|
|
node.active = true
|
|
node.scale = 0
|
|
node.getChildByName("str").getComponent(cc.Label).string = soundUrl
|
|
cc.tween(node)
|
|
.to(0.2,{scale:1})
|
|
.delay(2.0)
|
|
.to(0.2,{scale:0})
|
|
.call(()=>{
|
|
node.active = false
|
|
})
|
|
.start()
|
|
}
|
|
|
|
this.node["dialogFunc"] = (qiPao1,soundUrl_1,qiPao2?:cc.Node,soundUrl_2?:string)=>{
|
|
this.node.stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNanRen').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNvRen').stopAllActions()
|
|
|
|
this.mapNode.getChildByName('qiPaoNanRen').active = false
|
|
this.mapNode.getChildByName('qiPaoNvRen').active = false
|
|
|
|
if(qiPao2){
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao2,soundUrl_2)
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
// qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
// taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
})
|
|
.start()
|
|
}else{
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(1.8)
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
let mujiSpine = this.mapNode.getChildByName('mujiSpine')
|
|
let muji2 = this.mapNode.getChildByName('母鸡2')
|
|
let touchArea1 = this.mapNode.getChildByName('鸡蛋')
|
|
let fangdajingAttrs ={
|
|
startPos:muji2.getPosition(),
|
|
touchArea:touchArea1,
|
|
callFunction: ()=>{
|
|
mujiSpine.getComponent(sp.Skeleton).setAnimation(0,"2xiadan",false)
|
|
mujiSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
//鸡生蛋的叫声
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"鸡生蛋的叫声");
|
|
this.gameInfo.ChaNode["jiDan"].isCanTouch = true
|
|
})
|
|
},
|
|
}
|
|
this.openTouchEvent(muji2,fangdajingAttrs)
|
|
|
|
|
|
|
|
}
|
|
|
|
firstInit1305Game(){
|
|
|
|
this.node["qiPaoEffect"] = (node,soundUrl)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl)
|
|
node.active = true
|
|
node.scale = 0
|
|
node.getChildByName("str").getComponent(cc.Label).string = soundUrl
|
|
cc.tween(node)
|
|
.to(0.2,{scale:1})
|
|
.delay(3.0)
|
|
.to(0.2,{scale:0})
|
|
.call(()=>{
|
|
node.active = false
|
|
})
|
|
.start()
|
|
}
|
|
|
|
this.node["dialogFunc"] = (qiPao1,soundUrl_1,qiPao2?:cc.Node,soundUrl_2?:string)=>{
|
|
this.node.stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNv').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoLao').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoQiang').stopAllActions()
|
|
|
|
this.mapNode.getChildByName('qiPaoNv').active = false
|
|
this.mapNode.getChildByName('qiPaoLao').active = false
|
|
this.mapNode.getChildByName('qiPaoQiang').active = false
|
|
|
|
|
|
if(qiPao2){
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao2,soundUrl_2)
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
// qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
// taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
})
|
|
.start()
|
|
}else{
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(1.8)
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
let juzi = this.mapNode.getChildByName('锯子');
|
|
let touchArea1 = this.mapNode.getChildByName('juzishitouSpine');
|
|
let fangdajingAttrs ={
|
|
startPos:juzi.getPosition(),
|
|
touchArea:touchArea1,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锯子");
|
|
touchArea1.getComponent(sp.Skeleton).setAnimation(0,"2jukai",false)
|
|
touchArea1.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
this.gameInfo.ChaNode["JueshiFeicui"].isCanTouch = true
|
|
})
|
|
},
|
|
}
|
|
this.openTouchEvent(juzi,fangdajingAttrs)
|
|
|
|
//guozhi 橙汁
|
|
let chengzhi = this.mapNode.getChildByName('橙汁');
|
|
let touchArea2 = this.mapNode.getChildByName('台灯');
|
|
let jinqiuPro = this.mapNode.getChildByName('台金球');
|
|
let jinqiuAttrs ={
|
|
startPos:chengzhi.getPosition(),
|
|
touchArea:touchArea2,
|
|
callFunction: ()=>{
|
|
touchArea2.active = false
|
|
jinqiuPro.active = true
|
|
this.gameInfo.ChaNode["JingQiu"].isCanTouch = true
|
|
},
|
|
}
|
|
this.openTouchEvent(chengzhi,jinqiuAttrs)
|
|
//fangbne 房屋模型
|
|
let fangbne = this.mapNode.getChildByName('房屋模型');
|
|
let touchArea3 = this.mapNode.getChildByName('红色笔记本');
|
|
let fangchang = this.mapNode.getChildByName('房产证');
|
|
let fangbenAttrs = {
|
|
startPos:fangbne.getPosition(),
|
|
touchArea:touchArea3,
|
|
callFunction: ()=>{
|
|
touchArea3.active = false
|
|
fangchang.active = true
|
|
this.gameInfo.ChaNode["FangBen"].isCanTouch = true
|
|
},
|
|
}
|
|
this.openTouchEvent(fangbne,fangbenAttrs)
|
|
|
|
//chuizi
|
|
let chuizi = this.mapNode.getChildByName('锤子');
|
|
let liefengArea = this.mapNode.getChildByName('liefengArea')
|
|
let taidengArea = this.mapNode.getChildByName('taidengArea')
|
|
let dengqianSpine = this.mapNode.getChildByName('dengqianSpine')
|
|
let gudongSpine = this.mapNode.getChildByName('gudongSpine')
|
|
let cuiziSpine = this.mapNode.getChildByName('cuiziSpine')
|
|
|
|
let chuiziAttrs = {
|
|
startPos:chuizi.getPosition(),
|
|
touchArea1:taidengArea,
|
|
touchArea2:liefengArea,
|
|
touchArea3:liefengArea,
|
|
touchArea4:liefengArea,
|
|
callFunction1: ()=>{
|
|
this.gameInfo.ChaNode["Money"].isCanTouch = true
|
|
|
|
},
|
|
callFunction2: ()=>{
|
|
gudongSpine.getComponent(sp.Skeleton).setAnimation(0,"2gudong1",false)
|
|
this.gameInfo.ChaNode["NiWawa"].isCanTouch = true
|
|
},
|
|
callFunction3: ()=>{
|
|
gudongSpine.getComponent(sp.Skeleton).setAnimation(0,"3gudong2",false)
|
|
this.gameInfo.ChaNode["GudongBaobei"].isCanTouch = true
|
|
this.gameInfo.ChaNode["NiWawa"].isCanTouch = false
|
|
},
|
|
callFunction4: ()=>{
|
|
gudongSpine.getComponent(sp.Skeleton).setAnimation(0,"3gudong3",false)
|
|
this.gameInfo.ChaNode["KatongWanju"].isCanTouch = true
|
|
this.gameInfo.ChaNode["GudongBaobei"].isCanTouch = false
|
|
this.gameInfo.ChaNode["NiWawa"].isCanTouch = false
|
|
},
|
|
}
|
|
this.openTouchEvent(chuizi,chuiziAttrs)
|
|
|
|
|
|
}
|
|
|
|
firstInit1304Game(){
|
|
|
|
this.node["qiPaoEffect"] = (node,soundUrl)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl)
|
|
node.active = true
|
|
node.scale = 0
|
|
node.getChildByName("str").getComponent(cc.Label).string = soundUrl
|
|
cc.tween(node)
|
|
.to(0.2,{scale:1})
|
|
.delay(3.0)
|
|
.to(0.2,{scale:0})
|
|
.call(()=>{
|
|
node.active = false
|
|
})
|
|
.start()
|
|
}
|
|
|
|
this.node["dialogFunc"] = (qiPao1,soundUrl_1,qiPao2?:cc.Node,soundUrl_2?:string)=>{
|
|
this.node.stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoNv').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoZuo').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoluren').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaopeng').stopAllActions()
|
|
|
|
this.mapNode.getChildByName('qiPaoNv').active = false
|
|
this.mapNode.getChildByName('qiPaoZuo').active = false
|
|
this.mapNode.getChildByName('qiPaoluren').active = false
|
|
this.mapNode.getChildByName('qiPaopeng').active = false
|
|
|
|
if(qiPao2){
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao2,soundUrl_2)
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
}else{
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
})
|
|
.delay(1.8)
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
|
|
let chezhu1 = this.mapNode.getChildByName('车主1待机');
|
|
let nvluren = this.mapNode.getChildByName('女路人1');
|
|
let luren = this.mapNode.getChildByName('路人');
|
|
let chezhu2 = this.mapNode.getChildByName('chezhu2');
|
|
this.huxiEffect(chezhu1)
|
|
this.huxiEffect(nvluren)
|
|
this.huxiEffect(luren)
|
|
this.huxiEffect(chezhu2)
|
|
|
|
|
|
|
|
let fangdajing2 = this.mapNode.getChildByName('放大镜2');
|
|
let touchArea1 = this.mapNode.getChildByName('moneyArea');
|
|
let touchArea2 = this.mapNode.getChildByName('jingyaArea');
|
|
|
|
let fangdajingAttrs ={
|
|
startPos:fangdajing2.getPosition(),
|
|
touchArea1:touchArea1,
|
|
touchArea2:touchArea2,
|
|
|
|
callFunction1: ()=>{
|
|
//说话
|
|
|
|
},
|
|
|
|
callFunction2: ()=>{
|
|
|
|
},
|
|
|
|
}
|
|
this.openTouchEvent(fangdajing2,fangdajingAttrs)
|
|
|
|
|
|
}
|
|
|
|
|
|
firstInit1303Game(){
|
|
//Check1303Mima
|
|
let baoxiankai = this.mapNode.getChildByName('保险开');
|
|
EventMgr.onceEvent_custom(ryw_Event.Check1303Mima, (tab) => {
|
|
baoxiankai.active = true
|
|
this.gameInfo.ChaNode["Shouji"].isCanTouch = false
|
|
this.gameInfo.FeiChanDian["baoxianguiArea"].isCanTouch = false
|
|
this.gameInfo.ChaNode["BaoxianguiQian"].isCanTouch = true
|
|
this.gameInfo.FeiChanDian["shoujiArea"].isCanTouch = false
|
|
}, this);
|
|
|
|
this.node["qiPaoEffect"] = (node,soundUrl)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl)
|
|
node.active = true
|
|
node.scale = 0
|
|
node.getChildByName("str").getComponent(cc.Label).string = soundUrl
|
|
cc.tween(node)
|
|
.to(0.2,{scale:1})
|
|
.delay(3.0)
|
|
.to(0.2,{scale:0})
|
|
.call(()=>{
|
|
node.active = false
|
|
})
|
|
.start()
|
|
}
|
|
this.node["dialogFunc"] = (qiPao1,soundUrl_1)=>{
|
|
this.node.stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoZuo').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoYou').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoZuo').active = false
|
|
this.mapNode.getChildByName('qiPaoYou').active = false
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
if(soundUrl_1 == '网上就有配的,你要多少就有多少,您配吗' ){
|
|
if(!this.node['isplayFirst']){
|
|
this.node['isplayFirst'] = true
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
}
|
|
|
|
}else{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
}
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
}
|
|
|
|
//苍蝇拍
|
|
let laobanSpine = this.mapNode.getChildByName('laobanSpine');
|
|
let changyinpai = this.mapNode.getChildByName('changyinpai');
|
|
let laobanArea = this.mapNode.getChildByName('laobanArea');
|
|
let changyingAttrs ={
|
|
startPos:changyinpai.getPosition(),
|
|
touchArea1:laobanArea,
|
|
touchArea2:laobanArea,
|
|
touchArea3:laobanArea,
|
|
callFunction1: ()=>{
|
|
//说话
|
|
laobanSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
|
|
},
|
|
callFunction2: ()=>{
|
|
laobanSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},
|
|
callFunction3: ()=>{
|
|
laobanSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},
|
|
}
|
|
this.openTouchEvent(changyinpai,changyingAttrs)
|
|
//充电器
|
|
let chongdianqi = this.mapNode.getChildByName('充电器');
|
|
let shoujiArea = this.mapNode.getChildByName('shoujiArea1');
|
|
let shoujiSpine = this.mapNode.getChildByName('shoujiSpine');
|
|
let chongdianqiAttrs = {
|
|
startPos:chongdianqi.getPosition(),
|
|
touchArea:shoujiArea,
|
|
callFunction: ()=>{
|
|
chongdianqi.active = false
|
|
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"充电");
|
|
shoujiSpine.getComponent(sp.Skeleton).setAnimation(0,"2lv",true)
|
|
this.gameInfo.FeiChanDian["shoujiArea"].isCanTouch = true
|
|
this.gameInfo.ChaNode["Shouji"].isCanTouch = false
|
|
}
|
|
}
|
|
this.openTouchEvent(chongdianqi,chongdianqiAttrs)
|
|
}
|
|
|
|
|
|
firstInit1302Game(){
|
|
// let xujiangSpine = this.mapNode.getChildByName("xujiangSpine")
|
|
// xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"4xinxu",true)
|
|
this.node["qiPaoEffect"] = (node,soundUrl)=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl)
|
|
node.active = true
|
|
node.scale = 0
|
|
node.getChildByName("str").getComponent(cc.Label).string = soundUrl
|
|
cc.tween(node)
|
|
.to(0.2,{scale:1})
|
|
.delay(2.0)
|
|
.to(0.2,{scale:0})
|
|
.call(()=>{
|
|
node.active = false
|
|
})
|
|
.start()
|
|
}
|
|
|
|
this.node["dialogFunc"] = (qiPao1,qiPao2,soundUrl_1,soundUrl_2,nanPeople,nvPeople)=>{
|
|
this.node.stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoZuo').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoYou').stopAllActions()
|
|
this.mapNode.getChildByName('qiPaoZuo').active = false
|
|
this.mapNode.getChildByName('qiPaoYou').active = false
|
|
|
|
let xujiangSpine = this.mapNode.getChildByName("xujiangSpine")
|
|
let dasaoSpine = this.mapNode.getChildByName("dasaoSpine")
|
|
|
|
//console.log(nanPeople,nvPeople)
|
|
cc.tween(this.node)
|
|
.call(()=>{
|
|
this.node["qiPaoEffect"](qiPao1,soundUrl_1)
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl_1)
|
|
if(nvPeople== 'hot'){
|
|
dasaoSpine.getComponent(sp.Skeleton).setAnimation(0,"2han+shuohua",true)
|
|
}else if(nvPeople== 'veryhot'){
|
|
dasaoSpine.getComponent(sp.Skeleton).setAnimation(0,"3dahan+shuohua",true)
|
|
}else if(nvPeople== 'shengqi'){
|
|
dasaoSpine.getComponent(sp.Skeleton).setAnimation(0,"4shengqi",true)
|
|
}
|
|
})
|
|
.delay(1.8)
|
|
.call(()=>{
|
|
|
|
this.node["qiPaoEffect"](qiPao2,soundUrl_2)
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl + soundUrl_2)
|
|
if(nanPeople== 'hot'){
|
|
xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"2han+shuohua",true)
|
|
}else if(nanPeople== 'veryhot'){
|
|
xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"3dahan+shuohua",true)
|
|
}else if(nanPeople== 'haipa'){
|
|
xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"4xinxu",true)
|
|
}else if(nanPeople== 'zhengchang'){
|
|
xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji+shuohua",true)
|
|
}
|
|
|
|
})
|
|
.delay(2.8)
|
|
.call(()=>{
|
|
dasaoSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
})
|
|
.start()
|
|
}
|
|
|
|
|
|
let dasaoSpine = this.mapNode.getChildByName('dasaoSpine');
|
|
let chuangArea = this.mapNode.getChildByName('床完整');
|
|
let chuangPo = this.mapNode.getChildByName('床破损');
|
|
let dasaoAttrs = {
|
|
startPos:dasaoSpine.getPosition(),
|
|
touchArea:chuangArea,
|
|
callFunction: ()=>{
|
|
chuangArea.active = false
|
|
chuangPo.active = true
|
|
this.gameInfo.ChaNode["poChuang"].isCanTouch = true
|
|
dasaoSpine.setPosition(dasaoSpine['startPos'])
|
|
dasaoSpine.active = true
|
|
}
|
|
}
|
|
this.openTouchEvent(dasaoSpine,dasaoAttrs)
|
|
|
|
let guziguan = this.mapNode.getChildByName('柜子关');
|
|
let suohao = guziguan.getChildByName('锁完好');
|
|
let suowai = guziguan.getChildByName('锁外');
|
|
let posui = guziguan.getChildByName('锁破损');
|
|
let suoArea = this.mapNode.getChildByName('suoArea');
|
|
let hongbuNode = this.mapNode.getChildByName('红布');
|
|
let hongbuArea = this.mapNode.getChildByName('hongbuArea');
|
|
let matongArea = this.mapNode.getChildByName('matongArea');
|
|
let liefengArea = this.mapNode.getChildByName('liefengArea');
|
|
let matongSpine = this.mapNode.getChildByName('matongSpine');
|
|
let baoxianSpine = this.mapNode.getChildByName('baoxianSpine');
|
|
let hongbuAttrs = {
|
|
startPos:hongbuNode.getPosition(),
|
|
touchArea:hongbuArea,
|
|
callFunction: ()=>{
|
|
hongbuNode.active = false
|
|
this.gameInfo.ChaNode["zhuoZi"].isCanTouch = true
|
|
// 注册锤子
|
|
let chuziNode = this.mapNode.getChildByName('chuziNode');
|
|
let chuiziAttrs = {
|
|
startPos:chuziNode.getPosition(),
|
|
touchArea1:suoArea,
|
|
touchArea2:matongArea,
|
|
touchArea3:liefengArea,
|
|
touchArea4:liefengArea,
|
|
// 柜子锁
|
|
callFunction1: ()=>{
|
|
suohao.active = false
|
|
suowai.active = false
|
|
posui.active = true
|
|
this.gameInfo.FeiChanDian["guiziArea"].isCanTouch = true
|
|
},
|
|
// 马桶
|
|
callFunction2: ()=>{
|
|
|
|
matongSpine.getComponent(sp.Skeleton).setAnimation(0,"2poshun",false)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"马桶碎了");
|
|
matongSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
this.gameInfo.ChaNode["zaMaTong"].isCanTouch = true
|
|
})
|
|
},
|
|
|
|
// 裂缝
|
|
callFunction3: ()=>{
|
|
this.gameInfo.ChaNode["qiangBiLieFeng"].isCanTouch = false
|
|
baoxianSpine.getComponent(sp.Skeleton).setAnimation(0,"2liefen",false)
|
|
this.gameInfo.ChaNode["chuiziChuiQiang1"].isCanTouch = true
|
|
},
|
|
|
|
callFunction4: ()=>{
|
|
// 宝箱可以触摸
|
|
this.gameInfo.ChaNode["chuiziChuiQiang1"].isCanTouch = false
|
|
baoxianSpine.getComponent(sp.Skeleton).setAnimation(0,"3baoxiangui",false)
|
|
this.gameInfo.FeiChanDian["baoxianguiArea"].isCanTouch = true
|
|
}
|
|
}
|
|
this.openTouchEvent(chuziNode,chuiziAttrs)
|
|
|
|
}
|
|
}
|
|
this.openTouchEvent(hongbuNode,hongbuAttrs)
|
|
|
|
|
|
|
|
}
|
|
|
|
firstInit1301Game(){
|
|
let qicheNode = this.mapNode.getChildByName('qicheNode');
|
|
let qianBoli = qicheNode.getChildByName('qianBoli');
|
|
let qianBoli2 = qicheNode.getChildByName('qianBoli2');
|
|
let zuoyiPodong = qicheNode.getChildByName('zuoyiPodong');
|
|
let chedengSui = qicheNode.getChildByName('chedengSui');
|
|
let chekaideng = qicheNode.getChildByName('chekaideng');
|
|
let huaheng = qicheNode.getChildByName('huaheng');
|
|
let huahengSpine = qicheNode.getChildByName('huahengSpine');
|
|
let cheqianGai = qicheNode.getChildByName('cheqianGai');
|
|
let yingqingai = cheqianGai.getChildByName('yingqingai');
|
|
let luntaiPo = qicheNode.getChildByName('luntaiPo');
|
|
let baotaiSpine = this.mapNode.getChildByName('baotaiSpine');
|
|
let zhuanPanNode = this.mapNode.getChildByName('zhuanPanNode');
|
|
let yaogang = this.mapNode.getChildByName('yaogang');
|
|
let yaogang2 = this.mapNode.getChildByName('yaogang2');
|
|
|
|
let qianggePeo = this.mapNode.getChildByName('qianggePeo');
|
|
let diaopiNode = qianggePeo.getChildByName('貂皮');
|
|
let xiaoshudian = this.mapNode.getChildByName('xiaoshudian');
|
|
let qicheTouchArea = this.mapNode.getChildByName('qicheTouchArea');
|
|
let suiboliArea = this.mapNode.getChildByName('suiboliArea');
|
|
let houzuoArea = this.mapNode.getChildByName('houzuoArea');
|
|
|
|
let cheyaoshi1 = this.mapNode.getChildByName('cheyaoshi1');
|
|
//小数点
|
|
let jiangJiaArea = this.mapNode.getChildByName('jiangJiaArea');
|
|
let jiangjiaAttrs = {
|
|
startPos:xiaoshudian.getPosition(),
|
|
touchArea:jiangJiaArea,
|
|
callFunction: ()=>{
|
|
xiaoshudian.active = false
|
|
let xiaoshudian2 = jiangJiaArea.getChildByName('xiaoshudian');
|
|
xiaoshudian2.active = true
|
|
this.gameInfo.ChaNode["jiangJiaPai"].isCanTouch = true
|
|
}
|
|
}
|
|
this.openTouchEvent(xiaoshudian,jiangjiaAttrs)
|
|
//遥杆
|
|
let yaoGangAttrs = {
|
|
startPos:yaogang.getPosition(),
|
|
touchArea:qicheTouchArea,
|
|
callFunction: ()=>{
|
|
//cheqianGai.active = false
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"汽车启动");
|
|
cheyaoshi1.active = true
|
|
cheyaoshi1.getComponent(sp.Skeleton).setAnimation(0,"2zhuan",false)
|
|
let rotateNum = 8
|
|
let rotateNum2 = -8
|
|
this.scheduleOnce(()=>{
|
|
cheyaoshi1.active = false
|
|
cc.tween(qicheNode)
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:0})
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"飞出");
|
|
//yaogang2.active = true
|
|
yingqingai.getComponent(sp.Skeleton).setAnimation(0,"2zha",false)
|
|
yingqingai.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
this.gameInfo.ChaNode["dianDongMaDa"].isCanTouch = true
|
|
})
|
|
})
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
chedengSui.active = true
|
|
chekaideng.active = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"灯罩破碎");
|
|
this.gameInfo.ChaNode["cheDengPoSui"].isCanTouch = true
|
|
})
|
|
.start()
|
|
},3.5)
|
|
}
|
|
}
|
|
this.openTouchEvent(yaogang,yaoGangAttrs)
|
|
|
|
|
|
let yaogang2Attrs = {
|
|
startPos:yaogang2.getPosition(),
|
|
touchArea:qicheTouchArea,
|
|
callFunction: ()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"汽车启动");
|
|
cheyaoshi1.active = true
|
|
cheyaoshi1.getComponent(sp.Skeleton).setAnimation(0,"2zhuan",false)
|
|
let rotateNum = 8
|
|
let rotateNum2 = -8
|
|
this.scheduleOnce(()=>{
|
|
cheyaoshi1.active = false
|
|
cc.tween(qicheNode)
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:0})
|
|
.call(()=>{
|
|
chedengSui.active = true
|
|
chekaideng.active = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"灯罩破碎");
|
|
this.gameInfo.ChaNode["cheDengPoSui"].isCanTouch = true
|
|
})
|
|
.start()
|
|
},3.5)
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(yaogang2,yaogang2Attrs)
|
|
|
|
|
|
//车玻璃碎
|
|
let qianBoliAttrs = {
|
|
startPos:qianBoli.getPosition(),
|
|
touchArea:suiboliArea,
|
|
callFunction: ()=>{
|
|
qianBoli.active = false
|
|
this.gameInfo.ChaNode["suiBoli"].isCanTouch = true
|
|
},
|
|
}
|
|
this.openTouchEvent(qianBoli,qianBoliAttrs)
|
|
|
|
//椅子破
|
|
let yiziAttrs = {
|
|
startPos:qianBoli2.getPosition(),
|
|
touchArea:suiboliArea,
|
|
callFunction: ()=>{
|
|
qianBoli2.active = false
|
|
this.gameInfo.ChaNode["zuoYiPoDong"].isCanTouch = true
|
|
},
|
|
|
|
}
|
|
this.openTouchEvent(qianBoli2,yiziAttrs)
|
|
|
|
//强哥
|
|
let qianggeAttrs = {
|
|
startPos:qianggePeo.getPosition(),
|
|
touchArea:houzuoArea,
|
|
callFunction: ()=>{
|
|
baotaiSpine.active = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"泄气");
|
|
baotaiSpine.getComponent(sp.Skeleton).setAnimation(0,"baotai",false)
|
|
baotaiSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
luntaiPo.active = true
|
|
qianggePeo.setPosition(qianggePeo['startPos'])
|
|
qianggePeo.active = true
|
|
this.gameInfo.ChaNode["baoTai"].isCanTouch = true
|
|
})
|
|
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(qianggePeo,qianggeAttrs)
|
|
|
|
// 貂皮
|
|
let diaopiAttrs = {
|
|
startPos:diaopiNode.getPosition(),
|
|
touchArea:huaheng,
|
|
callFunction: ()=>{
|
|
//huaheng.active = true
|
|
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"擦拭油漆");
|
|
huahengSpine.getComponent(sp.Skeleton).setAnimation(0,"2ca",false)
|
|
huahengSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
this.gameInfo.ChaNode["huaHeng"].isCanTouch = true
|
|
})
|
|
|
|
},
|
|
}
|
|
this.openTouchEvent(diaopiNode,diaopiAttrs)
|
|
|
|
}
|
|
|
|
//特殊关卡处理
|
|
handSpecialGameLogic(pos){
|
|
//非茬点触碰逻辑
|
|
if(!this.mapNode.getChildByName("feiChaDianNode")){
|
|
return
|
|
}
|
|
if(this.gameId == 1201){
|
|
this.specialMap1201(pos)
|
|
}else if(this.gameId == 1202){
|
|
this.specialMap1202(pos)
|
|
}else if(this.gameId == 1203){
|
|
this.specialMap1203(pos)
|
|
}else if(this.gameId == 1301){
|
|
this.specialMap1301(pos)
|
|
}else if(this.gameId == 1302){
|
|
this.specialMap1302(pos)
|
|
}else if(this.gameId == 1303){
|
|
this.specialMap1303(pos)
|
|
}else if(this.gameId == 1304){
|
|
this.specialMap1304(pos)
|
|
}else if(this.gameId == 1305){
|
|
this.specialMap1305(pos)
|
|
}else if(this.gameId == 1306){
|
|
this.specialMap1306(pos)
|
|
}else if(this.gameId == 1307){
|
|
this.specialMap1307(pos)
|
|
}else if(this.gameId == 1308){
|
|
this.specialMap1308(pos)
|
|
}
|
|
}
|
|
openTouchEvent(node,attrs){
|
|
node.attr(attrs)
|
|
this.openTouchEvent1(node)
|
|
}
|
|
openTouchEvent1(node){
|
|
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)
|
|
}
|
|
touchStartSpecicalNode(event){
|
|
Common5.playEffect("click")
|
|
this.startPosi = event.getLocation()
|
|
if(this.gameId == 1301){
|
|
let zhuanPanNode = this.mapNode.getChildByName('zhuanPanNode');
|
|
if(zhuanPanNode.active){
|
|
return
|
|
}
|
|
|
|
if(event.target.name == "貂皮"){
|
|
event.target.opacity = 255
|
|
}
|
|
}else if(this.gameId == 1304){
|
|
if(event.target.name == "放大镜2"){
|
|
event.target.opacity = 255
|
|
}
|
|
}else if(this.gameId == 1308){
|
|
if(event.target.name == "sizhi" || event.target.name == "游乐园门票" || event.target.name == "kechenbiao" || event.target.name == "招生广告放大" || event.target.name == "手机放大"){
|
|
return
|
|
}
|
|
}
|
|
|
|
event.target.zIndex = this.curZIndex++;
|
|
}
|
|
touchMoveSpecicalNode(event){
|
|
if(this.gameId == 1301){
|
|
let zhuanPanNode = this.mapNode.getChildByName('zhuanPanNode');
|
|
if(zhuanPanNode.active){
|
|
return
|
|
}
|
|
}else if(this.gameId == 1304){
|
|
if(event.target.name == "放大镜2"){
|
|
let node = event.target.getChildByName('node')
|
|
if(Common5.checkContainsNode(event.target.touchArea1,node) && !event.target.isArea1Finish){
|
|
//event.target.active = false
|
|
event.target.isArea1Finish = true
|
|
event.target.setPosition(event.target.startPos)
|
|
|
|
event.target.callFunction2()
|
|
let xianjin = this.mapNode.getChildByName('装满现金')
|
|
|
|
cc.tween(xianjin)
|
|
.to(0.1, {scale:3})
|
|
.delay(1.0)
|
|
.to(0.1, {scale:1.0})
|
|
.start()
|
|
|
|
xianjin.active = true
|
|
this.gameInfo.ChaNode["Money"].isCanTouch = true
|
|
}else if(Common5.checkContainsNode(event.target.touchArea2,node) && !event.target.isArea2Finish && this.gameInfo.ChaNode["Shouji"].isCanTouch){
|
|
event.target.isArea2Finish = true
|
|
event.target.setPosition(event.target.startPos)
|
|
|
|
event.target.callFunction1()
|
|
let jingya = this.mapNode.getChildByName('金牙')
|
|
jingya.active = true
|
|
|
|
cc.tween(jingya)
|
|
.to(0.1, {scale:3})
|
|
.delay(1.0)
|
|
.to(0.1, {scale:1.0})
|
|
.start()
|
|
this.gameInfo.ChaNode["DaJingYa"].isCanTouch = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}else if(this.gameId == 1307){
|
|
if(event.target.name == "苍蝇拍"){
|
|
let callFunc = (callFu, fangxiang)=>{
|
|
|
|
let state1 = null
|
|
let state2 = null
|
|
let state3 = null
|
|
|
|
if(this.gameInfo.ChaNode['yiFu'].isCanTouch){
|
|
state1 = '4da1'
|
|
state2 = '4da2'
|
|
state3 = '3daiji'
|
|
}else{
|
|
state1 = '2da1'
|
|
state2 = '2da2'
|
|
state3 = '1daiji'
|
|
}
|
|
// 打树
|
|
let laobanSpine = this.mapNode.getChildByName('laoban')
|
|
if(fangxiang == 'left'){
|
|
laobanSpine.getComponent(sp.Skeleton).setAnimation(0,state2,false)
|
|
}else{
|
|
laobanSpine.getComponent(sp.Skeleton).setAnimation(0,state1,false)
|
|
}
|
|
|
|
this.scheduleOnce(()=>{
|
|
event.target['isFinish'] = false
|
|
laobanSpine.getComponent(sp.Skeleton).setAnimation(0,state3,true)
|
|
callFu()
|
|
},0.5)
|
|
}
|
|
if(Common5.checkIntersectsBox(event.target.touchArea2,event.target) && !event.target['isFinish']){
|
|
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"抽打");
|
|
event.target['isFinish'] = true
|
|
callFunc(event.target.callFunction2, 'right')
|
|
return
|
|
}else if(Common5.checkIntersectsBox(event.target.touchArea3,event.target) && !event.target['isFinish']){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"抽打");
|
|
event.target['isFinish'] = true
|
|
callFunc(event.target.callFunction3, 'left')
|
|
return
|
|
}
|
|
}else if(event.target.name == "假表界面" || event.target.name == "租车合同" || event.target.name == "借钱界面"){
|
|
return
|
|
}
|
|
}else if(this.gameId == 1308){
|
|
if(event.target.name == "sizhi" || event.target.name == "游乐园门票" || event.target.name == "kechenbiao" || event.target.name == "招生广告放大" || event.target.name == "手机放大"){
|
|
return
|
|
}
|
|
}
|
|
|
|
let nodeLoc = event.getLocation()
|
|
let nodePos = event.target.parent.convertToNodeSpaceAR(nodeLoc)
|
|
event.target.setPosition(nodePos)
|
|
|
|
|
|
}
|
|
touchEndSpecicalNode(event){
|
|
event.target.zIndex = 0
|
|
if(this.gameId == 1201){
|
|
if(event.target.bindNode){
|
|
if(event.target.bindNode["bSwitch"]){
|
|
|
|
}else{
|
|
if(event.target.name != "dongWuShiJie"){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"我这收不到啊");
|
|
}
|
|
event.target.setPosition(event.target.startPos)
|
|
return
|
|
}
|
|
}
|
|
|
|
if(event.target.name == "yan" || event.target.name == "fangChanZheng" || event.target.name == "kaFei"){
|
|
event.target.setPosition(event.target.startPos)
|
|
event.target.callFunction && event.target.callFunction()
|
|
return
|
|
}
|
|
}else if(this.gameId == 1202){
|
|
if(event.target.name == "chuiZi"){
|
|
let callFunc = (callFu)=>{
|
|
this.closeTouchEvent(event.target)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤子砸东西音效(0)");
|
|
let chuiziSpine = event.target.getChildByName("chuiziSpine")
|
|
chuiziSpine.getComponent(sp.Skeleton).setAnimation(0,"chuizi",false)
|
|
chuiziSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
chuiziSpine.getComponent(sp.Skeleton).clearTracks();
|
|
chuiziSpine.getComponent(sp.Skeleton).setToSetupPose();
|
|
event.target.setPosition(event.target.startPos)
|
|
this.openTouchEvent1(event.target)
|
|
callFu()
|
|
})
|
|
}
|
|
if(Common5.checkContainsNode(event.target.touchArea1,event.target) && !event.target.isArea1Finish){
|
|
event.target.isArea1Finish = true
|
|
callFunc(event.target.callFunction1)
|
|
return
|
|
}else if(Common5.checkContainsNode(event.target.touchArea2,event.target) && !event.target.isArea2Finish){
|
|
event.target.isArea2Finish = true
|
|
callFunc(event.target.callFunction2)
|
|
return
|
|
}
|
|
}else if(event.target.name == "hanBao"){
|
|
if(event.target.touchArea.active && Common5.checkContainsNode(event.target.touchArea,event.target)){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
return
|
|
}
|
|
}else if(this.gameId == 1203){
|
|
|
|
}else if(this.gameId == 1301){
|
|
//console.log('touchEndSpecicalNode++++++++')
|
|
if(event.target.name == "qianBoli2"){
|
|
if(event.target.touchArea.active && !Common5.checkIntersectsBox(event.target.touchArea,event.target)){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
return
|
|
}else if(event.target.name == "qianBoli"){
|
|
if(event.target.touchArea.active && !Common5.checkIntersectsBox(event.target.touchArea,event.target)){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
return
|
|
}else if(event.target.name == "貂皮"){
|
|
event.target.opacity = 0
|
|
}
|
|
}else if(this.gameId == 1302){
|
|
if(event.target.name == "红布"){
|
|
if(event.target.touchArea.active && !Common5.checkIntersectsBox(event.target.touchArea,event.target)){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
return
|
|
}else if(event.target.name == "chuziNode"){
|
|
let callFunc = (callFu, spineName)=>{
|
|
this.closeTouchEvent(event.target)
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤子砸东西音效(0)");
|
|
|
|
let chuiziSpine = this.mapNode.getChildByName(spineName);
|
|
chuiziSpine.getComponent(sp.Skeleton).setAnimation(0,"qiao2",false)
|
|
if(spineName =='chuziSpine3'){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤墙");
|
|
}
|
|
this.scheduleOnce(()=>{
|
|
event.target.active = true
|
|
event.target.setPosition(event.target.startPos)
|
|
this.openTouchEvent1(event.target)
|
|
callFu()
|
|
},1.5)
|
|
}
|
|
|
|
if(Common5.checkContainsNode(event.target.touchArea1,event.target) && !event.target.isArea1Finish){
|
|
event.target.active = false
|
|
event.target.isArea1Finish = true
|
|
callFunc(event.target.callFunction1,'chuziSpine1')
|
|
return
|
|
}else if(Common5.checkContainsNode(event.target.touchArea2,event.target) && !event.target.isArea2Finish){
|
|
event.target.isArea2Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction2,'chuziSpine2')
|
|
return
|
|
}else if(Common5.checkContainsNode(event.target.touchArea3,event.target) && !event.target.isArea3Finish){
|
|
event.target.isArea3Finish = true
|
|
event.target.active = false
|
|
|
|
callFunc(event.target.callFunction3,'chuziSpine3')
|
|
return
|
|
}else if(Common5.checkContainsNode(event.target.touchArea4,event.target) && !event.target.isArea4Finish){
|
|
event.target.isArea4Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction4,'chuziSpine3')
|
|
return
|
|
}
|
|
|
|
}
|
|
}else if(this.gameId == 1303){
|
|
if(event.target.name == "changyinpai"){
|
|
//callFunction2
|
|
let callFunc = (callFu, spineName,yuyinCall)=>{
|
|
this.closeTouchEvent(event.target)
|
|
let changyinpaiSpine = this.mapNode.getChildByName('changyinpaiSpine2');
|
|
changyinpaiSpine.active = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"苍蝇拍");
|
|
changyinpaiSpine.getComponent(sp.Skeleton).setAnimation(0,"pai",false)
|
|
|
|
this.scheduleOnce(()=>{
|
|
let laobanSpine = this.mapNode.getChildByName(spineName);
|
|
laobanSpine.getComponent(sp.Skeleton).setAnimation(0,"2motou",false)
|
|
yuyinCall()
|
|
this.scheduleOnce(()=>{
|
|
event.target.active = true
|
|
event.target.setPosition(event.target.startPos)
|
|
this.openTouchEvent1(event.target)
|
|
callFu()
|
|
},2.0)
|
|
},0.8)
|
|
}
|
|
|
|
if(Common5.checkContainsNode(event.target.touchArea1,event.target) && !event.target.isArea1Finish){
|
|
event.target.active = false
|
|
event.target.isArea1Finish = true
|
|
|
|
//
|
|
|
|
callFunc(event.target.callFunction1,'laobanSpine',()=>{
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoZuo'),"哎哟,别打了,就算打死我也没钱给你呀")
|
|
})
|
|
return
|
|
}else if(Common5.checkContainsNode(event.target.touchArea2,event.target) && !event.target.isArea2Finish){
|
|
|
|
event.target.isArea2Finish = true
|
|
event.target.active = false
|
|
//
|
|
callFunc(event.target.callFunction2,'laobanSpine',()=>{
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoZuo'),"啊,我真没钱,看上什么你拿走就是了")
|
|
})
|
|
return
|
|
}else if(Common5.checkContainsNode(event.target.touchArea3,event.target) && !event.target.isArea3Finish){
|
|
event.target.isArea3Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction3,'laobanSpine',()=>{
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoZuo'),"啊~~我错了,我不该拖欠工资,但是我真的没钱了")
|
|
})
|
|
return
|
|
}
|
|
}else if(event.target.name == "充电器"){
|
|
|
|
if(event.target.touchArea && Common5.checkContainsNode(event.target.touchArea,event.target) && !this.gameInfo.ChaNode["Shouji"].isFindOut){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.endNode && (event.target.endNode.active = true)
|
|
event.target.bindChaNodeInfo && (event.target.bindChaNodeInfo.isCanTouch = true)
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
return
|
|
}
|
|
}else if(this.gameId == 1304){
|
|
if(event.target.name == "放大镜2"){
|
|
event.target.opacity = 0
|
|
}
|
|
event.target.setPosition(event.target.startPos)
|
|
return
|
|
}else if(this.gameId == 1305){
|
|
if(event.target.name == "锤子"){
|
|
let callFunc = (callFu, spineName)=>{
|
|
this.closeTouchEvent(event.target)
|
|
let spine_ = this.mapNode.getChildByName(spineName)
|
|
if(spineName == 'cuiziSpine'){
|
|
spine_.active = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤子");
|
|
spine_.getComponent(sp.Skeleton).setAnimation(0,"qiao2",false)
|
|
this.scheduleOnce(()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤墙");
|
|
spine_.active = false
|
|
event.target.active = true
|
|
event.target.setPosition(event.target.startPos)
|
|
this.openTouchEvent1(event.target)
|
|
callFu()
|
|
this.yaohuangAnim(this.mapNode)
|
|
},1)
|
|
}else{
|
|
|
|
let spine_2 = this.mapNode.getChildByName("cuiziSpine2")
|
|
spine_2.active = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤子");
|
|
spine_2.getComponent(sp.Skeleton).setAnimation(0,"qiao2",false)
|
|
this.scheduleOnce(()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"灯泡破");
|
|
spine_2.active = false
|
|
spine_.getComponent(sp.Skeleton).setAnimation(0,"2luo+qian",false)
|
|
spine_.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
this.gameInfo.ChaNode["Money"].isCanTouch = true
|
|
event.target.active = true
|
|
event.target.setPosition(event.target.startPos)
|
|
this.openTouchEvent1(event.target)
|
|
callFu()
|
|
})
|
|
},1)
|
|
|
|
}
|
|
}
|
|
|
|
if(Common5.checkIntersectsBox(event.target.touchArea1,event.target) && !event.target.isArea1Finish ){
|
|
event.target.isArea1Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction1,"dengqianSpine")
|
|
return
|
|
}else if(Common5.checkIntersectsBox(event.target.touchArea2,event.target) && !event.target.isArea2Finish && !event.target['isFindGudong']){
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤墙");
|
|
event.target.isArea2Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction2,"cuiziSpine")
|
|
|
|
|
|
return
|
|
}else if(Common5.checkIntersectsBox(event.target.touchArea3,event.target) && !event.target.isArea3Finish && !event.target['isFindGudong']){
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤墙");
|
|
event.target.isArea3Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction3,"cuiziSpine")
|
|
|
|
return
|
|
}else if(Common5.checkIntersectsBox(event.target.touchArea4,event.target) && !event.target.isArea4Finish && !event.target['isFindGudong']){
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"锤墙");
|
|
event.target.isArea4Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction4,"cuiziSpine")
|
|
|
|
return
|
|
}
|
|
}else if(event.target.name == "房屋模型"){
|
|
if(Common5.checkIntersectsBox(event.target.touchArea,event.target) && this.gameInfo.FeiChanDian['choutiArea'].isTouchOff){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.endNode && (event.target.endNode.active = true)
|
|
event.target.bindChaNodeInfo && (event.target.bindChaNodeInfo.isCanTouch = true)
|
|
event.target.callFunction && event.target.callFunction()
|
|
return
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
return
|
|
}
|
|
|
|
}
|
|
|
|
}else if(this.gameId == 1307){
|
|
|
|
if(event.target.name == "黑桃A"){
|
|
if(event.target.touchArea.active && !Common5.checkIntersectsBox(event.target.touchArea,event.target)){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
return
|
|
}else if(event.target.name == "tieNode"){
|
|
if(event.target.touchArea.active && Common5.checkIntersectsBox(event.target.touchArea,event.target)){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.setPosition(event.target.startPos)
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
return
|
|
|
|
}else if(event.target.name == "扫码界面"){
|
|
if(event.target.touchArea.active && Common5.checkContainsNode(event.target.touchArea,event.target)){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"扫码");
|
|
this.closeTouchEvent(event.target)
|
|
event.target.touchArea.active = false
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
|
|
}
|
|
return
|
|
}
|
|
|
|
else if(event.target.name == "苍蝇拍"){
|
|
let callFunc = (callFu, name)=>{
|
|
this.closeTouchEvent(event.target)
|
|
if(name == 'juzishu'){
|
|
// 打树
|
|
let juzishuNode = this.mapNode.getChildByName('橘子树')
|
|
let juziNode = juzishuNode.getChildByName('桔子')
|
|
let paidaSpine = this.mapNode.getChildByName('paidaSpine')
|
|
paidaSpine.active = true
|
|
paidaSpine.getComponent(sp.Skeleton).setAnimation(0,'pai',false)
|
|
paidaSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
paidaSpine.active = false
|
|
juziNode.getComponent(cc.Animation).play('juziAnim')
|
|
juziNode.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
this.gameInfo.ChaNode['jinPenzai'].isCanTouch = true
|
|
this.openTouchEvent1(event.target)
|
|
callFu()
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
}
|
|
|
|
if(Common5.checkIntersectsBox(event.target.touchArea1,event.target) && !event.target.isArea1Finish ){
|
|
event.target.isArea1Finish = true
|
|
event.target.active = false
|
|
callFunc(event.target.callFunction1,"juzishu")
|
|
return
|
|
}
|
|
}else if(event.target.name == "租车合同"){
|
|
event.target.active = false
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('haocheHeTong')
|
|
this.findOnChaDian(chaNode)
|
|
this.closeTouchEvent(event.target)
|
|
return
|
|
}else if(event.target.name == "假表界面" ){
|
|
event.target.active = false
|
|
this.closeTouchEvent(event.target)
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('daJinBiao')
|
|
this.findOnChaDian(chaNode)
|
|
return
|
|
}else if(event.target.name == "借钱界面"){
|
|
event.target.active = false
|
|
this.closeTouchEvent(event.target)
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('boluoShouji')
|
|
this.findOnChaDian(chaNode)
|
|
return
|
|
}
|
|
|
|
|
|
}else if(this.gameId == 1308){
|
|
|
|
// if(event.target.name == "sizhi" || event.target.name == "游乐园门票" || event.target.name == "kechenbiao" || event.target.name == "招生广告放大" || event.target.name == "手机放大"){
|
|
// return
|
|
// }
|
|
|
|
if(event.target.name == "sizhi"){
|
|
let nodeLoc = event.getLocation()
|
|
console.log(this.startPosi.y , 'startPosi')
|
|
console.log( nodeLoc.y, 'nodeLoc')
|
|
|
|
console.log(this.startPosi.y - nodeLoc.y, '')
|
|
if(nodeLoc.y<this.startPosi.y && (this.startPosi.y - nodeLoc.y>=200)){
|
|
//shizhi
|
|
this.closeTouchEvent(event.target)
|
|
event.target.callFunction && event.target.callFunction()
|
|
|
|
}
|
|
return
|
|
}else if(event.target.name == "游乐园门票"){
|
|
event.target.active = false
|
|
this.closeTouchEvent(event.target)
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('youlechangMenpiao')
|
|
this.findOnChaDian(chaNode)
|
|
this.gameInfo.FeiChanDian['shoujiArea'].isCanTouch = true
|
|
return
|
|
}else if(event.target.name == "kechenbiao"){
|
|
event.target.active = false
|
|
|
|
let sizhi = this.mapNode.getChildByName('sizhi')
|
|
sizhi.active = false
|
|
|
|
let xuexiJihua = this.mapNode.getChildByName('学习计划')
|
|
let laji = this.mapNode.getChildByName('垃圾桶装满碎纸')
|
|
if(xuexiJihua.active == false && !xuexiJihua['istouch']){
|
|
xuexiJihua['istouch'] = true
|
|
laji.active = true
|
|
sizhi.stopAllActions()
|
|
this.gameInfo.FeiChanDian["jihuaBiaoArea"].isCanTouch = false
|
|
this.scheduleOnce(()=>{
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('xuexiJihuaBiao')
|
|
this.findOnChaDian(chaNode)
|
|
},0.5)
|
|
}
|
|
return
|
|
}else if(event.target.name == "招生广告放大"){
|
|
event.target.active = false
|
|
return
|
|
}else if(event.target.name == "手机放大"){
|
|
event.target.active = false
|
|
this.closeTouchEvent(event.target)
|
|
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('chumen')
|
|
this.findOnChaDian(chaNode)
|
|
|
|
let mama = this.mapNode.getChildByName('mama')
|
|
mama.getComponent(sp.Skeleton).setAnimation(0,'3zoukai',false)
|
|
mama.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
mama.active = false
|
|
|
|
})
|
|
return
|
|
}
|
|
}
|
|
|
|
if(event.target.touchArea && Common5.checkContainsNode(event.target.touchArea,event.target)){
|
|
this.closeTouchEvent(event.target)
|
|
event.target.active = false
|
|
event.target.endNode && (event.target.endNode.active = true)
|
|
event.target.bindChaNodeInfo && (event.target.bindChaNodeInfo.isCanTouch = true)
|
|
event.target.callFunction && event.target.callFunction()
|
|
}else{
|
|
event.target.setPosition(event.target.startPos)
|
|
}
|
|
}
|
|
|
|
findChaDianSpecialLogic(curNode,answerIcon){
|
|
if(this.gameId == 1201){
|
|
this.node["allMoney"] -= this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+"亿"
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+"亿"
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "-"+this.gameInfo.ChaNode[curNode.name].money + "亿";
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
}else if(this.gameId == 1202){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+this.gameInfo.ChaNode[curNode.name].sound);
|
|
this.node["allMoney"] -= this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "-"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let bindNodeName = this.gameInfo.ChaNode[curNode.name].bindNodeName
|
|
if(bindNodeName){
|
|
this.mapNode.getChildByName(bindNodeName).active = false
|
|
}
|
|
}else if(this.gameId == 1203){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+this.gameInfo.ChaNode[curNode.name].sound);
|
|
this.node["allMoney"] += this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = (this.gameInfo.ChaNode[curNode.name].money)
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "+"+ (this.node["allMoney"])
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let xiazhuSpine = this.mapNode.getChildByName("xiazhuSpine")
|
|
xiazhuSpine.getComponent(sp.Skeleton).setAnimation(0,"xiezi",false)
|
|
this.node.stopAllActions()
|
|
cc.tween(this.node)
|
|
.delay(1.5)
|
|
.call(()=>{
|
|
xiazhuSpine.getComponent(sp.Skeleton).setAnimation(0,"daiji",true)
|
|
})
|
|
.start()
|
|
}else if(this.gameId == 1301){
|
|
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+this.gameInfo.ChaNode[curNode.name].sound);
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]-this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ -= Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] -= this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "-"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
}else if(this.gameId == 1302){
|
|
this.findChadian1302(curNode,answerIcon)
|
|
}else if(this.gameId == 1303){
|
|
this.findChadian1303(curNode,answerIcon)
|
|
}else if(this.gameId == 1304){
|
|
this.findChadian1304(curNode,answerIcon)
|
|
}else if(this.gameId == 1305){
|
|
this.findChadian1305(curNode,answerIcon)
|
|
}else if(this.gameId == 1306){
|
|
this.findChadian1306(curNode,answerIcon)
|
|
}else if(this.gameId == 1307){
|
|
this.findChadian1307(curNode,answerIcon)
|
|
}else if(this.gameId == 1308){
|
|
this.findChadian1308(curNode,answerIcon)
|
|
}
|
|
}
|
|
|
|
findChadian1308(curNode,answerIcon){
|
|
if(this.gameInfo.ChaNode[curNode.name].sound1){
|
|
let delay = this.gameInfo.ChaNode[curNode.name].TextDelayTime
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNvRen'),this.gameInfo.ChaNode[curNode.name].sound1,delay)
|
|
}
|
|
if(this.gameInfo.ChaNode[curNode.name].sound2){
|
|
let delay = this.gameInfo.ChaNode[curNode.name].TextDelayTime
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNvRen2'),this.gameInfo.ChaNode[curNode.name].sound2,delay)
|
|
}
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]+this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ += Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] += this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
let progressBar = this.mapNode.getChildByName('progressBar').getComponent(cc.ProgressBar)
|
|
progressBar.progress =(this.node["allMoney"]+this.gameInfo.ChaNode[curNode.name].money)/100
|
|
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "+"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let bindNodeName = this.gameInfo.ChaNode[curNode.name].bindNodeName
|
|
if(bindNodeName){
|
|
this.mapNode.getChildByName(bindNodeName).active = false
|
|
}
|
|
|
|
|
|
if( progressBar.progress == 1){
|
|
this.scheduleOnce(()=>{
|
|
|
|
|
|
let shou = this.mapNode.getChildByName('女儿右手')
|
|
shou.active = false
|
|
let progressBar = this.mapNode.getChildByName('progressBar')
|
|
progressBar.active = false
|
|
let nver = this.mapNode.getChildByName('nver')
|
|
nver.zIndex = this.curZIndex
|
|
let zhuozi = this.mapNode.getChildByName('桌子')
|
|
zhuozi.zIndex = this.curZIndex+1
|
|
|
|
nver.getComponent(cc.Animation).play('paobuAnim')
|
|
nver.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
nver.active = false
|
|
|
|
let fangfenzhen = this.mapNode.getChildByName('fangfenzhen')
|
|
fangfenzhen.active = true
|
|
|
|
this.mapNode.setPosition(cc.v2(0,0))
|
|
cc.tween(this.mapNode)
|
|
.to(5, {scale:1.05, x:-600,y:-500})
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
})
|
|
|
|
let mama = this.mapNode.getChildByName('mama')
|
|
mama.zIndex = this.curZIndex+2
|
|
|
|
nver.getComponent(sp.Skeleton).setAnimation(0,'2paobu',true)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"游戏成功结尾");
|
|
|
|
},3)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
findChadian1307(curNode,answerIcon){
|
|
if(this.gameInfo.ChaNode[curNode.name].sound1){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNanRen'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
}
|
|
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]-this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ -= Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] -= this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "-"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let bindNodeName = this.gameInfo.ChaNode[curNode.name].bindNodeName
|
|
if(bindNodeName){
|
|
this.mapNode.getChildByName(bindNodeName).active = false
|
|
}
|
|
}
|
|
|
|
findChadian1306(curNode,answerIcon){
|
|
if(this.gameInfo.ChaNode[curNode.name].sound1 && this.gameInfo.ChaNode[curNode.name].sound2){
|
|
let desc = this.gameInfo.ChaNode[curNode.name].desc
|
|
if(desc == '纸盒子' || desc == '破洗衣机'|| desc == '空调'|| desc == '破自行车'|| desc == '木头门'|| desc == '信号锅'){
|
|
let nvrenSpine = this.mapNode.getChildByName('nvrenSpine')
|
|
nvrenSpine.getComponent(sp.Skeleton).setAnimation(0,"2shengqi",false)
|
|
this.scheduleOnce(()=>{
|
|
nvrenSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},3)
|
|
}
|
|
|
|
if(this.gameInfo.ChaNode[curNode.name].desc == '狗盆'){
|
|
let gouSpine = this.mapNode.getChildByName('gouSpine')
|
|
gouSpine.getComponent(sp.Skeleton).setAnimation(0,"2daiji",true)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"狗凶狠的叫");
|
|
this.scheduleOnce(()=>{
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNvRen'),this.gameInfo.ChaNode[curNode.name].sound2,this.mapNode.getChildByName('qiPaoNanRen'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
},1)
|
|
|
|
this.scheduleOnce(()=>{
|
|
//加钱
|
|
gouSpine.getComponent(sp.Skeleton).setAnimation(0,"4ziya",true)
|
|
this.node["allMoney"] -= 10
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = 20
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "-10"
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
},2.5)
|
|
}else if(this.gameInfo.ChaNode[curNode.name].desc == '信号锅'){
|
|
this.scheduleOnce(()=>{
|
|
//加钱
|
|
this.node["allMoney"] -= 10
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = (this.node["allMoney"])
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = 30
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "-10"
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
},2.5)
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNvRen'),this.gameInfo.ChaNode[curNode.name].sound2,this.mapNode.getChildByName('qiPaoNanRen'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
}else{
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNvRen'),this.gameInfo.ChaNode[curNode.name].sound2,this.mapNode.getChildByName('qiPaoNanRen'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
}
|
|
|
|
}else{
|
|
let mujiSpine = this.mapNode.getChildByName('mujiSpine')
|
|
mujiSpine.getComponent(sp.Skeleton).setAnimation(0,"1jiwo",false)
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNanRen'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
}
|
|
|
|
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]-this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ -= Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] -= this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "-"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let bindNodeName = this.gameInfo.ChaNode[curNode.name].bindNodeName
|
|
if(bindNodeName){
|
|
this.mapNode.getChildByName(bindNodeName).active = false
|
|
}
|
|
|
|
}
|
|
|
|
findChadian1305(curNode,answerIcon){
|
|
//
|
|
if(this.gameInfo.ChaNode[curNode.name].desc == '玛尼'){
|
|
let dengqianSpine = this.mapNode.getChildByName('dengqianSpine')
|
|
dengqianSpine.getComponent(sp.Skeleton).setAnimation(0,"4daiji",false)
|
|
}else if(this.gameInfo.ChaNode[curNode.name].desc == '古董宝贝' || this.gameInfo.ChaNode[curNode.name].desc == '泥娃娃'|| this.gameInfo.ChaNode[curNode.name].desc == '卡通玩具'){
|
|
let gudongSpine = this.mapNode.getChildByName('gudongSpine')
|
|
gudongSpine.getComponent(sp.Skeleton).setAnimation(0,"4kongdong",false)
|
|
let chuziNode = this.mapNode.getChildByName('锤子')
|
|
chuziNode['isFindGudong'] = true
|
|
}
|
|
|
|
let qianggeSpine = this.mapNode.getChildByName('qianggeSpine')
|
|
let taishuSpine = this.mapNode.getChildByName('taishuSpine')
|
|
|
|
|
|
if(this.gameInfo.ChaNode[curNode.name].sound1 && this.gameInfo.ChaNode[curNode.name].sound2){
|
|
if(this.gameInfo.ChaNode[curNode.name].desc == '玛尼'){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoLao'),this.gameInfo.ChaNode[curNode.name].sound1,this.mapNode.getChildByName('qiPaoQiang'),this.gameInfo.ChaNode[curNode.name].sound2)
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"3daren",false)
|
|
|
|
this.scheduleOnce(()=>{
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"6haipa+ku",false)
|
|
|
|
this.scheduleOnce(()=>{
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},1.5)
|
|
|
|
},2.0)
|
|
}else{
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoQiang'),this.gameInfo.ChaNode[curNode.name].sound2, this.mapNode.getChildByName('qiPaoLao'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",false)
|
|
this.scheduleOnce(()=>{
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",false)
|
|
this.scheduleOnce(()=>{
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},1.5)
|
|
},1.5)
|
|
}
|
|
|
|
|
|
}else if(this.gameInfo.ChaNode[curNode.name].sound2){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoQiang'),this.gameInfo.ChaNode[curNode.name].sound2)
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",false)
|
|
this.scheduleOnce(()=>{
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},1.5)
|
|
}else if(this.gameInfo.ChaNode[curNode.name].sound1){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoLao'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
if(this.gameInfo.ChaNode[curNode.name].desc == '房子本本' || this.gameInfo.ChaNode[curNode.name].desc == '古董宝贝'){
|
|
|
|
}else{
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"3daren",false)
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"5haipa",false)
|
|
this.scheduleOnce(()=>{
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},2.0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]+this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ += Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] += this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "+"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let bindNodeName = this.gameInfo.ChaNode[curNode.name].bindNodeName
|
|
if(bindNodeName){
|
|
this.mapNode.getChildByName(bindNodeName).active = false
|
|
}
|
|
}
|
|
|
|
|
|
findChadian1304(curNode,answerIcon){
|
|
|
|
if(this.gameInfo.ChaNode[curNode.name].desc == '驴包包'){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNv'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
}else if(this.gameInfo.ChaNode[curNode.name].desc == '摩托'){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoluren'),this.gameInfo.ChaNode[curNode.name].sound2, this.mapNode.getChildByName('qiPaopeng'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
}else{
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaopeng'),this.gameInfo.ChaNode[curNode.name].sound1)
|
|
|
|
}
|
|
|
|
|
|
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]+this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ += Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] += this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "+"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let bindNodeName = this.gameInfo.ChaNode[curNode.name].bindNodeName
|
|
if(bindNodeName){
|
|
this.mapNode.getChildByName(bindNodeName).active = false
|
|
}
|
|
|
|
}
|
|
|
|
findChadian1302(curNode,answerIcon){
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+this.gameInfo.ChaNode[curNode.name].sound);
|
|
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoYou'),this.mapNode.getChildByName('qiPaoZuo'),this.gameInfo.ChaNode[curNode.name].sound1,this.gameInfo.ChaNode[curNode.name].sound2,this.gameInfo.ChaNode[curNode.name].nvPeople, this.gameInfo.ChaNode[curNode.name].nanPeople)
|
|
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]-this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ -= Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] -= this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
if(this.gameInfo.ChaNode[curNode.name].desc == '古董宝贝'){
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = "+50000000"
|
|
}else{
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
}
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
if(this.gameInfo.ChaNode[curNode.name].desc == '古董宝贝'){
|
|
toolTipnode.getComponent(cc.Label).string = "+50000000";
|
|
}else{
|
|
toolTipnode.getComponent(cc.Label).string = "-"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
}
|
|
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
}
|
|
|
|
|
|
|
|
findChadian1303(curNode,answerIcon){
|
|
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoZuo'),this.gameInfo.ChaNode[curNode.name].sound)
|
|
|
|
let index_ = 0
|
|
if( this.allMoneyNum_ == 0){
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}else{
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
let num = this.node.getChildByName("msg")['beifenNum']
|
|
this.node["allMoney"] = num
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.allMoneyNum_ = this.node["allMoney"]
|
|
}
|
|
this.node.getChildByName("msg")['beifenNum'] = this.node["allMoney"]+this.gameInfo.ChaNode[curNode.name].money
|
|
|
|
cc.tween(this.node.getChildByName("msg"))
|
|
.call(()=>{
|
|
this.allMoneyNum_ += Math.floor(this.gameInfo.ChaNode[curNode.name].money/20) ;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.allMoneyNum_ +""
|
|
index_++
|
|
if(index_==20){
|
|
this.node["allMoney"] += this.gameInfo.ChaNode[curNode.name].money;
|
|
this.node.getChildByName("msg").getChildByName("contentStr").getComponent(cc.Label).string = this.node["allMoney"]+""
|
|
this.node.getChildByName("msg").stopAllActions()
|
|
this.allMoneyNum_ = 0
|
|
}
|
|
})
|
|
.delay(0.02)
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
|
|
answerIcon.getChildByName("label").getComponent(cc.Label).string = this.gameInfo.ChaNode[curNode.name].money+""
|
|
let toolTipnode = cc.instantiate(this.node.getChildByName("msg").getChildByName("contentStr")) ;
|
|
toolTipnode.getComponent(cc.Label).string = "+"+this.gameInfo.ChaNode[curNode.name].money + "";
|
|
|
|
toolTipnode.active = true;
|
|
this.node.getChildByName("msg").addChild(toolTipnode)
|
|
cc.tween(toolTipnode).to(1,{y:100}).call(()=>{
|
|
toolTipnode.removeFromParent()
|
|
}).start();
|
|
|
|
let bindNodeName = this.gameInfo.ChaNode[curNode.name].bindNodeName
|
|
if(bindNodeName){
|
|
this.mapNode.getChildByName(bindNodeName).active = false
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//map_1201
|
|
specialMap1201(pos){
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
//打开窗帘
|
|
if(feiChaDianChildrens[i].name == "chuangHuTouchArea"){
|
|
let niuTouYingZi = this.mapNode.getChildByName("niuTouYingZi")
|
|
let chuangLian = this.mapNode.getChildByName("chuangLian")
|
|
let huJiao = this.mapNode.getChildByName("huJiao")
|
|
niuTouYingZi.active = false
|
|
chuangLian.active = false
|
|
huJiao.active = true
|
|
feiChaDianChildrens[i]["bSwitch"] = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"是不是见着有份啊");
|
|
//打开衣柜
|
|
}else if(feiChaDianChildrens[i].name == "yiGuiTouchArea"){
|
|
let yiGuiKai = this.mapNode.getChildByName("yiGuiKai")
|
|
let zhiQian = this.mapNode.getChildByName("zhiQian")
|
|
yiGuiKai.active = true
|
|
zhiQian.active = true
|
|
//打开抽屉
|
|
}else if(feiChaDianChildrens[i].name == "chouTiTouchArea"){
|
|
let chouTi = this.mapNode.getChildByName("chouTi")
|
|
let fangChanZheng = this.mapNode.getChildByName("fangChanZheng")
|
|
chouTi.active = true
|
|
fangChanZheng.active = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//map_1202
|
|
specialMap1202(pos){
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
|
|
//点击猪牙
|
|
if(feiChaDianChildrens[i].name == "zhuTouTouchArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let zhuTou = this.mapNode.getChildByName("zhuTou")
|
|
let zhuTouMeiYa = this.mapNode.getChildByName("zhuTouMeiYa")
|
|
let zhuTouJinYa = this.mapNode.getChildByName("zhuTouJinYa")
|
|
|
|
zhuTou.active = false
|
|
zhuTouMeiYa.active = true
|
|
zhuTouJinYa.active = true
|
|
this.gameInfo.ChaNode["JinYa"].isCanTouch = true
|
|
//打开柜子
|
|
}else if(feiChaDianChildrens[i].name == "guiZiTouchArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let guiZi = this.mapNode.getChildByName("guiZi")
|
|
let guiZiKai = this.mapNode.getChildByName("guiZiKai")
|
|
let chuiZi = this.mapNode.getChildByName("chuiZi")
|
|
|
|
guiZi.active = false
|
|
guiZiKai.active = true
|
|
chuiZi.active = true
|
|
//点击猪
|
|
}else if(feiChaDianChildrens[i].name == "zhuTouchArea"){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"不要动我亲爱的猪猪啊(0)");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//map_1203
|
|
specialMap1203(pos){
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
//打开窗帘
|
|
if(feiChaDianChildrens[i].name == "chuangLianTouchArea"){
|
|
let chuangLian = this.mapNode.getChildByName("chuangLian")
|
|
let guangXian = this.mapNode.getChildByName("guangXian")
|
|
let baiLuoBo = this.mapNode.getChildByName("baiLuoBo")
|
|
let huLuoBo = this.mapNode.getChildByName("huLuoBo")
|
|
chuangLian.active = false
|
|
guangXian.active = true
|
|
baiLuoBo.active = false
|
|
huLuoBo.active = true
|
|
this.gameInfo.ChaNode["DaLuoBo"].isCanTouch = true
|
|
//管家
|
|
}else if(feiChaDianChildrens[i].name == "guanJiaTouchArea"){
|
|
this.scheduleOnce(()=>{
|
|
let guanjiaSpine = this.mapNode.getChildByName("guanjiaSpine")
|
|
guanjiaSpine.getComponent(sp.Skeleton).setAnimation(0,"wanyao",true)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"得嘞");
|
|
},4.5)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
specialMap1301(pos){
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
|
|
//
|
|
if(feiChaDianChildrens[i].name == "DengGuangTouchArea"){
|
|
|
|
let diaodengSpine = this.mapNode.getChildByName("diaodengNode").getChildByName('diaodengSpine ')
|
|
//chedingPoDong.active = true
|
|
diaodengSpine.getComponent(sp.Skeleton).setAnimation(0,"3diaoluo",false)
|
|
this.scheduleOnce(()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"掉落");
|
|
},0.8)
|
|
|
|
diaodengSpine.getComponent(sp.Skeleton).setCompleteListener((trackEntry,loopCount)=>{
|
|
this.gameInfo.ChaNode["cheDingPoDong"].isCanTouch = true
|
|
})
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "houchemenArea"){
|
|
let houchemen1 = this.mapNode.getChildByName("qicheNode").getChildByName('houchemen1')
|
|
let houchemen2 = this.mapNode.getChildByName("qicheNode").getChildByName('houchemen2')
|
|
houchemen1.active = true
|
|
houchemen2.active = true
|
|
this.gameInfo.ChaNode["houMen"].isCanTouch = true
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
}else if(feiChaDianChildrens[i].name == "chouTiArea"){
|
|
let chouti = this.mapNode.getChildByName("chouti")
|
|
chouti.active = true
|
|
this.gameInfo.ChaNode["chuXianShiGuDan"].isCanTouch = true
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
}else if(feiChaDianChildrens[i].name == "zhuanpanArea"){
|
|
let zhuanPanNode = this.mapNode.getChildByName("zhuanPanNode")
|
|
zhuanPanNode.active = true
|
|
this.gameInfo.FeiChanDian["zhuanpanArea2"].isCanTouch = true
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "zhuanpanArea2"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let turntableBG = this.mapNode.getChildByName("zhuanPanNode").getChildByName('转盘')
|
|
let clickTimes = 3; //设置转盘指针多时间
|
|
let clickTimes2 = 4;
|
|
let rounds = -3; //设置转盘指针多少圈
|
|
turntableBG.angle = 0
|
|
let awardAngle01 = parseInt(( Math.random() * (-15) + (-45))+''); //1
|
|
let awardAngle02 = parseInt(( Math.random() * (-15) + (-105))+''); //2
|
|
let awardAngle03 = parseInt(( Math.random() * (-15) + (-195))+''); //3
|
|
let awardAngle04 = parseInt(( Math.random() * (-15) + (-255))+''); //4
|
|
let awardAngle05 = parseInt(( Math.random() * (-15) + (-330))+''); //5
|
|
|
|
|
|
var awardMapping={ // 转盘 会 根据 angleVlue 进行判断,angleVlue 是重要参数,angleVlue 同事涉及对 转盘角度的控制
|
|
0: {
|
|
attitude:'',
|
|
awardWords:'',
|
|
amount:'',
|
|
angleVlue:'0'
|
|
},
|
|
1: {
|
|
attitude:'',
|
|
awardWords:'',
|
|
amount:1000000,
|
|
angleVlue:'1'
|
|
},
|
|
2:{
|
|
attitude:'',
|
|
awardWords:'',
|
|
amount:10,
|
|
angleVlue:'2'
|
|
|
|
},
|
|
3:{
|
|
attitude:'',
|
|
awardWords:'',
|
|
amount:10000000,
|
|
angleVlue:'3'
|
|
|
|
},
|
|
4:{
|
|
attitude:'',
|
|
awardWords:'',
|
|
amount:0,
|
|
angleVlue:'4'
|
|
|
|
},
|
|
5:{
|
|
attitude:'',
|
|
awardWords:'',
|
|
amount:10000,
|
|
angleVlue:'5'
|
|
}
|
|
};
|
|
////////console.log(res.json, 'res')
|
|
let num_= Common5.getRandomNum(0,101)
|
|
let chooseTotal = 1
|
|
|
|
let playeffectStr = ''
|
|
// if(num_ <= 30){
|
|
// chooseTotal = 5
|
|
// playeffectStr = ''
|
|
// }else if(num_ > 30 && num_ <= 70){
|
|
// chooseTotal = 2
|
|
// playeffectStr = ''
|
|
// }else if(num_ > 70 && num_ <= 100){
|
|
// chooseTotal = 4
|
|
// playeffectStr = ''
|
|
// }
|
|
|
|
|
|
var adWords = awardMapping[chooseTotal].awardWords; //获取奖励弹出框显示文字
|
|
var adAmount = awardMapping[chooseTotal].amount; //获取奖励弹出框显示值
|
|
var adValue = awardMapping[chooseTotal].angleVlue; //获取 角度 根据 角度来判断
|
|
|
|
let inforDelayShow = ()=>{
|
|
this.scheduleOnce(function() {
|
|
let angele = turntableBG.angle
|
|
cc.tween(curOperateNode)
|
|
.to(clickTimes, {angle:angele-60},{easing: 'quintOut'})
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"恭喜您获得我们的现金优惠");
|
|
let zhuanPanNode = this.mapNode.getChildByName("zhuanPanNode")
|
|
zhuanPanNode.active = false
|
|
this.gameInfo.ChaNode["zhuanPanChouJiang"].money = 10
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('zhuanPanChouJiang')
|
|
this.findOnChaDian(chaNode)
|
|
})
|
|
.start()
|
|
|
|
}, clickTimes2);
|
|
}
|
|
let curOperateNode = turntableBG
|
|
|
|
|
|
if(adValue == 1){
|
|
cc.log( awardAngle01 + 360 * rounds,'awardAngle++++');
|
|
cc.tween(curOperateNode)
|
|
.to(clickTimes, {angle:awardAngle01 + 360 * rounds},{easing: 'quintOut'})
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
inforDelayShow();
|
|
this.closePointerClick()
|
|
|
|
}
|
|
else if(adValue == 2){
|
|
|
|
cc.log( awardAngle02 + 360 * rounds,'awardAngle++++');
|
|
cc.tween(curOperateNode)
|
|
.to(clickTimes, {angle:awardAngle02 + 360 * rounds},{easing: 'quintOut'})
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
inforDelayShow();
|
|
this.closePointerClick()
|
|
|
|
|
|
} else if(adValue == 3){
|
|
|
|
cc.log( awardAngle03 + 360 * rounds,'awardAngle++++');
|
|
cc.tween(curOperateNode)
|
|
.to(clickTimes, {angle:awardAngle03 + 360 * rounds},{easing: 'quintOut'})
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
inforDelayShow();
|
|
this.closePointerClick()
|
|
|
|
|
|
}
|
|
|
|
else if(adValue == 4){
|
|
cc.log( awardAngle04 + 360 * rounds,'awardAngle++++');
|
|
cc.tween(curOperateNode)
|
|
.to(clickTimes, {angle:awardAngle04 + 360 * rounds},{easing: 'quintOut'})
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
inforDelayShow();
|
|
this.closePointerClick()
|
|
}
|
|
else if(adValue == 5){
|
|
cc.log( awardAngle05 + 360 * rounds,'awardAngle++++');
|
|
cc.tween(curOperateNode)
|
|
.to(clickTimes, {angle:awardAngle05 + 360 * rounds},{easing: 'quintOut'})
|
|
.call(()=>{
|
|
|
|
})
|
|
.start()
|
|
inforDelayShow();
|
|
this.closePointerClick()
|
|
|
|
}
|
|
|
|
}else if(feiChaDianChildrens[i].name == "dasaoArea"){
|
|
let zhuanPanNode = this.mapNode.getChildByName('zhuanPanNode');
|
|
if(zhuanPanNode.active){
|
|
return
|
|
}
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"我不管");
|
|
}else if(feiChaDianChildrens[i].name == "guanjiaArea"){
|
|
let zhuanPanNode = this.mapNode.getChildByName('zhuanPanNode');
|
|
if(zhuanPanNode.active){
|
|
return
|
|
}
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"风光时陪你风花雪");
|
|
}else if(feiChaDianChildrens[i].name == "qiangziArea"){
|
|
let zhuanPanNode = this.mapNode.getChildByName('zhuanPanNode');
|
|
if(zhuanPanNode.active){
|
|
return
|
|
}
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"口袋只有100了");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
specialMap1302(pos){
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
|
|
// dasaoArea:{isCanTouch:true,isTouchOff:false},
|
|
// xujiangArea:{isCanTouch:true,isTouchOff:false},
|
|
// guiziArea:{isCanTouch:false,isTouchOff:false},
|
|
// baoxianguiArea:{isCanTouch:false,isTouchOff:false},
|
|
// saiziArea:{isCanTouch:true,isTouchOff:false},
|
|
// chuanlianArea:{isCanTouch:true,isTouchOff:false},
|
|
// kongtiaoArea:{isCanTouch:true,isTouchOff:false},
|
|
// dianshiArea:{isCanTouch:true,isTouchOff:false}
|
|
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
|
|
if(feiChaDianChildrens[i].name == "dasaoArea"){
|
|
|
|
}else if(feiChaDianChildrens[i].name == "xujiangArea"){
|
|
|
|
}else if(feiChaDianChildrens[i].name == "guiziArea"){
|
|
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"开柜子");
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let guiziGuan = this.mapNode.getChildByName('柜子关');
|
|
guiziGuan.active = false
|
|
this.gameInfo.ChaNode["guiZi"].isCanTouch = true
|
|
}else if(feiChaDianChildrens[i].name == "baoxianguiArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let baoxianSpine = this.mapNode.getChildByName('baoxianSpine');
|
|
baoxianSpine.getComponent(sp.Skeleton).setAnimation(0,"4baoxiangui2",false)
|
|
this.gameInfo.ChaNode["chuiziChuiQiang2"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "saiziArea"){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"拔马桶");
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let saiziSpine = this.mapNode.getChildByName('saiziSpine');
|
|
|
|
saiziSpine.getComponent(sp.Skeleton).setAnimation(0,"2bachu",false)
|
|
|
|
this.scheduleOnce(()=>{
|
|
this.gameInfo.ChaNode["xiShouPan"].isCanTouch = true
|
|
saiziSpine.getComponent(sp.Skeleton).setAnimation(0,"3penshui",true)
|
|
|
|
},2.0)
|
|
|
|
|
|
|
|
}else if(feiChaDianChildrens[i].name == "chuanlianArea"){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"拉窗帘");
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let wendujiSpine = this.mapNode.getChildByName('wendujiSpine');
|
|
let dianshiSpine = this.mapNode.getChildByName('chuanglianSpine');
|
|
let reSpr = this.mapNode.getChildByName('reSpr');
|
|
let dasaoSpine = this.mapNode.getChildByName('dasaoSpine');
|
|
let xujiangSpine = this.mapNode.getChildByName('xujiangSpine');
|
|
|
|
this.gameInfo.FeiChanDian["kongtiaoArea"].isCanTouch = true
|
|
|
|
wendujiSpine.getComponent(sp.Skeleton).setAnimation(0,"2shengwen50",false)
|
|
dianshiSpine.getComponent(sp.Skeleton).setAnimation(0,"2dakai",false)
|
|
dianshiSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
reSpr.active = true
|
|
reSpr.opacity = 150
|
|
cc.tween(reSpr)
|
|
.to(0.2, {opacity:30})
|
|
.to(0.2, {opacity:150})
|
|
.to(0.2, {opacity:30})
|
|
.to(0.2, {opacity:150})
|
|
.to(0.2, {opacity:30})
|
|
.to(0.2, {opacity:150})
|
|
.call(()=>{
|
|
reSpr.active = false
|
|
dasaoSpine.getComponent(sp.Skeleton).setAnimation(0,"2han",true)
|
|
xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"2han",true)
|
|
this.gameInfo.ChaNode["chuangHu"].isCanTouch = true
|
|
})
|
|
.start()
|
|
})
|
|
|
|
|
|
}else if(feiChaDianChildrens[i].name == "kongtiaoArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"空调");
|
|
let kongtiaoSpine = this.mapNode.getChildByName('kongtiaoSpine');
|
|
let wendujiSpine = this.mapNode.getChildByName('wendujiSpine');
|
|
let reSpr = this.mapNode.getChildByName('reSpr');
|
|
let dasaoSpine = this.mapNode.getChildByName('dasaoSpine');
|
|
let xujiangSpine = this.mapNode.getChildByName('xujiangSpine');
|
|
wendujiSpine.getComponent(sp.Skeleton).setAnimation(0,"4baozha100",false)
|
|
kongtiaoSpine.getComponent(sp.Skeleton).setAnimation(0,"2kai",false)
|
|
kongtiaoSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
reSpr.active = true
|
|
reSpr.opacity = 255
|
|
cc.tween(reSpr)
|
|
.to(0.2, {opacity:30})
|
|
.to(0.2, {opacity:255})
|
|
.to(0.2, {opacity:30})
|
|
.to(0.2, {opacity:255})
|
|
.to(0.2, {opacity:30})
|
|
.to(0.2, {opacity:255})
|
|
.call(()=>{
|
|
|
|
reSpr.active = false
|
|
dasaoSpine.getComponent(sp.Skeleton).setAnimation(0,"3dahan",true)
|
|
xujiangSpine.getComponent(sp.Skeleton).setAnimation(0,"3dahan",true)
|
|
this.gameInfo.ChaNode["kongTiao"].isCanTouch = true
|
|
})
|
|
.start()
|
|
})
|
|
|
|
|
|
}else if(feiChaDianChildrens[i].name == "dianshiArea"){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"电视机");
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let dianshiSpine = this.mapNode.getChildByName('dianshiSpine');
|
|
|
|
dianshiSpine.getComponent(sp.Skeleton).setAnimation(0,"2kai",true)
|
|
dianshiSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
this.gameInfo.ChaNode["dianShi"].isCanTouch = true
|
|
})
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
specialMap1303(pos){
|
|
// bingxiangArea:{isCanTouch:true,isTouchOff:false},
|
|
// choutiArea:{isCanTouch:true,isTouchOff:false},
|
|
// baoxianguiArea:{isCanTouch:true,isTouchOff:false},
|
|
// shoujiArea:{isCanTouch:false,isTouchOff:false},
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
if(feiChaDianChildrens[i].name == "bingxiangArea"){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"开冰箱");
|
|
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let bingx = this.mapNode.getChildByName('冰箱内');
|
|
bingx.active = true
|
|
this.gameInfo.ChaNode["GuoTou"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "choutiArea"){
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"开抽屉");
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let choutikai = this.mapNode.getChildByName('抽屉开');
|
|
choutikai.active = true
|
|
this.gameInfo.ChaNode["Fangchangzheng"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "baoxianguiArea"){
|
|
|
|
let mimasuoLayer = this.mapNode.getChildByName('mimasuoLayer');
|
|
mimasuoLayer.zIndex = this.curZIndex++
|
|
mimasuoLayer.active = true
|
|
mimasuoLayer.getComponent('BaoxianGui').setMimaData(this.gameInfo.FeiChanDian["shoujiArea"].isCanTouch, this.gameInfo)
|
|
|
|
}else if(feiChaDianChildrens[i].name == "shoujiArea"){
|
|
let texie = this.mapNode.getChildByName('手机特写');
|
|
texie.active = true
|
|
texie.stopAllActions()
|
|
cc.tween(texie)
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
texie.active = false
|
|
})
|
|
.start()
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
specialMap1304(pos){
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
if(feiChaDianChildrens[i].name == "nvrenArea"){
|
|
//Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"开冰箱");
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let nvluren1 = this.mapNode.getChildByName('女路人1');
|
|
nvluren1.active = false
|
|
|
|
let nvluren2 = this.mapNode.getChildByName('女路人2');
|
|
nvluren2.active = true
|
|
this.gameInfo.ChaNode["Shouji"].isCanTouch = true
|
|
this.huxiEffect(nvluren2)
|
|
|
|
let xiaguichezhu = this.mapNode.getChildByName('下跪车主');
|
|
xiaguichezhu.active = true
|
|
this.gameInfo.ChaNode["JingShoubiao"].isCanTouch = true
|
|
this.huxiEffect(xiaguichezhu)
|
|
|
|
let daiji = this.mapNode.getChildByName('车主1待机');
|
|
daiji.active = false
|
|
|
|
this.gameInfo.ChaNode["FaXing"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "yifuArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let chezhu2 = this.mapNode.getChildByName('chezhu2');
|
|
chezhu2.active = false
|
|
let chezhuxiujirou = this.mapNode.getChildByName('chezhuxiujirou');
|
|
chezhuxiujirou.active = true
|
|
this.huxiEffect(chezhuxiujirou)
|
|
|
|
this.gameInfo.ChaNode["JingXiangLian"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "motuocheArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let lurenzhanli = this.mapNode.getChildByName('路人站立');
|
|
lurenzhanli.active = true
|
|
this.huxiEffect(lurenzhanli)
|
|
|
|
let luren = this.mapNode.getChildByName('路人');
|
|
luren.active = false
|
|
}else if(feiChaDianChildrens[i].name == "nvrenShuohuaArea"){
|
|
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNv'),"你们不要太嚣张")
|
|
}else if(feiChaDianChildrens[i].name == "nanrenShuohuaArea2"){
|
|
// if(this.gameInfo.ChaNode["JingShoubiao"].isCanTouch ){
|
|
|
|
// }else{
|
|
// this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoZuo'),"哎呦我去,兄弟这是碰瓷吧")
|
|
// }
|
|
}else if(feiChaDianChildrens[i].name == "pengchiShuohuaArea"){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaopeng'),"哎呦我的腿,没十万起不来")
|
|
}else if(feiChaDianChildrens[i].name == "nanrenShuohuaArea1"){
|
|
if(this.gameInfo.ChaNode["JingShoubiao"].isCanTouch ){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoZuo1'),"美女你是要发朋友圈吗")
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
specialMap1305(pos){
|
|
// guiziArea:{isCanTouch:true,isTouchOff:false},
|
|
// choutiArea:{isCanTouch:true,isTouchOff:false},
|
|
// nvrenArea:{isCanTouch:true,isTouchOff:false},
|
|
// dashuArea:{isCanTouch:true,isTouchOff:false},
|
|
// dayeArea:{isCanTouch:true,isTouchOff:false},
|
|
|
|
//this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
if(feiChaDianChildrens[i].name == "guiziArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let guizikai = this.mapNode.getChildByName('柜子开')
|
|
guizikai.active = true
|
|
|
|
let ps5 = this.mapNode.getChildByName('ps5')
|
|
ps5.active = true
|
|
|
|
|
|
this.gameInfo.ChaNode["Ps5"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "choutiArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let chouti = this.mapNode.getChildByName('抽屉打开')
|
|
chouti.active = true
|
|
|
|
let hongse = this.mapNode.getChildByName('红色笔记本')
|
|
hongse.active = true
|
|
|
|
|
|
}else if(feiChaDianChildrens[i].name == "nvrenArea"){
|
|
|
|
let meinvSpine = this.mapNode.getChildByName('meinvSpine')
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNv'),"强哥,加油!")
|
|
meinvSpine.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",false)
|
|
this.scheduleOnce(()=>{
|
|
meinvSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},1.5)
|
|
}else if(feiChaDianChildrens[i].name == "dashuArea"){
|
|
let qianggeSpine = this.mapNode.getChildByName('qianggeSpine')
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoQiang'),"我是真心爱她啊,干爹")
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",false)
|
|
this.scheduleOnce(()=>{
|
|
qianggeSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},1.5)
|
|
}else if(feiChaDianChildrens[i].name == "dayeArea"){
|
|
let taishuSpine = this.mapNode.getChildByName('taishuSpine')
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoLao'),"快把值钱的东西拿出来!")
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",false)
|
|
this.scheduleOnce(()=>{
|
|
taishuSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
},1.5)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
specialMap1306(pos){
|
|
// xiaohuoArea:{isCanTouch:true,isTouchOff:false},
|
|
// damaArea:{isCanTouch:true,isTouchOff:false},
|
|
// labaArea:{isCanTouch:true,isTouchOff:false},
|
|
// gouArea:{isCanTouch:true,isTouchOff:false},
|
|
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
if(feiChaDianChildrens[i].name == "xiaohuoArea"){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNanRen'),"小伙今年28,一天能赚1800")
|
|
|
|
}else if(feiChaDianChildrens[i].name == "damaArea"){
|
|
this.node["dialogFunc"](this.mapNode.getChildByName('qiPaoNvRen'),"不卖不卖,这个不卖")
|
|
|
|
}else if(feiChaDianChildrens[i].name == "labaArea"){
|
|
let laba = this.mapNode.getChildByName('labaSpine')
|
|
laba.getComponent(sp.Skeleton).setAnimation(0,"2shuohua",true)
|
|
this.scheduleOnce(()=>{
|
|
laba.getComponent(sp.Skeleton).setAnimation(0,"1jingzhi",false)
|
|
},2)
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"喇叭喊话");
|
|
|
|
}else if(feiChaDianChildrens[i].name == "gouArea"){
|
|
let gouSpine = this.mapNode.getChildByName('gouSpine')
|
|
|
|
|
|
if(gouSpine['isAnim']){
|
|
return
|
|
}
|
|
gouSpine['isAnim'] = true
|
|
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"狗凶狠的叫");
|
|
|
|
if(!gouSpine['clickIndex']){
|
|
gouSpine['clickIndex']=1
|
|
}else{
|
|
gouSpine['clickIndex']++
|
|
}
|
|
if(gouSpine['clickIndex'] == 3){
|
|
let nanrenSpine = this.mapNode.getChildByName('nanrenSpine')
|
|
gouSpine.getComponent(sp.Skeleton).setAnimation(0,"2daiji",true)
|
|
nanrenSpine.getComponent(sp.Skeleton).setAnimation(0,"2haipa",true)
|
|
this.scheduleOnce(()=>{
|
|
gouSpine.getComponent(sp.Skeleton).setAnimation(0,"3yaoren",false)
|
|
nanrenSpine.getComponent(sp.Skeleton).setAnimation(0,"3gedang",false)
|
|
this.scheduleOnce(()=>{
|
|
gouSpine['isAnim'] = false
|
|
this.endGameView(0)
|
|
},2)
|
|
},2)
|
|
}else{
|
|
let nanrenSpine = this.mapNode.getChildByName('nanrenSpine')
|
|
gouSpine.getComponent(sp.Skeleton).setAnimation(0,"2daiji",true)
|
|
nanrenSpine.getComponent(sp.Skeleton).setAnimation(0,"2haipa",true)
|
|
this.scheduleOnce(()=>{
|
|
gouSpine.getComponent(sp.Skeleton).setAnimation(0,"4ziya",true)
|
|
nanrenSpine.getComponent(sp.Skeleton).setAnimation(0,"1daiji",true)
|
|
gouSpine['isAnim'] = false
|
|
},2)
|
|
}
|
|
//console.log( gouSpine['clickIndex'], 'gouSpine')
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
specialMap1307(pos){
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
|
|
//console.log(feiChaDianChildrens[i].name)
|
|
if(feiChaDianChildrens[i].name == "kongArea"){
|
|
let saomaJiemian = this.mapNode.getChildByName('扫码界面')
|
|
saomaJiemian.zIndex = 0
|
|
saomaJiemian.active = false
|
|
}
|
|
else if(feiChaDianChildrens[i].name == "chemenArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let chemen = this.mapNode.getChildByName('chemen')
|
|
chemen.getComponent(cc.Animation).play('chemenAnim')
|
|
chemen.getComponent(cc.Animation).on(cc.Animation.EventType.FINISHED, ()=>{
|
|
this.gameInfo.FeiChanDian['hetongArea'].isCanTouch = true
|
|
})
|
|
}else if(feiChaDianChildrens[i].name == "hetongArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let zucheHetong = this.mapNode.getChildByName('租车合同')
|
|
zucheHetong.zIndex = this.curZIndex++
|
|
zucheHetong.active = true
|
|
// this.scheduleOnce(()=>{
|
|
// let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('haocheHeTong')
|
|
// this.findOnChaDian(chaNode)
|
|
// zucheHetong.active = false
|
|
// },2)
|
|
}else if(feiChaDianChildrens[i].name == "huapingArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let daociPing = this.mapNode.getChildByName('倒瓷瓶')
|
|
daociPing.active = true
|
|
let ciPing = this.mapNode.getChildByName('瓷瓶')
|
|
ciPing.active = false
|
|
this.gameInfo.ChaNode['ciQi'].isCanTouch = true
|
|
}else if(feiChaDianChildrens[i].name == "huapingDibuArea"){
|
|
// let pingdi = this.mapNode.getChildByName('瓶底')
|
|
// pingdi.zIndex = this.curZIndex++
|
|
// pingdi.active = true
|
|
// this.scheduleOnce(()=>{
|
|
// let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('ciQi')
|
|
// this.findOnChaDian(chaNode)
|
|
// pingdi.active = false
|
|
// },2)
|
|
}else if(feiChaDianChildrens[i].name == "shoujiNanArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
|
|
let pingdi = this.mapNode.getChildByName('借钱界面')
|
|
pingdi.zIndex = this.curZIndex++
|
|
pingdi.active = true
|
|
// this.scheduleOnce(()=>{
|
|
// let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('boluoShouji')
|
|
// this.findOnChaDian(chaNode)
|
|
// pingdi.active = false
|
|
// },2)
|
|
|
|
}else if(feiChaDianChildrens[i].name == "shoujiNvArea"){
|
|
let saomaJiemian = this.mapNode.getChildByName('扫码界面')
|
|
saomaJiemian.zIndex = this.curZIndex++
|
|
saomaJiemian.active = true
|
|
}else if(feiChaDianChildrens[i].name == "haocheYaoshiArea"){
|
|
// shuangji
|
|
//console.log( this.endclickIndex , 'endTime_++++++===')
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"打火机");
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let cheyaoshi = this.mapNode.getChildByName('车钥匙')
|
|
let cheyaoshiSpine = cheyaoshi.getChildByName('车钥匙')
|
|
cheyaoshiSpine.getComponent(sp.Skeleton).setAnimation(0, "2kaiqi", false)
|
|
|
|
cheyaoshiSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
this.gameInfo.ChaNode['haocheDaHuoji'].isCanTouch = true
|
|
})
|
|
}else if(feiChaDianChildrens[i].name == "yifuArea"){
|
|
let nanSpime = this.mapNode.getChildByName('laoban')
|
|
nanSpime.getComponent(sp.Skeleton).setAnimation(0, "3daiji", true)
|
|
this.gameInfo.ChaNode['yiFu'].isCanTouch = true
|
|
this.gameInfo.FeiChanDian['yifuArea'].isTouchOff = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
specialMap1308(pos){
|
|
|
|
let feiChaDianChildrens = this.mapNode.getChildByName("feiChaDianNode").children
|
|
for(var i =0;i<feiChaDianChildrens.length;i++){
|
|
//可以触摸且未触发过
|
|
if(this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name] && this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isCanTouch && !this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff){
|
|
let rect = feiChaDianChildrens[i].getBoundingBoxToWorld()
|
|
if(rect.contains(pos)){
|
|
|
|
//console.log(feiChaDianChildrens[i].name)
|
|
if(feiChaDianChildrens[i].name == "dianshiArea"){
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
|
|
let dainshi = this.mapNode.getChildByName('电视')
|
|
let dainshi2 = dainshi.getChildByName('电视画面')
|
|
dainshi2.active = true
|
|
this.gameInfo.ChaNode["donghuapian"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "guiziArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let chouti = this.mapNode.getChildByName('电视柜').getChildByName('电视柜抽屉打开')
|
|
let yaoshi = this.mapNode.getChildByName('钥匙')
|
|
chouti.active = true
|
|
yaoshi.active = true
|
|
}else if(feiChaDianChildrens[i].name == "shoujiArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let shouji = this.mapNode.getChildByName('手机放大')
|
|
shouji.zIndex = this.curZIndex
|
|
shouji.active = true
|
|
|
|
this.gameInfo.FeiChanDian["youlechangArea"].isCanTouch = false
|
|
|
|
|
|
}else if(feiChaDianChildrens[i].name == "xingqubanArea"){
|
|
let guanggao = this.mapNode.getChildByName('招生广告放大')
|
|
let guanggao2 = this.mapNode.getChildByName('招生广告')
|
|
let guanggaoSpine = this.mapNode.getChildByName('feijiSpine')
|
|
if(!guanggao['isTouch']){
|
|
guanggao['isTouch'] = true
|
|
guanggao.active = true
|
|
}else{
|
|
this.endclickIndex++
|
|
if(this.endclickIndex == 2){
|
|
let time_ = new Date().getTime();
|
|
//console.log( time_- this.endTime_, 'endTime_++++++===')
|
|
if(time_- this.endTime_<=500){
|
|
let chaNode = this.mapNode.getChildByName('chaDianNode').getChildByName('xingquban')
|
|
this.findOnChaDian(chaNode)
|
|
|
|
guanggao2.active = false
|
|
guanggaoSpine.active = true
|
|
guanggaoSpine.zIndex = this.curZIndex
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
guanggaoSpine.getComponent(sp.Skeleton).setAnimation(0,'2fei2',false)
|
|
guanggaoSpine.getComponent(sp.Skeleton).setCompleteListener(()=>{
|
|
guanggaoSpine.active = false
|
|
|
|
})
|
|
}
|
|
this.endclickIndex = 0
|
|
}else{
|
|
|
|
this.endTime_ = new Date().getTime();
|
|
}
|
|
}
|
|
|
|
}else if(feiChaDianChildrens[i].name == "youlechangArea"){
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let youle = this.mapNode.getChildByName('游乐园门票')
|
|
youle.zIndex = this.curZIndex
|
|
youle.active = true
|
|
|
|
|
|
}else if(feiChaDianChildrens[i].name == "bingxiangArea"){
|
|
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let bingxiangKai = this.mapNode.getChildByName('冰箱打开')
|
|
let kaojibingx = this.mapNode.getChildByName('烤鸡冰箱')
|
|
let bingqilin = this.mapNode.getChildByName('冰淇淋')
|
|
bingxiangKai.active = true
|
|
kaojibingx.active = true
|
|
bingqilin.active = true
|
|
this.gameInfo.ChaNode["bingqilin"].isCanTouch = true
|
|
|
|
|
|
}else if(feiChaDianChildrens[i].name == "weiboKaiArea"){
|
|
let kaixiang1= this.mapNode.getChildByName('烤箱门关闭')
|
|
let kaixiang2= this.mapNode.getChildByName('烤箱门打开')
|
|
this.gameInfo.FeiChanDian['weiboKaiArea'].isCanTouch = false
|
|
this.gameInfo.FeiChanDian['weiboguanArea'].isCanTouch = true
|
|
kaixiang1.active = false
|
|
kaixiang2.active = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "weiboguanArea"){
|
|
this.gameInfo.FeiChanDian['weiboguanArea'].isCanTouch = false
|
|
this.gameInfo.FeiChanDian['weiboKaiArea'].isCanTouch = true
|
|
let kaoji = this.mapNode.getChildByName('烤鸡生')
|
|
let kaoji2 = this.mapNode.getChildByName('烤鸡熟')
|
|
let kaixiang1= this.mapNode.getChildByName('烤箱门关闭')
|
|
let kaixiang2= this.mapNode.getChildByName('烤箱门打开')
|
|
if(kaoji.active){
|
|
|
|
|
|
kaixiang1.active = true
|
|
kaixiang2.active = false
|
|
|
|
this.gameInfo.FeiChanDian['weiboguanArea'].isCanTouch = false
|
|
this.gameInfo.FeiChanDian['weiboKaiArea'].isCanTouch = false
|
|
this.scheduleOnce(()=>{
|
|
kaoji.active = false
|
|
kaoji2.active = true
|
|
kaixiang1.active = false
|
|
kaixiang2.active = true
|
|
this.gameInfo.ChaNode["kaojishu"].isCanTouch = true
|
|
|
|
Common5.playEffectCustom(this.subBundle,this.gameInfo.PrefabInfo.soundurl+"白鸡变烤鸡烤箱");
|
|
},2.0)
|
|
}else{
|
|
kaixiang1.active = true
|
|
kaixiang2.active = false
|
|
}
|
|
|
|
}else if(feiChaDianChildrens[i].name == "chuangArea"){
|
|
this.gameInfo.FeiChanDian[feiChaDianChildrens[i].name].isTouchOff = true
|
|
let chuang1 = this.mapNode.getChildByName('风筝床底下')
|
|
let chuang2 = this.mapNode.getChildByName('床单掀起')
|
|
let chuang3 = this.mapNode.getChildByName('床')
|
|
chuang3.active = false
|
|
chuang1.active = true
|
|
chuang2.active = true
|
|
this.gameInfo.ChaNode["fengzheng"].isCanTouch = true
|
|
|
|
}else if(feiChaDianChildrens[i].name == "jihuaBiaoArea"){
|
|
|
|
let sizhi = this.mapNode.getChildByName('sizhi')
|
|
sizhi.active = true
|
|
let kechenbiao = this.mapNode.getChildByName('kechenbiao')
|
|
kechenbiao.active = true
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
huxiEffect(node){
|
|
node.stopAllActions()
|
|
cc.tween(node)
|
|
.to(1, {scale:1.03})
|
|
.to(1, {scale:1.0})
|
|
.to(1, {scale:0.98})
|
|
.union()
|
|
.repeatForever()
|
|
.start()
|
|
}
|
|
|
|
|
|
yaohuangAnim(node){
|
|
node.stopAllActions()
|
|
let rotateNum2 = -3
|
|
let rotateNum = 3
|
|
cc.tween(node)
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:rotateNum2})
|
|
.to(0.1,{angle:rotateNum})
|
|
.to(0.1,{angle:0})
|
|
.start()
|
|
}
|
|
closePointerClick(){
|
|
|
|
}
|
|
|
|
|
|
endGameView(touchIndex) {
|
|
Game.ins.stopTime();
|
|
if (touchIndex == 0) {
|
|
if(this.isFailShow){
|
|
return
|
|
}
|
|
this.isFailShow = true
|
|
this.scheduleOnce(() => {
|
|
Game.ins.showFail();
|
|
}, 3);
|
|
} else {
|
|
if(this.isSuccessShow){
|
|
return
|
|
}
|
|
this.isSuccessShow = true
|
|
this.scheduleOnce(() => {
|
|
Game.ins.showSuccess();
|
|
},3);
|
|
}
|
|
}
|
|
|
|
} |