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.
863 lines
37 KiB
863 lines
37 KiB
import DaDianScript from "../../../FrameWork/Base/DaDianScript";
|
|
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 bjJiazishang:cc.Node = null;
|
|
@property(cc.Node)
|
|
private bjHuoshang:cc.Node = null;
|
|
@property(cc.Node)
|
|
private bjDishang:cc.Node = null;
|
|
|
|
//石门
|
|
@property(cc.Node)
|
|
private shimen:cc.Node = null;
|
|
|
|
//妖怪
|
|
@property(cc.Node)
|
|
private yaoguai:cc.Node = null;
|
|
|
|
//jiazi
|
|
@property(cc.Node)
|
|
private jiazi:cc.Node = null;
|
|
|
|
//zhizhuwang
|
|
@property(cc.Node)
|
|
private zhizhuwang:cc.Node = null;
|
|
|
|
//zhizhuwang
|
|
@property(cc.Node)
|
|
private progress:cc.Node = null;
|
|
|
|
//zhizhuwang
|
|
@property(cc.Node)
|
|
private failNode:cc.Node = null;
|
|
bundle = null
|
|
onLoad () {
|
|
DaDianScript.userEnterDaDian()
|
|
this.node.getChildByName('bg').active = false;
|
|
Common.Type = 0;
|
|
Common.subLevel = 0;
|
|
Common.GameSubTipConfigs=[Common5.gameConfig.zmGameConfig[Common5.selectGameNum].toolTip]
|
|
Common.GameSubAnswerConfigs=[Common5.gameConfig.zmGameConfig[Common5.selectGameNum].answer]
|
|
this.bundle = Common5.gameConfig.zmGameConfig[Common5.selectGameNum].bundle
|
|
}
|
|
|
|
start () {
|
|
EventMgr.onEvent_custom(ryw_Event.timeOut, (tab) => {
|
|
Game.ins.showFail();
|
|
}, this);
|
|
this.setTimeNode();
|
|
|
|
this.content.children.forEach(p=>{
|
|
this.gameNodeOn(p);
|
|
})
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/风雪声')
|
|
this.isPlayEffect = false;
|
|
cc.tween(this.node)
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/我又冷又饿')
|
|
})
|
|
.delay(2.4)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
|
|
private tick = 0;
|
|
private isPlayEffect = true;
|
|
protected update(dt: number): void {
|
|
|
|
this.tick += dt;
|
|
if(this.tick >= 5.0){
|
|
this.tick = 0;
|
|
if(this.isPlayEffect){
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/风雪声')
|
|
}
|
|
}
|
|
}
|
|
|
|
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.touchTime = Date.now();
|
|
this.oldIndex = this.currDrop.zIndex;
|
|
//this.currDrop.zIndex = cc.macro.MAX_ZINDEX;
|
|
this.touchTime = Date.now();
|
|
this.gameNode.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 isBjLuoDi = false;
|
|
private isHuoOff = false;
|
|
|
|
private func_fail(){
|
|
console.log('游戏结束==================================')
|
|
this.gameStop = true;
|
|
cc.tween(this.failNode.getChildByName('w'))
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
this.failNode.active = true;
|
|
this.failNode.getChildByName('w').active = true;
|
|
this.failNode.getChildByName('w').scale = 0.1
|
|
})
|
|
.to(1.0, {scale:1.2})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
// cc.director.loadScene("WordScene");
|
|
Game.ins.onRestartCallFunc()
|
|
})
|
|
.start()
|
|
|
|
}
|
|
private func_bj_luodi() {
|
|
|
|
//douzi
|
|
if(this.currDrop.name == 'douzi'){
|
|
if(!this.bjDishang.getChildByName('fangpi').active && Common5.checkContainsNode(this.bjDishang.getChildByName('bjarea'), this.currDrop))
|
|
{
|
|
this.bjDishang.getChildByName('fangpi').active = true
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/八戒放屁')
|
|
cc.tween(this.node)
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.bjDishang.getChildByName('wenzi').active = true;
|
|
|
|
cc.tween(this.bjDishang.getChildByName('wenzi'))
|
|
.to(1.0,{opacity:0})
|
|
.start();
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/舒服')
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
this.totalScore += 1;
|
|
this.detect();
|
|
})
|
|
.start()
|
|
|
|
//console.log('八戒放屁,熏死蚊子,蚊子落地')
|
|
}
|
|
}
|
|
//酒
|
|
if(this.currDrop.name == 'jiu'){
|
|
if(Common5.checkContainsNode(this.bjDishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/出家人不喝酒')
|
|
cc.tween(this.node)
|
|
.delay(1.3)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}else if(Common5.checkContainsNode(this.jiazi.getChildByName('huodui1').getChildByName('area'), this.currDrop)){
|
|
if(this.isHuoOff){
|
|
|
|
this.isPlayEffect = false
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 255
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').active = true;
|
|
cc.tween(this.jiazi.getChildByName('huodui1').getChildByName('jiu'))
|
|
.to(0.5,{angle:100})
|
|
.call(()=>{
|
|
//倒酒的声音(0)
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/倒酒的声音')
|
|
})
|
|
.delay(1.6)
|
|
.call(()=>{
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 0;
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation = 'jiujing'
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
|
|
}else{
|
|
if(this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation == 'xiaohuo'){
|
|
this.isPlayEffect = false
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 255
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').active = true;
|
|
cc.tween(this.jiazi.getChildByName('huodui1').getChildByName('jiu'))
|
|
.to(0.5,{angle:100})
|
|
.call(()=>{
|
|
//倒酒的声音(0)
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/倒酒的声音')
|
|
})
|
|
.delay(1.6)
|
|
.call(()=>{
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 0;
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation = 'dahuo'
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/火堆起大火')
|
|
})
|
|
.delay(2.2)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//杀虫剂
|
|
if(this.currDrop.name == 'shachongji'){
|
|
if(this.bjDishang.getChildByName('wenzi').active && this.bjDishang.getChildByName('wenzi').opacity > 0 && Common5.checkContainsNode(this.bjDishang.getChildByName('wenzi').getChildByName('area'), this.currDrop)){
|
|
this.bjDishang.getChildByName('shachongji').active = true
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/喷杀虫剂')
|
|
cc.tween(this.node)
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
cc.tween(this.node)
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
//文字说话
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/威力太小了')
|
|
|
|
this.bjDishang.getChildByName('shachongji').active = false;
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
//肉
|
|
if(this.currDrop.name == 'rou'){
|
|
if(Common5.checkContainsNode(this.bjDishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/本是同根生相煎何太急')
|
|
cc.tween(this.node)
|
|
.delay(3.1)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
//蜘蛛
|
|
if(this.currDrop.name == 'zhizhu' && Common5.checkContainsNode(this.bjDishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/出家人不吃生')
|
|
cc.tween(this.node)
|
|
.delay(1.3)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
if(this.currDrop.name == 'zhizhu' && Common5.checkContainsNode(this.jiazi.getChildByName('huodui1').getChildByName('area'), this.currDrop)){
|
|
|
|
if(this.isHuoOff){
|
|
//
|
|
}else{
|
|
this.currDrop.active = false;
|
|
this.gameNode.getChildByName('zhizhu').active = true;
|
|
cc.tween(this.node)
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('zhizhu').active = false;
|
|
this.gameNode.getChildByName('zhizhu1').active = true;
|
|
this.gameNodeOn(this.gameNode.getChildByName('zhizhu1'))
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
if(this.currDrop.name == 'zhizhu1' && Common5.checkContainsNode(this.bjDishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.currDrop.active = false;
|
|
this.isPlayEffect
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/嘎嘣脆')
|
|
cc.tween(this.node)
|
|
.delay(0.7)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
this.bjDishang.getComponent(FMSkeletonExtend).setSkin('pang');
|
|
this.totalScore += 1;
|
|
this.detect();
|
|
}
|
|
|
|
//muban
|
|
if(this.currDrop.name == 'muban' && Common5.checkContainsNode(this.bjDishang.getChildByName('tuiarea'), this.currDrop)){
|
|
if(this.bjDishang.getComponent(FMSkeletonExtend).animation == 'caoyaodaiji'){
|
|
this.bjDishang.getComponent(FMSkeletonExtend).animation = 'bangjiaodaiji'
|
|
this.totalScore += 1;
|
|
this.detect();
|
|
}else{
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/没药你固定个锤子')
|
|
cc.tween(this.node)
|
|
.delay(1.7)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
//caoyao
|
|
if(this.currDrop.name == 'caoyao' && Common5.checkContainsNode(this.bjDishang.getChildByName('tuiarea'), this.currDrop)){
|
|
this.bjDishang.getComponent(FMSkeletonExtend).animation = 'caoyaodaiji'
|
|
this.currDrop.active = false;
|
|
}
|
|
|
|
//huoba
|
|
if(this.currDrop.name == 'huoba' && Common5.checkContainsNode(this.jiazi.getChildByName('huodui1').getChildByName('area'), this.currDrop)){
|
|
if(this.isHuoOff && this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation == 'jiujing'){
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).loop = true;
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation = 'xiaohuo'
|
|
this.isHuoOff = false;
|
|
}else{
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private func_bj_common(){
|
|
|
|
//酒
|
|
if(this.currDrop.name == 'jiu'){
|
|
if(this.yaoguai.getChildByName('yaoguai').active
|
|
&& this.yaoguai.getChildByName('yaoguai').getComponent(FMSkeletonExtend).animation != 'hezuidaiji'
|
|
&& Common5.checkContainsNode(this.yaoguai.getChildByName('yaoguai').getChildByName('area'), this.currDrop)){
|
|
|
|
this.yaoguai.getChildByName('yaoguai').getComponent(FMSkeletonExtend).animation = 'hezuidaiji'
|
|
|
|
this.isPlayEffect = false
|
|
this.yaoguai.getChildByName('yaoguai').getChildByName('jiu').opacity = 255
|
|
this.yaoguai.getChildByName('yaoguai').getChildByName('jiu').active = true;
|
|
cc.tween(this.yaoguai.getChildByName('yaoguai').getChildByName('jiu'))
|
|
.to(0.5,{angle:100})
|
|
.call(()=>{
|
|
//倒酒的声音(0)
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/倒酒的声音')
|
|
})
|
|
.delay(1.6)
|
|
.call(()=>{
|
|
this.yaoguai.getChildByName('yaoguai').getChildByName('jiu').opacity = 0;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/人家不胜酒力')
|
|
})
|
|
.delay(2.2)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
|
|
}
|
|
}
|
|
|
|
//锤子
|
|
if(this.currDrop.name == 'chuizi'){
|
|
if(this.yaoguai.getChildByName('yaoguai').active
|
|
&& this.yaoguai.getChildByName('yaoguai').getComponent(FMSkeletonExtend).animation == 'hezuidaiji'
|
|
&& Common5.checkContainsNode(this.yaoguai.getChildByName('yaoguai').getChildByName('area'), this.currDrop)){
|
|
console.log('hezui=============================')
|
|
this.yaoguai.getChildByName('chuizi').active = true;
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/锤子砸东西的声音')
|
|
cc.tween(this.node)
|
|
.delay(0.8)
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/锤子砸东西的声音')
|
|
})
|
|
.delay(0.8)
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/锤子砸东西的声音')
|
|
})
|
|
.delay(0.8)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
if(this.currDrop.getChildByName('hao').active){
|
|
this.yaoguai.getChildByName('chuizi').getComponent(FMSkeletonExtend).animation = 'haochuizi'
|
|
}else{
|
|
this.yaoguai.getChildByName('chuizi').getComponent(FMSkeletonExtend).animation = 'huaichuizi'
|
|
}
|
|
cc.tween(this.node)
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.yaoguai.getChildByName('chuizi').active = false;
|
|
this.yaoguai.getChildByName('yaoguai').active = false
|
|
this.yaoguai.getChildByName('mianfu').active = true
|
|
this.gameNodeOn(this.yaoguai.getChildByName('mianfu'))
|
|
})
|
|
.start()
|
|
}else if(this.yaoguai.getChildByName('yaoguai').active
|
|
&& this.yaoguai.getChildByName('yaoguai').getComponent(FMSkeletonExtend).animation != 'hezuidaiji'
|
|
&& Common5.checkContainsNode(this.yaoguai.getChildByName('yaoguai').getChildByName('area'), this.currDrop)){
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/你这么明目张胆吗')
|
|
cc.tween(this.node)
|
|
.delay(1.3)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}else if(!this.gameNode.getChildByName('caoyao').active
|
|
&& Common5.checkContainsNode(this.shimen.getChildByName('shimen'), this.currDrop)){
|
|
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/锤子砸东西的声音')
|
|
cc.tween(this.node)
|
|
.delay(0.8)
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/锤子砸东西的声音')
|
|
})
|
|
.delay(0.8)
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/锤子砸东西的声音')
|
|
})
|
|
.delay(0.8)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
if(this.shimen.getChildByName('shimen').getComponent(FMSkeletonExtend).animation != 'zasui' && this.currDrop.getChildByName('hao').active)
|
|
{
|
|
this.shimen.getChildByName('chuizi').active = true;
|
|
this.shimen.getChildByName('chuizi').getComponent(FMSkeletonExtend).animation = 'haochuizi'
|
|
cc.tween(this.node)
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.shimen.getChildByName('shimen').getComponent(FMSkeletonExtend).animation = 'zasui'
|
|
this.shimen.getChildByName('chuizi').active = false;
|
|
})
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.gameNode.getChildByName('caoyao').active = true;
|
|
this.gameNodeOn(this.gameNode.getChildByName('caoyao'))
|
|
})
|
|
.start();
|
|
}else if(!this.currDrop.getChildByName('hao').active){
|
|
this.shimen.getChildByName('chuizi').active = true;
|
|
this.shimen.getChildByName('chuizi').getComponent(FMSkeletonExtend).animation = 'huaichuizichuilan'
|
|
cc.tween(this.node)
|
|
.delay(3.0)
|
|
.call(()=>{
|
|
this.shimen.getChildByName('chuizi').active = false;
|
|
})
|
|
.start();
|
|
}
|
|
}
|
|
}
|
|
|
|
//肉挂到蜘蛛网
|
|
if(this.currDrop.name == 'rou'){
|
|
let d = Common5.makeNodeDistance_custom(this.currDrop, this.zhizhuwang)
|
|
if(d < 100 && !this.zhizhuwang.getChildByName('rou').active){
|
|
this.zhizhuwang.getChildByName('rou').active = true;
|
|
this.zhizhuwang.getChildByName('zhizhu1').active = true;
|
|
cc.tween(this.node)
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.zhizhuwang.getChildByName('zhizhu1').active = false;
|
|
this.zhizhuwang.getChildByName('zhizhu').active = true;
|
|
this.gameNodeOn(this.zhizhuwang.getChildByName('zhizhu'))
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
//木板
|
|
if(this.currDrop.name == 'muban'){
|
|
let d = Common5.makeNodeDistance_custom(this.currDrop, this.content.getChildByName('chuizi'));
|
|
if(d < 50){
|
|
this.content.getChildByName('chuizi').getChildByName('po').active = false;
|
|
this.content.getChildByName('chuizi').getChildByName('hao').active = true
|
|
}
|
|
}
|
|
|
|
|
|
return;
|
|
}
|
|
|
|
private func_bj_jiazi(){
|
|
|
|
//douzi
|
|
if(this.currDrop.name == 'douzi'
|
|
&& Common5.checkContainsNode(this.bjJiazishang.getChildByName('bjarea'), this.currDrop)
|
|
&& !this.bjJiazishang.getChildByName('fangpi').active
|
|
){
|
|
this.bjJiazishang.getChildByName('fangpi').active = true;
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/八戒放屁')
|
|
cc.tween(this.node)
|
|
.delay(1.3)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
cc.tween(this.node)
|
|
.delay(4.0)
|
|
.call(()=>{
|
|
if(this.isHuoOff){
|
|
this.isPlayEffect
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/舒服')
|
|
cc.tween(this.node)
|
|
.delay(0.6)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}else{
|
|
//八戒放屁,引燃大火
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/火堆起大火')
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation = 'dahuo'
|
|
if(this.bjJiazishang.getComponent(FMSkeletonExtend).animation == 'shoubajiedaiji'){
|
|
this.bjJiazishang.getComponent(FMSkeletonExtend).animation = 'jiaobajiedaiji'
|
|
}else if(this.bjJiazishang.getComponent(FMSkeletonExtend).animation == 'mianfushoubajiedaiji'){
|
|
this.bjJiazishang.getComponent(FMSkeletonExtend).animation = 'mianfujiaobajie'
|
|
}
|
|
this.func_fail();
|
|
}
|
|
})
|
|
.start();
|
|
|
|
}
|
|
|
|
|
|
//刀
|
|
if(this.currDrop.name == 'dao' && Common5.checkContainsNode(this.bjJiazishang.getChildByName('daoarea'), this.currDrop)){
|
|
this.bjJiazishang.getChildByName('dao').active = true;
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/刀割')
|
|
cc.tween(this.node)
|
|
.delay(1.2)
|
|
.call(()=>{
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/刀割')
|
|
})
|
|
.delay(1.2)
|
|
.call(()=>{
|
|
this.isPlayEffect = true
|
|
})
|
|
.start()
|
|
|
|
cc.tween(this.node)
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
|
|
this.bjJiazishang.getChildByName('dao').active = false;
|
|
|
|
//火灭,掉地上
|
|
if(this.isHuoOff){
|
|
this.isBjLuoDi = true;
|
|
let pos1 = Common5.getRelativePosition( this.bjDishang,this.bjJiazishang.parent);
|
|
cc.tween(this.bjJiazishang)
|
|
.to(0.5, {x:pos1.x, y:pos1.y})
|
|
.call(()=>{
|
|
this.bjDishang.active = true;
|
|
this.bjJiazishang.active = false;
|
|
this.bjDishang.getComponent(FMSkeletonExtend).animation = 'daiji'
|
|
this.bjDishang.getComponent(FMSkeletonExtend).setSkin('shou');
|
|
this.bjJiazishang.getChildByName('wenzi').active = false;
|
|
this.bjDishang.getChildByName('wenzi').active = true;
|
|
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/我就喜欢这猪骚味')
|
|
cc.tween(this.node)
|
|
.delay(2.2)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
this.totalScore += 1;
|
|
this.detect();
|
|
})
|
|
.start()
|
|
}
|
|
//火未灭,掉火上
|
|
if(!this.isHuoOff){
|
|
let pos1 = Common5.getRelativePosition(this.bjHuoshang, this.bjJiazishang.parent);
|
|
cc.tween(this.bjJiazishang)
|
|
.to(0.5, {x:pos1.x, y:pos1.y})
|
|
.call(()=>{
|
|
this.bjHuoshang.active = true;
|
|
this.bjJiazishang.active = false;
|
|
if(this.bjJiazishang.getComponent(FMSkeletonExtend).animation == 'shoubajiedaiji'){
|
|
this.bjHuoshang.getComponent(FMSkeletonExtend).animation =
|
|
'jiaobajie'
|
|
}
|
|
if(this.bjJiazishang.getComponent(FMSkeletonExtend).animation == 'mianfushoubajiedaiji'){
|
|
this.bjHuoshang.getComponent(FMSkeletonExtend).animation =
|
|
'mianfujiaobajie'
|
|
}
|
|
this.func_fail();
|
|
})
|
|
.start()
|
|
}
|
|
})
|
|
.start();
|
|
}
|
|
|
|
//水桶
|
|
if(this.currDrop.name == 'shuitong' && Common5.checkContainsNode(this.jiazi.getChildByName('huodui1').getChildByName('area'), this.currDrop)){
|
|
this.jiazi.getChildByName('huodui1').getChildByName('shuitong').active = true;
|
|
this.jiazi.getChildByName('huodui1').getChildByName('shuitong').getComponent(FMSkeletonExtend).animation = 'poshui'
|
|
this.isHuoOff = true;
|
|
cc.tween(this.node)
|
|
.delay(0.5)
|
|
.call(()=>{
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).loop = true;
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation = 'ximie'
|
|
//穿了衣服正常状态
|
|
if(this.bjJiazishang.getComponent(FMSkeletonExtend).animation.startsWith('mianfu')){
|
|
|
|
}
|
|
|
|
//没穿衣服冻成冰人
|
|
else{
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/八戒被冻结')
|
|
cc.tween(this.node)
|
|
.delay(1.3)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
this.bjJiazishang.getComponent(FMSkeletonExtend).animation = 'bingbajie'
|
|
this.bjJiazishang.getComponent(FMSkeletonExtend).loop = false;
|
|
this.func_fail();
|
|
}
|
|
|
|
})
|
|
.start();
|
|
}
|
|
|
|
//肉
|
|
if(this.currDrop.name == 'rou'){
|
|
if(Common5.checkContainsNode(this.bjJiazishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/本是同根生相煎何太急')
|
|
cc.tween(this.node)
|
|
.delay(3.1)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
//酒
|
|
if(this.currDrop.name == 'jiu'){
|
|
if(Common5.checkContainsNode(this.bjJiazishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.isPlayEffect = false
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/出家人不喝酒')
|
|
cc.tween(this.node)
|
|
.delay(2.1)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
else
|
|
if(Common5.checkContainsNode(this.jiazi.getChildByName('huodui1').getChildByName('area'), this.currDrop)){
|
|
if(this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation == 'ximie'){
|
|
this.isPlayEffect = false
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 255
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').active = true;
|
|
cc.tween(this.jiazi.getChildByName('huodui1').getChildByName('jiu'))
|
|
.to(0.5,{angle:100})
|
|
.call(()=>{
|
|
//倒酒的声音(0)
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/倒酒的声音')
|
|
})
|
|
.delay(1.6)
|
|
.call(()=>{
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 0;
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation = 'jiujing'
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
|
|
}else if(this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation == 'xiaohuo'){
|
|
this.isPlayEffect = false
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 255
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').active = true;
|
|
cc.tween(this.jiazi.getChildByName('huodui1').getChildByName('jiu'))
|
|
.to(0.5,{angle:100})
|
|
.call(()=>{
|
|
//倒酒的声音(0)
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/倒酒的声音')
|
|
})
|
|
.delay(1.6)
|
|
.call(()=>{
|
|
this.jiazi.getChildByName('huodui1').getChildByName('jiu').opacity = 0;
|
|
this.jiazi.getChildByName('huodui1').getComponent(FMSkeletonExtend).animation = 'dahuo'
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/火堆起大火')
|
|
})
|
|
.delay(2.2)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
if(this.bjJiazishang.getComponent(FMSkeletonExtend).animation.startsWith('mianfu')){
|
|
this.bjJiazishang.getComponent(FMSkeletonExtend).animation = 'mianfujiaobajie'
|
|
}else{
|
|
this.bjJiazishang.getComponent(FMSkeletonExtend).animation = 'jiaobajie'
|
|
}
|
|
this.func_fail();
|
|
})
|
|
.start()
|
|
|
|
|
|
}
|
|
//this.jiazi.getChildByName('huodui').getChildByName('dahuo').active = true;
|
|
//this.func_change_bajie(this.bjJiazishang, 'soujiaobajie');
|
|
console.log('八戒被烧焦了,失败===========================================')
|
|
}
|
|
}
|
|
|
|
//棉服
|
|
if(this.currDrop.name == 'mianfu'){
|
|
if(Common5.checkContainsNode(this.bjJiazishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.bjJiazishang.getComponent(FMSkeletonExtend).animation = 'mianfushoubajiedaiji'
|
|
this.currDrop.active = false;
|
|
this.totalScore += 1;
|
|
this.detect();
|
|
}
|
|
}
|
|
|
|
//杀虫剂
|
|
if(this.currDrop.name == 'shachongji'){
|
|
if(this.bjJiazishang.getChildByName('wenzi').active && Common5.checkContainsNode(this.bjJiazishang.getChildByName('wenzi').getChildByName('area'), this.currDrop)){
|
|
this.bjJiazishang.getChildByName('shachongji').active = true
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/音效/喷杀虫剂')
|
|
|
|
cc.tween(this.node)
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
|
|
//文字说话
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/威力太小了')
|
|
|
|
this.bjJiazishang.getChildByName('shachongji').active = false;
|
|
})
|
|
.delay(1.7)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
|
|
//蜘蛛
|
|
if(this.currDrop.name == 'zhizhu' && Common5.checkContainsNode(this.bjJiazishang.getChildByName('bjarea'), this.currDrop)){
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/出家人不吃生')
|
|
|
|
cc.tween(this.node)
|
|
.delay(1.3)
|
|
.call(()=>{
|
|
this.isPlayEffect = true;
|
|
})
|
|
.start()
|
|
}
|
|
|
|
}
|
|
|
|
private touchEnd(event: cc.Event.EventTouch){
|
|
|
|
this.gameNode.getChildByName('tools').getComponent(cc.ScrollView).enabled = true;
|
|
console.log('enable=================',this.gameNode.getChildByName('tools').getComponent(cc.ScrollView).enabled)
|
|
if(this.currDrop == null) return;
|
|
if(this.gameStop) return;
|
|
|
|
if(this.isBjLuoDi){
|
|
this.func_bj_luodi();
|
|
}else{
|
|
this.func_bj_jiazi();
|
|
}
|
|
this.func_bj_common();
|
|
|
|
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 totalScore = 0;
|
|
private detect(){
|
|
if(this.totalScore > 0 && this.totalScore <= 5){
|
|
for(let i=0;i<this.totalScore;i++){
|
|
this.progress.getChildByName((i+1).toString()).active = true;
|
|
}
|
|
}
|
|
if(this.totalScore >= 5){
|
|
this.gameStop = true;
|
|
cc.tween(this.node)
|
|
.delay(1.0)
|
|
.call(()=>{
|
|
this.isPlayEffect = false;
|
|
Common5.playEffectCustom(this.bundle,'sound/语音/俺老猪还是会高老庄吧')
|
|
})
|
|
.delay(2.0)
|
|
.call(()=>{
|
|
Game.ins.showSuccess()
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
}
|
|
|