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.
721 lines
33 KiB
721 lines
33 KiB
import FMSkeletonExtend from "../../../FrameWork/Component/FMSkeletonExtend";
|
|
import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../../FrameWork/Event/EventMgr";
|
|
import Common from "../../../FrameWork/Util/Common";
|
|
import Common5 from "../../../Platform/th/Common5";
|
|
import Game from "../../../Scripts/WenZiRes/ui/Game";
|
|
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class NewClass extends cc.Component {
|
|
@property(cc.Node)
|
|
private timeNode:cc.Node = null;
|
|
@property(cc.Node)
|
|
private gameNode:cc.Node = null;
|
|
@property(cc.Node)
|
|
private content:cc.Node = null;
|
|
@property(cc.Node)
|
|
private failNode:cc.Node = null;
|
|
bundle = null
|
|
onLoad () {
|
|
this.bundle = Common5.gameConfig.zmGameConfig[Common5.selectGameNum].bundle
|
|
Common.Type = 0;
|
|
Common.subLevel = 0;
|
|
Common.GameSubTipConfigs=[Common5.gameConfig.zmGameConfig[Common5.selectGameNum].toolTip]
|
|
Common.GameSubAnswerConfigs=[Common5.gameConfig.zmGameConfig[Common5.selectGameNum].answer]
|
|
this.node.getChildByName('bg').active = false;
|
|
}
|
|
|
|
start () {
|
|
EventMgr.onEvent_custom(ryw_Event.timeOut, (tab) => {
|
|
this.func_fail();
|
|
}, this);
|
|
this.setTimeNode();
|
|
|
|
this.content.children.forEach(p=>{
|
|
this.gameNodeOn(p);
|
|
})
|
|
this.gameNodeOn(this.gameNode.getChildByName('chongzi'))
|
|
this.gameNodeOn(this.gameNode.getChildByName('deye').getChildByName('pingzi'))
|
|
|
|
this.gameStop = true;
|
|
let deye = this.gameNode.getChildByName('deye');
|
|
let deyePos = this.gameNode.getChildByName('deyePos').getPosition();
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).animation = '1zoulu';
|
|
deye.x = this.node.width + 150;
|
|
//这里需要同步播放语音:老铁们,今天捕获野生大美女一枚
|
|
// 播放美女语音:救救我吧
|
|
cc.tween(this.gameNode.getChildByName('deye'))
|
|
.to(2.0,{x:deyePos.x, y:deyePos.y})
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).animation = '4daiji';
|
|
this.playEffectYuYin('老铁们',3.8,()=>{
|
|
this.playEffectYuYin('救救我吧', 1.5,()=>{
|
|
this.gameStop = false;
|
|
})
|
|
})
|
|
})
|
|
.start()
|
|
}
|
|
setTimeNode(){
|
|
let worldPos = this.timeNode.getPosition()
|
|
Game.ins.setTimePos(worldPos.x,worldPos.y)
|
|
Game.ins.setTimeScale(0.7)
|
|
}
|
|
|
|
private gameNodeOn(p:cc.Node){
|
|
p.on(cc.Node.EventType.TOUCH_START, this.touchStart, this);
|
|
p.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this);
|
|
p.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
|
|
p.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd, this);
|
|
}
|
|
private gameNodeOff(p:cc.Node){
|
|
p.off(cc.Node.EventType.TOUCH_START, this.touchStart, this);
|
|
p.off(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this);
|
|
p.off(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
|
|
p.off(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd, this);
|
|
}
|
|
|
|
|
|
private currDrop:any = null;
|
|
private isTouched:boolean = false;
|
|
private touchTime = Date.now();
|
|
private oldPos:cc.Vec2 = null;
|
|
private oldIndex:number = -1;
|
|
private gameStop = false;
|
|
|
|
private touchStart(event: cc.Event.EventTouch){
|
|
if(this.isTouched) return;
|
|
if(this.gameStop) return;
|
|
this.isTouched = true;
|
|
Common5.playEffect('click')
|
|
let node = event.target as cc.Node;
|
|
this.currDrop = node;
|
|
this.oldPos = this.currDrop.getPosition();
|
|
this.oldIndex = this.currDrop.zIndex;
|
|
//this.currDrop.zIndex = cc.macro.MAX_ZINDEX;
|
|
this.touchTime = Date.now();
|
|
this.gameNode.parent.getChildByName('tools').getComponent(cc.ScrollView).enabled = false;
|
|
}
|
|
private touchMove(event: cc.Event.EventTouch){
|
|
if(this.currDrop == null) return;
|
|
if(this.gameStop) return;
|
|
let nodeLoc = event.getLocation()
|
|
let nodePos = event.target.parent.convertToNodeSpaceAR(nodeLoc)
|
|
this.currDrop.setPosition(nodePos);
|
|
}
|
|
|
|
|
|
private isCao = false;
|
|
private isMutou = false;
|
|
private isChanzi = false;
|
|
private isDaxiang = false;
|
|
private isBu = false;
|
|
private isShengzi = false;
|
|
private isLangyabang = false;
|
|
private isKaorou = false;
|
|
private isChuan = false;
|
|
private isYaoshui = false;
|
|
private isJieshui = false;
|
|
private isHeshui = false;
|
|
|
|
//判断火是否点燃
|
|
isHuoBurn = false;
|
|
|
|
private touchEnd(event: cc.Event.EventTouch){
|
|
this.gameNode.parent.getChildByName('tools').getComponent(cc.ScrollView).enabled = true;
|
|
if(this.currDrop == null) return;
|
|
if(this.gameStop) return;
|
|
|
|
/* 草 ok */if(this.currDrop.name == 'cao' && !this.isCao){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('deye').getChildByName('zuiba'), this.currDrop)){
|
|
|
|
this.isCao = true;
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).animation = '5caoyao';
|
|
cc.tween(this.gameNode.getChildByName('deye'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
let posNew = this.gameNode.getChildByName('deyeNew').getPosition();
|
|
this.gameNode.getChildByName('deye').setPosition(posNew);
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).loop = false;
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).animation = '6tucaoyao';
|
|
this.playEffectYinxiao('德爷吐草药', 1.0)
|
|
})
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
let posOld = this.gameNode.getChildByName('deyePos').getPosition();
|
|
this.gameNode.getChildByName('deye').setPosition(posOld);
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).animation = '4daiji';
|
|
|
|
//this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = false;
|
|
//this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '2daiji+yaocao';
|
|
})
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '9dou+caoyao';
|
|
})
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.playEffectYuYin('非你不嫁', 3.0, ()=>{
|
|
// this.isCao = true;
|
|
//this.gameNode.getChildByName('wuyun').active = true;
|
|
this.wuyun_pro();
|
|
})
|
|
})
|
|
|
|
.start();
|
|
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 木头 ok */else if(this.currDrop.name == 'mutou' && !this.isMutou){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('mucai'), this.currDrop)){
|
|
this.gameNode.getChildByName('mucai').active = true;
|
|
this.gameNode.getChildByName('mucai').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('mucai').getComponent(FMSkeletonExtend).animation = '1mucai'
|
|
this.isTouched = false;
|
|
this.isMutou = true;
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 铲子,少砸美女的音效+挖坑的音效 */else if(this.currDrop.name == 'chanzi' && !this.isChanzi){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('lieheng').getChildByName('kongdi'), this.currDrop) && !this.isDaxiang){
|
|
this.gameNode.getChildByName('lieheng').active = false;
|
|
this.gameNode.getChildByName('daxiang').active = true;
|
|
this.gameNode.getChildByName('daxiang').getComponent(FMSkeletonExtend).animation = '1wakeng'
|
|
this.playEffectYinxiao('挖土', 0.9)
|
|
this.isDaxiang = true;
|
|
cc.tween(this.gameNode.getChildByName('daxiang'))
|
|
.delay(0.6)
|
|
.call(()=>{
|
|
this.playEffectYinxiao('挖土', 0.9)
|
|
})
|
|
.delay(0.6)
|
|
.call(()=>{
|
|
this.playEffectYinxiao('挖土', 0.9)
|
|
})
|
|
.delay(0.6)
|
|
.call(()=>{
|
|
this.playEffectYinxiao('挖土', 0.9)
|
|
})
|
|
.delay(0.6)
|
|
.call(()=>{
|
|
})
|
|
.delay(0.6)
|
|
.call(()=>{
|
|
})
|
|
.call(()=>{
|
|
this.isTouched = false;
|
|
})
|
|
.start();
|
|
}else if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop) ){
|
|
this.gameStop = true;
|
|
let oldLoop = this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop
|
|
let oldAni = this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = false;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '8+chanzi'
|
|
this.playEffectYinxiao('铲子狼牙棒打人', 2.0)
|
|
cc.tween(this.gameNode.getChildByName('meinv'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = oldLoop;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = oldAni;
|
|
this.playEffectYuYin('干嘛砸人家',2.4,()=>{
|
|
this.func_fail();
|
|
})
|
|
})
|
|
.start();
|
|
//这里会有铲子砸头
|
|
//这里美女会说:干嘛砸人家
|
|
//这里会失败
|
|
this.isTouched = false;
|
|
}
|
|
else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 布 少一个美女尖叫音效 */else if(this.currDrop.name == 'bu' && !this.isBu && this.isDaxiang){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('daxiang'), this.currDrop)){
|
|
this.gameNode.getChildByName('daxiang').getComponent(FMSkeletonExtend).animation = '3gaibu'
|
|
this.gameStop = true;
|
|
cc.tween(this.gameNode.getChildByName('daxiang'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('daxiang').getComponent(FMSkeletonExtend).animation = '5daxiang'
|
|
this.playEffectYinxiao('大象叫', 2.4)
|
|
})
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
//美女尖叫
|
|
//失败
|
|
//this.isTouched = false;
|
|
this.playEffectYinxiao('美女尖叫',2.3,()=>{
|
|
this.func_fail();
|
|
})
|
|
})
|
|
.start()
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 绳子 ok */else if(this.currDrop.name == 'shengzi' ){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('shuzi'), this.currDrop) && !this.isShengzi){
|
|
this.gameNode.getChildByName('yang').active = true;
|
|
this.gameNode.getChildByName('yang').getComponent(FMSkeletonExtend).animation = 'shenzi'
|
|
cc.tween(this.gameNode.getChildByName('yang'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('yang').getComponent(FMSkeletonExtend).animation = 'shenzi+yangrou'
|
|
//这里会说德爷我来了
|
|
this.playEffectYuYin('上吊来了', 2.0)
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('yang').getChildByName('rou1').active = true;
|
|
this.gameNode.getChildByName('yang').getComponent(FMSkeletonExtend).animation = 'shenzi'
|
|
this.gameNodeOn(this.gameNode.getChildByName('yang').getChildByName('rou1'))
|
|
this.isTouched = false;
|
|
this.isShengzi = true;
|
|
})
|
|
.start()
|
|
|
|
|
|
}else if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop)){
|
|
this.gameNode.getChildByName('shengzi').active = true;
|
|
this.gameNode.getChildByName('shengzi').getComponent(FMSkeletonExtend).animation = 'chou';
|
|
this.playEffectYinxiao('绳子抽打',3.0);
|
|
this.gameStop = true;
|
|
cc.tween(this.gameNode.getChildByName('shengzi'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
//美女会说抽人家干嘛
|
|
//失败
|
|
//this.isTouched = false;
|
|
this.playEffectYuYin('干嘛抽人家', 2.5, ()=>{
|
|
this.func_fail();
|
|
})
|
|
})
|
|
.start()
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 狼牙棒 缺少相应的音效 */else if(this.currDrop.name == 'langyabang'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop) && this.currDrop.getChildByName('langyabang').active){
|
|
this.gameNode.getChildByName('bangzi1').active = true;
|
|
this.playEffectYinxiao('铲子狼牙棒打人', 2.0)
|
|
this.gameStop = true;
|
|
cc.tween(this.gameNode.getChildByName('bangzi1'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
//美女说干嘛打人家
|
|
//失败
|
|
//this.isTouched = false;
|
|
this.playEffectYuYin('干嘛砸人家', 2.5, ()=>{
|
|
this.func_fail()
|
|
})
|
|
})
|
|
.start();
|
|
}else if(Common5.checkContainsNode(this.gameNode.getChildByName('shitou').getChildByName('area'), this.currDrop) && this.currDrop.getChildByName('langyabang').active && !this.isLangyabang){
|
|
this.gameNode.getChildByName('bangzi2').active = true;
|
|
this.playEffectYinxiao('磨铁棒', 2.0)
|
|
this.isLangyabang = true;
|
|
cc.tween(this.gameNode.getChildByName('bangzi2'))
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('bangzi2').getComponent(FMSkeletonExtend).loop = false;
|
|
this.gameNode.getChildByName('bangzi2').getComponent(FMSkeletonExtend).animation = '2bileizhen'
|
|
})
|
|
.delay(1.5)
|
|
.call(()=>{
|
|
//this.gameNode.getChildByName('bangzi2').getComponent(FMSkeletonExtend).animation = '2bileizhen'
|
|
this.gameNode.getChildByName('bangzi2').active = false;
|
|
this.content.getChildByName('langyabang').getChildByName('langyabang').active = false
|
|
this.content.getChildByName('langyabang').getChildByName('bileizhen').active = true
|
|
//this.gameNode.getChildByName('bangzi3').active = true;
|
|
this.isTouched = false;
|
|
})
|
|
.start();
|
|
}else if(Common5.checkContainsNode(this.gameNode.getChildByName('shitou').getChildByName('area'), this.currDrop)
|
|
&& this.currDrop.getChildByName('bileizhen').active
|
|
&& !this.gameNode.getChildByName('bangzi3').active )
|
|
{
|
|
this.gameNode.getChildByName('bangzi3').active = true;
|
|
this.isTouched = false;
|
|
}
|
|
else{
|
|
this.isTouched = false;
|
|
}
|
|
|
|
}
|
|
/* 羊肉1 ok */else if(this.currDrop.name == 'rou1'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('kaoroumugan'), this.currDrop)){
|
|
this.currDrop.active = false;
|
|
this.gameNode.getChildByName('kaoroumugan').active = true;
|
|
if(this.isHuoBurn){
|
|
cc.tween(this.gameNode.getChildByName('kaoroumugan'))
|
|
.delay(0.5)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('kaoroumugan').getChildByName('yangrou').getComponent(FMSkeletonExtend).animation = 'yangrou2'
|
|
})
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('kaoroumugan').getChildByName('yangrou').active = false;
|
|
this.gameNode.getChildByName('kaoroumugan').getChildByName('kaorou').active = true;
|
|
this.gameNodeOn(this.gameNode.getChildByName('kaoroumugan').getChildByName('kaorou'))
|
|
this.isTouched = false;
|
|
})
|
|
.start()
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 烤肉 ok */else if(this.currDrop.name == 'kaorou'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop)){
|
|
this.currDrop.active = false;
|
|
this.isKaorou = true;
|
|
this.gameNode.getChildByName('kaoroumugan').active = false;
|
|
this.playEffectYuYin('做牛做马', 3.0, ()=>{
|
|
this.wuyun_pro();
|
|
})
|
|
//美女吃完烤肉,会发誓
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 割草的刀 ok */else if(this.currDrop.name == 'liandao'){
|
|
if(this.gameNode.getChildByName('cao').active && Common5.checkContainsNode(this.gameNode.getChildByName('cao'), this.currDrop)){
|
|
this.gameNode.getChildByName('liandao').active = true;
|
|
cc.tween(this.gameNode)
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('cao').active = false;
|
|
this.gameNode.getChildByName('liandao').active = false;
|
|
this.gameNodeOn(this.gameNode.getChildByName('chuan'));
|
|
this.isTouched = false;
|
|
})
|
|
.start()
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/*船 ok*/else if(this.currDrop.name == 'chuan'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('bg').getChildByName('shui'), this.currDrop) && !this.isChuan){
|
|
this.gameNode.getChildByName('chuan').active = false;
|
|
this.gameNode.getChildByName('chuan1').active = true;
|
|
//如果美女治好了腿,吃了肉,就跳到船上,船开
|
|
//播放 我先走了,有缘再见。
|
|
//游戏成功
|
|
this.isTouched = false;
|
|
this.isChuan = true;
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/*头盔*/else if(this.currDrop.name == 'toukui'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('bg').getChildByName('shui'), this.currDrop) && !this.isYaoshui){
|
|
this.isYaoshui = true;
|
|
this.gameNode.getChildByName('maozi').active = true;
|
|
cc.tween(this.gameNode.getChildByName('maozi'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameNodeOn(this.gameNode.getChildByName('maozi'))
|
|
this.isTouched = false;
|
|
})
|
|
.start()
|
|
}else if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop) && !this.isHuoBurn)
|
|
{
|
|
this.playEffectYuYin('湿湿的', 2.3)
|
|
this.isTouched = false;
|
|
}else if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop) && this.isHuoBurn){
|
|
this.gameNode.getChildByName('meinv').getChildByName('toukui').active = true;
|
|
this.isTouched = false;
|
|
}
|
|
// else if(Common5.checkContainsNode(this.gameNode.getChildByName('yikecao').getChildByName('area'), this.currDrop)){
|
|
// this.gameNode.getChildByName('maozi1').active = true;
|
|
// this.gameNodeOn(this.gameNode.getChildByName('maozi1'))
|
|
// this.isJieshui = true;
|
|
// this.isTouched = false;
|
|
// }
|
|
else{//yikecao
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 接水的帽子 */
|
|
// else if(this.currDrop.name == 'maozi1'){
|
|
// if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop)){
|
|
// this.currDrop.active = false;
|
|
// this.isTouched = false;
|
|
// }else{
|
|
// this.isTouched = false;
|
|
// }
|
|
// }
|
|
/* 装满海水的帽子 缺少语音 */else if(this.currDrop.name == 'maozi'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop)){
|
|
this.currDrop.active = false;
|
|
this.gameStop = true;
|
|
this.isHeshui = true;
|
|
this.playEffectYuYin('真解渴啊', 1.2, ()=>{
|
|
//this.func_fail
|
|
//this.tucaihong();
|
|
this.isTouched = false;
|
|
})
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 信号枪 */else if(this.currDrop.name == 'qiang'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('bg'), this.currDrop)){
|
|
this.currDrop.active = false;
|
|
this.gameStop = true;
|
|
this.gameNode.getChildByName('qiang').active = true;
|
|
this.playEffectYinxiao('信号弹',1.5)
|
|
cc.tween(this.gameNode)
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).loop = false;
|
|
this.gameNode.getChildByName('deye').getComponent(FMSkeletonExtend).animation = '7shangfeiji'
|
|
this.playEffectYinxiao('直升机_1', 3.0)
|
|
})
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('deye').active = false;
|
|
this.playEffectYuYin('别扔下我',2.2,()=>{
|
|
this.func_fail();
|
|
})
|
|
})
|
|
.start();
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
|
|
/* 德爷腰间的矿泉水瓶 */else if(this.currDrop.name == 'pingzi'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop)){
|
|
//播放:味道怪怪
|
|
this.gameStop = true;
|
|
this.playEffectYuYin('这味道怪怪的',1.2,()=>{
|
|
this.tucaihong();
|
|
// let oldAni = this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation
|
|
// let oldLoop = this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop;
|
|
// this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = true;
|
|
// this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '5outu'
|
|
// cc.tween(this.gameNode.getChildByName('meinv'))
|
|
// .delay(2.0)
|
|
// .call(()=>{
|
|
// this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = oldLoop;
|
|
// this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = oldAni
|
|
// })
|
|
// .delay(1.0)
|
|
// .call(()=>{
|
|
// this.isTouched = false;
|
|
// this.func_fail()
|
|
// })
|
|
// .start()
|
|
})
|
|
this.currDrop.active = false;
|
|
}
|
|
else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 虫子 */else if(this.currDrop.name == 'chongzi'){
|
|
if(Common5.checkContainsNode(this.gameNode.getChildByName('meinv').getChildByName('area'), this.currDrop)){
|
|
|
|
//播放:高蛋白,但是吃不饱的
|
|
this.playEffectYuYin('高蛋白',2.2,()=>{
|
|
|
|
this.isTouched = false;
|
|
})
|
|
this.currDrop.active = false;
|
|
}
|
|
else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
/* 美女 */
|
|
if(this.currDrop.name == 'meinv'){
|
|
let d = Common5.makeNodeDistance_custom(this.currDrop, this.gameNode.getChildByName('chuan1'))
|
|
if(d < 100){
|
|
this.gameNode.getChildByName('chuan1').active = false;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = false;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '7shangchuan';
|
|
|
|
console.log('stop==============')
|
|
this.gameStop = true;
|
|
this.playEffectYuYin('有缘再见', 3.0, ()=>{
|
|
Game.ins.showSuccess()
|
|
})
|
|
}else{
|
|
this.isTouched = false;
|
|
}
|
|
}
|
|
else{
|
|
this.isTouched = false;
|
|
}
|
|
|
|
this.currDrop.setPosition(this.oldPos)
|
|
this.currDrop.zIndex = this.oldIndex;
|
|
this.currDrop = null;
|
|
this.oldPos = null;
|
|
this.gameStop = false;
|
|
this.detect();
|
|
}
|
|
|
|
|
|
private wuyun_pro(){
|
|
this.gameNode.getChildByName('wuyun').active = true;
|
|
//如果木头已经摆好,且没有点燃
|
|
if(this.gameNode.getChildByName('bangzi3').active){
|
|
this.gameNode.getChildByName('wuyun').getComponent(FMSkeletonExtend).animation = '3pibileizhen'
|
|
}
|
|
else if(this.isMutou && this.gameNode.getChildByName('mucai').getComponent(FMSkeletonExtend).animation == '1mucai'){
|
|
console.log('pihuo');
|
|
this.gameNode.getChildByName('wuyun').getComponent(FMSkeletonExtend).animation = '2picaihuo'
|
|
}else{
|
|
this.gameNode.getChildByName('wuyun').getComponent(FMSkeletonExtend).animation = '1piren'
|
|
}
|
|
|
|
this.playEffectYinxiao('打雷声_1', 1.0)
|
|
cc.tween(this.gameNode.getChildByName('deye'))
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('wuyun').active = false;
|
|
//如果木头已经摆好,且没有点燃
|
|
if(this.gameNode.getChildByName('bangzi3').active){
|
|
//闪电给了避雷针
|
|
}
|
|
else if(this.isMutou && this.gameNode.getChildByName('mucai').getComponent(FMSkeletonExtend).animation == '1mucai'){
|
|
this.gameNode.getChildByName('mucai').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('mucai').getComponent(FMSkeletonExtend).animation = '2huoyan'
|
|
this.isHuoBurn = true
|
|
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '3daiji+yaocao';
|
|
|
|
if(this.isHuoBurn && this.gameNode.getChildByName('kaoroumugan').active){
|
|
cc.tween(this.gameNode.getChildByName('kaoroumugan'))
|
|
.delay(0.5)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('kaoroumugan').getChildByName('yangrou').getComponent(FMSkeletonExtend).animation = 'yangrou2'
|
|
})
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('kaoroumugan').getChildByName('yangrou').active = false;
|
|
this.gameNode.getChildByName('kaoroumugan').getChildByName('kaorou').active = true;
|
|
this.gameNodeOn(this.gameNode.getChildByName('kaoroumugan').getChildByName('kaorou'))
|
|
})
|
|
.start()
|
|
}
|
|
|
|
}else{
|
|
//闪电给了美女
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '6zhamao'
|
|
//失败
|
|
cc.tween(this.gameNode.getChildByName('meinv'))
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameStop = true;
|
|
this.func_fail();
|
|
})
|
|
.start()
|
|
}
|
|
this.isTouched = false;
|
|
})
|
|
.start()
|
|
}
|
|
private tucaihong(){
|
|
let oldAni = this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation
|
|
let oldLoop = this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = true;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '5outu'
|
|
cc.tween(this.gameNode.getChildByName('meinv'))
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).loop = oldLoop;
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = oldAni
|
|
})
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.isTouched = false;
|
|
//this.func_fail
|
|
this.func_fail();
|
|
})
|
|
.start()
|
|
}
|
|
|
|
private isZhengchang = false;
|
|
private detect(){
|
|
if(this.isCao && this.isKaorou && !this.isZhengchang){
|
|
this.isZhengchang = true
|
|
this.gameNode.getChildByName('meinv').getComponent(FMSkeletonExtend).animation = '4daiji+zhengchang';
|
|
}
|
|
|
|
if(this.isCao && this.isKaorou && this.isHeshui && this.gameNode.getChildByName('chuan1').active){
|
|
this.gameNodeOn(this.gameNode.getChildByName('meinv'))
|
|
}
|
|
|
|
}
|
|
|
|
private func_fail(){
|
|
console.log('游戏结束==================================')
|
|
this.gameStop = true;
|
|
this.failNode.active = true;
|
|
this.failNode.getChildByName('w').active = true;
|
|
this.failNode.getChildByName('w').scale = 0.1
|
|
cc.tween(this.failNode.getChildByName('w'))
|
|
.to(1.0, {scale:1.2})
|
|
.delay(0.5)
|
|
.call(()=>{
|
|
// cc.director.loadScene("WordScene");
|
|
Game.ins.showFail()
|
|
})
|
|
.start()
|
|
|
|
}
|
|
|
|
private isPlayEffect = true;
|
|
private totalScore = 0;
|
|
private playEffectYuYin(name, time, cb=null){
|
|
//休得无礼1300
|
|
this.isPlayEffect = true;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/' + name)
|
|
cc.tween(this.gameNode)
|
|
.delay(time)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
if(cb != null){
|
|
cb();
|
|
}
|
|
})
|
|
.start();
|
|
}
|
|
|
|
private playEffectYinxiao(name, time, cb=null){
|
|
//休得无礼1300
|
|
this.isPlayEffect = true;
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/' + name)
|
|
cc.tween(this.gameNode.getChildByName('bg'))
|
|
.delay(time)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
if(cb != null){
|
|
cb();
|
|
}
|
|
})
|
|
.start();
|
|
}
|
|
|
|
}
|
|
|