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.
760 lines
28 KiB
760 lines
28 KiB
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import User from "../../FrameWork/User/User";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import JuQingManager from "../JuQingChat/JuQingManager";
|
|
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
|
|
import MiShuManager from "../Manager/MiShuManager";
|
|
import ShipuManager from "../Manager/ShipuManager";
|
|
import TanWeiManager from "../Manager/TanWeiManager";
|
|
import NewGuideScript from "../NewGuide/NewGuideScript";
|
|
import PrefabManage, { GameType } from "../PrefabManager/PrefabManage";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class ChaoFanWangScript extends cc.Component {
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
|
|
@property(cc.PageView)
|
|
pageView: cc.PageView = null;
|
|
|
|
@property(cc.Node)
|
|
pageBg1Node: cc.Node = null;
|
|
|
|
|
|
@property(cc.Node)
|
|
pageBg2Node: cc.Node = null;
|
|
|
|
@property(cc.Node)
|
|
pageBg3Node: cc.Node = null;
|
|
@property(cc.Node)
|
|
contentNode: cc.Node = null;
|
|
|
|
@property(cc.Prefab)
|
|
peopleSpineNode: cc.Prefab = null;
|
|
|
|
@property(cc.Node)
|
|
copyNode: cc.Node = null;
|
|
|
|
|
|
chaofanSpine: cc.Node = null
|
|
fireSpine_1: cc.Node = null
|
|
fireSpine_2: cc.Node = null
|
|
isScrolling = false
|
|
|
|
|
|
spineClick = 0
|
|
spineScaleTime = 1
|
|
dtTime = 0
|
|
clickTimeOutEvent = null
|
|
isChaofan = true
|
|
isFire = true
|
|
|
|
chaofanSpineName = '煮面'
|
|
autoCFClick = true
|
|
newGuideAnim = false
|
|
animNode: cc.Node = null
|
|
pageNodeArray: cc.Node[] = []
|
|
m_soundName = '点点点-单次'
|
|
audioId: any;
|
|
|
|
protected onDestroy(): void {
|
|
// this.pageView.node.off(cc.Node.EventType.TOUCH_START)
|
|
// this.pageView.node.off(cc.Node.EventType.TOUCH_END)
|
|
|
|
}
|
|
|
|
|
|
start() {
|
|
|
|
// cc.macro.ENABLE_MULTI_TOUCH = false;
|
|
|
|
// Common5.loadRemoteAudioEffect('sound/煮面音效')
|
|
Common5.loadRemoteAudioEffect('sound/单次点击')
|
|
|
|
|
|
//加载煮面和火
|
|
this.chaofanSpine = this.pageBg1Node.getChildByName('煮面')
|
|
this.fireSpine_1 = this.pageBg1Node.getChildByName('火1')
|
|
this.fireSpine_2 = this.pageBg1Node.getChildByName('火2')
|
|
this.initEvents()
|
|
PrefabManage.loadPrefabByType(GameType.ChaoFanDesk, this.pageBg1Node.getChildByName('桌子'))
|
|
this.loadFire()
|
|
//加载解锁的秘书
|
|
this.loadMishu()
|
|
|
|
this.showPageViewGuide()
|
|
EventMgr.onEvent_custom(ryw_Event.mishuLock, () => {
|
|
this.loadMishu()
|
|
this.loadMishu2()
|
|
this.showPageViewGuide()
|
|
}, this)
|
|
|
|
|
|
this.chaofanSpine.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
this.isChaofan = true
|
|
// this.fireSpine_1.active = false
|
|
// this.fireSpine_2.active = false
|
|
// if (this.spineScaleTime < 3 && !this.fireSpine_1.getComponent(sp.Skeleton).loop) {
|
|
// this.fireSpine_1.active = false
|
|
// this.fireSpine_2.active = false
|
|
// }
|
|
})
|
|
// this.fireSpine_1.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
|
|
// this.isFire = true
|
|
// })
|
|
// this.fireSpine_1.getComponent(sp.Skeleton).setCompleteListener(() => {
|
|
|
|
// this.isFire = true
|
|
// })
|
|
|
|
this.chaofanSpineName = ShipuManager.getCurChaocaiAnim()
|
|
EventMgr.onEvent_custom(ryw_Event.unlockItem, () => {
|
|
this.chaofanSpineName = ShipuManager.getCurChaocaiAnim()
|
|
// //换摆摊车
|
|
// if (!TanWeiManager.getLockById(5) && this.chaofanSpine.getComponent(sp.Skeleton).animation == '待机') {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', '待机', true)
|
|
// }
|
|
}, this)
|
|
|
|
EventMgr.onEvent_custom(ryw_Event.autoTimeEvent, () => {
|
|
this.aotuChaofan()
|
|
}, this)
|
|
|
|
EventMgr.onEvent_custom(ryw_Event.updateMiaoZhuan, (money) => {
|
|
this.miaozhuanAnim(money)
|
|
}, this)
|
|
|
|
|
|
EventMgr.onEvent_custom(ryw_Event.NewGuideEvent, (index) => {
|
|
this.guideNewStep(index)
|
|
}, this)
|
|
|
|
|
|
// EventMgr.onEvent_custom(ryw_Event.showDH, (index, func) => {
|
|
// this.showQiPao(this.chatConfig[index], func)
|
|
// }, this)
|
|
|
|
// EventMgr.onEvent_custom(ryw_Event.levelUpChange,()=>{
|
|
// this.checkQiPao()
|
|
// },this)
|
|
// if(User.getRoomGoodStatus() == 0){
|
|
// this.pageBg1Node.getChildByName('桌子').active = false
|
|
// this.pageBg1Node.getChildByName('煮面').active = false
|
|
// this.pageBg1Node.getChildByName('火').active = false
|
|
// this.node.getChildByName('clickNode').active = false
|
|
// }
|
|
|
|
|
|
|
|
EventMgr.onEvent_custom(ryw_Event.JuQingGuide, () => {
|
|
this.pageBg1Node.getChildByName('桌子').active = true
|
|
this.pageBg1Node.getChildByName('煮面').active = true
|
|
this.pageBg1Node.getChildByName('火1').active = true
|
|
this.pageBg1Node.getChildByName('火2').active = true
|
|
this.node.getChildByName('clickNode').active = true
|
|
|
|
let index2 = User.getFirstStepIndex()
|
|
if (index2 == 1 && User.getRoomGoodStatus() == 5) {
|
|
Common5.ReportDY("inLevel", "新手引导-引导点击煮面");
|
|
let node = this.chaofanSpine
|
|
let nodeArray = []
|
|
for (let i = 0; i < 5; i++) {
|
|
nodeArray.push(node)
|
|
}
|
|
this.guideView(nodeArray, false)
|
|
|
|
}
|
|
|
|
}, this)
|
|
|
|
this.updateMainTask()
|
|
EventMgr.onEvent_custom(ryw_Event.updateMainTask, () => {
|
|
this.updateMainTask()
|
|
}, this)
|
|
}
|
|
|
|
updateMainTask() {
|
|
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
let config = TaskManager.getTaskConfigById(mainId)
|
|
let getCurTaskId = User.getCurTaskId()
|
|
if (getCurTaskId[0] > MainTaskIdEnum.MainTask_542) {
|
|
this.pageBg1Node.getChildByName("4").active = true
|
|
this.pageBg3Node.getChildByName("4").active = true
|
|
} else if (getCurTaskId[0] > MainTaskIdEnum.MainTask_532) {
|
|
this.pageBg1Node.getChildByName("3").active = true
|
|
this.pageBg3Node.getChildByName("3").active = true
|
|
} else if (getCurTaskId[0] > MainTaskIdEnum.MainTask_514_2) {
|
|
this.pageBg1Node.getChildByName("2").active = true
|
|
this.pageBg3Node.getChildByName("2").active = true
|
|
}
|
|
}
|
|
// checkQiPao(){
|
|
// //气泡检测
|
|
// let canvas = cc.find('Canvas')
|
|
// let prefabLayer = canvas.getChildByName("prefabLayer")
|
|
// if(prefabLayer.childrenCount == 1){
|
|
|
|
// }
|
|
// }
|
|
|
|
guideNewStep(index) {
|
|
if (index == 100) {
|
|
PrefabManage.preloadPrefabByType(GameType.JuQingDialog2)
|
|
|
|
this.newGuideAnim = true
|
|
if (this.clickTimeOutEvent != null) {
|
|
clearTimeout(this.clickTimeOutEvent);
|
|
}
|
|
|
|
this.spineClick = 0
|
|
//换摆摊车
|
|
// if (!TanWeiManager.getLockById(5)) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', '煮面', false)
|
|
// } else {
|
|
Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', '煮面', false)
|
|
// }
|
|
Common5.playRemoteSpine(this.fireSpine_1, 'Spine/mishu', '主角光环', 'animation', false)
|
|
Common5.playRemoteSpine(this.fireSpine_2, 'Spine/mishu', '主角光环', 'animation', false)
|
|
this.spineScaleTime = 1.5
|
|
// cc.audioEngine.stopAllEffects();
|
|
cc.audioEngine.stop(this.audioId)
|
|
if (!this.autoCFClick) {
|
|
this.autoCFClick = true
|
|
}
|
|
|
|
|
|
this.scheduleOnce(() => {
|
|
Common5.playRemoteAudioEffect('sound/锅飞出')
|
|
|
|
this.chaofanSpine.getComponent(sp.Skeleton).timeScale = 1
|
|
// if (!TanWeiManager.getLockById(5)) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', '发光', false)
|
|
// } else {
|
|
Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', '发光', false)
|
|
// }
|
|
|
|
// this.scheduleOnce(()=>{
|
|
|
|
// JuQingManager.unLockNewJuQing('DH_88')
|
|
// },3.4)
|
|
|
|
this.scheduleOnce(() => {
|
|
this.newGuideAnim = false
|
|
EventMgr.emitEvent_custom(ryw_Event.juqingFirstEvent)
|
|
}, 3.5)
|
|
|
|
}, 0.1)
|
|
}
|
|
}
|
|
|
|
showPageViewGuide() {
|
|
|
|
|
|
let array = User.getGuideMishu()
|
|
|
|
if (array[0] == 0) {
|
|
let mishuId2 = 18 //班的多
|
|
let curUserDate2 = MiShuManager.getMishuUserDateById(mishuId2)
|
|
if (curUserDate2.isLock == false && array[0] == 0) {
|
|
//
|
|
this.node.getChildByName('队友').active = true
|
|
}
|
|
} else {
|
|
let mishuId = 10 //悦澄
|
|
let curUserDate = MiShuManager.getMishuUserDateById(mishuId)
|
|
|
|
if (curUserDate.isLock == false && array[1] == 0) {
|
|
//
|
|
this.node.getChildByName('助理').active = true
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
miaozhuanAnim(money) {
|
|
let curIndex = this.pageView.getCurrentPageIndex()
|
|
let node = this.pageNodeArray[curIndex]
|
|
if (node && node.childrenCount > 0) {
|
|
let nodeArray = []
|
|
for (let i = 0; i < node.childrenCount; i++) {
|
|
if (node.children[i].childrenCount > 0 && node.children[i].name != '桌子') {
|
|
nodeArray.push(node.children[i])
|
|
}
|
|
}
|
|
|
|
if (nodeArray.length > 0) {
|
|
|
|
let rand = Common5.getRandomNum(0, nodeArray.length)
|
|
let node = nodeArray[rand]
|
|
if (this.animNode == null) {
|
|
// console.log('需要创建')
|
|
this.animNode = cc.instantiate(this.copyNode)
|
|
this.animNode.parent = this.copyNode.parent
|
|
let posi = Common5.getNodeToTargetPos(this.animNode, node.children[0])
|
|
this.animNode.setPosition(cc.v2(posi.x, posi.y + 50))
|
|
} else {
|
|
// console.log('不需要创建')
|
|
//this.animNode.parent = node.children[0]
|
|
//this.animNode.setPosition(cc.v2(0,50))
|
|
let posi = Common5.getNodeToTargetPos(this.animNode, node.children[0])
|
|
this.animNode.setPosition(cc.v2(posi.x, posi.y + 50))
|
|
}
|
|
|
|
if (this.animNode) {
|
|
|
|
let lab = this.animNode.getChildByName('lab').getComponent(cc.Label)
|
|
lab.string = '+' + Common5.getNumberChangeHanzi(money)
|
|
let posi = this.animNode.getPosition()
|
|
this.animNode.active = true
|
|
this.animNode.opacity = 255
|
|
cc.tween(this.animNode)
|
|
.to(0.5, { y: posi.y + 30 })
|
|
.call(() => {
|
|
this.animNode.active = false
|
|
})
|
|
.start()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
loadFire() {
|
|
if (User.getAutoClickTime() <= 0) {
|
|
// if (!TanWeiManager.getLockById(5)) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', '待机', true)
|
|
// } else {
|
|
Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', '待机', true)
|
|
// }
|
|
}
|
|
Common5.loadRemoteSpine('Spine/mishu', '主角光环')
|
|
// Common5.playRemoteSpine(this.fireSpine_1, 'Spine/mishu', '主角光环', 'animation', false)
|
|
// Common5.playRemoteSpine(this.fireSpine_2, 'Spine/mishu', '主角光环', 'animation', false)
|
|
}
|
|
|
|
loadMishu2() {
|
|
let mishuList = User.getMishuList()
|
|
|
|
for (let i = 0; i < mishuList.length; i++) {
|
|
let userDate = mishuList[i]
|
|
if (this.pageBg3Node.active && userDate.isLock == false && (userDate.mishuId == 11 || userDate.mishuId == 13 || userDate.mishuId == 16 || userDate.mishuId == 14 || userDate.mishuId == 15 || userDate.mishuId == 17)) {
|
|
this.scheduleOnce(() => {
|
|
let mishuId = userDate.mishuId
|
|
let config = MiShuManager.getConfigDateById(mishuId)
|
|
let nodeName = config.name
|
|
let spineName = config.spineName
|
|
let spineName2 = config.spineName2
|
|
|
|
let node = this.pageBg3Node.getChildByName(nodeName)
|
|
if (node && node.childrenCount == 0) {
|
|
console.log('2创建秘书' + nodeName)
|
|
|
|
let copyNode = cc.instantiate(this.peopleSpineNode)
|
|
node.addChild(copyNode)
|
|
copyNode.setPosition(cc.v2(0, 0))
|
|
|
|
Common5.playRemoteSpine(copyNode, 'Spine/mishu/人物解锁', spineName, spineName2)
|
|
}
|
|
}, 0.05 + 0.005 * i)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
loadMishu() {
|
|
//预加载秘书
|
|
let mishuList = User.getMishuList()
|
|
|
|
for (let i = 0; i < mishuList.length; i++) {
|
|
let userDate = mishuList[i]
|
|
if (userDate.isLock == false) {
|
|
this.scheduleOnce(() => {
|
|
let mishuId = userDate.mishuId
|
|
let config = MiShuManager.getConfigDateById(mishuId)
|
|
let nodeName = config.name
|
|
let spineName = config.spineName
|
|
let spineName2 = config.spineName2
|
|
|
|
let node = this.pageBg1Node.getChildByName(nodeName)
|
|
if (node && node.childrenCount == 0) {
|
|
console.log('1创建秘书' + nodeName)
|
|
|
|
let copyNode = cc.instantiate(this.peopleSpineNode)
|
|
node.addChild(copyNode)
|
|
copyNode.setPosition(cc.v2(0, 0))
|
|
|
|
Common5.playRemoteSpine(copyNode, 'Spine/mishu/人物解锁', spineName, spineName2)
|
|
}
|
|
}, 0.05 + 0.005 * i)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.checkPageView()
|
|
|
|
}
|
|
|
|
checkPageView() {
|
|
|
|
this.pageNodeArray = []
|
|
let isHaveDuiyou = false
|
|
let duiyouList = User.getDuiyouList()
|
|
for (let i = 0; i < duiyouList.length; i++) {
|
|
let userDate = duiyouList[i]
|
|
if (userDate.isLock == false) {
|
|
isHaveDuiyou = true
|
|
break
|
|
}
|
|
}
|
|
|
|
let isHaveMishuPage2 = false
|
|
let mishuList = User.getMishuList()
|
|
for (let i = 0; i < mishuList.length; i++) {
|
|
let userDate = mishuList[i]
|
|
if (userDate.mishuId >= 10 && (userDate.mishuId != 16 && userDate.mishuId != 11)) {
|
|
if (userDate.isLock == false) {
|
|
isHaveMishuPage2 = true
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
this.pageView.horizontal = false
|
|
|
|
//真的是个大厦比
|
|
if (isHaveMishuPage2) {
|
|
if (isHaveDuiyou) {
|
|
this.pageNodeArray = [this.pageBg3Node, this.pageBg1Node, this.pageBg2Node]
|
|
} else {
|
|
// this.pageNodeArray = [this.pageBg3Node, this.pageBg1Node]
|
|
this.pageNodeArray = [this.pageBg1Node, this.pageBg3Node]
|
|
}
|
|
|
|
} else {
|
|
if (isHaveDuiyou) {
|
|
this.pageNodeArray = [this.pageBg1Node, this.pageBg2Node]
|
|
} else {
|
|
this.pageNodeArray = [this.pageBg1Node]
|
|
}
|
|
}
|
|
|
|
|
|
if (isHaveDuiyou) {
|
|
this.pageBg1Node.active = true
|
|
this.pageBg2Node.active = true
|
|
this.pageBg2Node.opacity = 255
|
|
this.pageView.horizontal = true
|
|
}
|
|
|
|
if (isHaveMishuPage2) {
|
|
this.pageBg1Node.active = true
|
|
this.pageBg3Node.active = true
|
|
this.pageBg3Node.opacity = 255
|
|
this.pageView.horizontal = true
|
|
|
|
this.scheduleOnce(() => {
|
|
this.pageView.scrollToPage(0, 0)
|
|
}, 0.1)
|
|
|
|
}
|
|
|
|
}
|
|
loadDuiyou() {
|
|
//预加载秘书
|
|
let mishuList = User.getDuiyouList()
|
|
for (let i = 0; i < mishuList.length; i++) {
|
|
let userDate = mishuList[i]
|
|
if (userDate.isLock == false) {
|
|
this.scheduleOnce(() => {
|
|
let mishuId = userDate.mishuId
|
|
let config = MiShuManager.getConfigDateById(mishuId)
|
|
let nodeName = config.name
|
|
let spineName = config.spineName
|
|
let spineName2 = config.spineName2
|
|
|
|
let node = this.pageBg2Node.getChildByName(nodeName)
|
|
if (node && node.childrenCount == 0) {
|
|
console.log('创建队友')
|
|
|
|
let copyNode = cc.instantiate(this.peopleSpineNode)
|
|
node.addChild(copyNode)
|
|
copyNode.setPosition(cc.v2(0, 0))
|
|
|
|
Common5.playRemoteSpine(copyNode, 'Spine/mishu/人物解锁', spineName, spineName2, true)
|
|
}
|
|
}, 0.05 + 0.005 * i)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
initEvents() {
|
|
let startTime = 0;
|
|
let curIndex = 0
|
|
|
|
|
|
this.node.getChildByName('clickNode').on(cc.Node.EventType.TOUCH_START, (event) => {
|
|
//startTime = new Date().getTime(); // 记录触摸开始时间
|
|
//console.log('PageView 被点击111');
|
|
curIndex = this.pageView.getCurrentPageIndex()
|
|
|
|
|
|
this.onPageClick(event);
|
|
}, this);
|
|
this.node.getChildByName('clickNode')['_touchListener'].setSwallowTouches(false);
|
|
|
|
|
|
let index = User.getFirstStepIndex()
|
|
if (index == 1 && User.getRoomGoodStatus() == 5) {
|
|
Common5.ReportDY("inLevel", "新手引导-引导点击煮面");
|
|
let node = this.chaofanSpine
|
|
let nodeArray = []
|
|
for (let i = 0; i < 5; i++) {
|
|
nodeArray.push(node)
|
|
}
|
|
this.guideView(nodeArray, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
guideView(nodeArray, isPlayAnim = true, opacity = -1) {
|
|
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab) => {
|
|
prefab.zIndex = 199
|
|
if (!isPlayAnim) {
|
|
prefab.getComponent(NewGuideScript).setCanPlayAnim(isPlayAnim)
|
|
}
|
|
if (opacity != -1) {
|
|
prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity)
|
|
|
|
}
|
|
let guideNodeArray = nodeArray
|
|
let firstNode = guideNodeArray.shift()
|
|
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
|
|
})
|
|
}
|
|
|
|
onPageClick(event) {
|
|
//console.log('PageView 被点击');
|
|
if (this.newGuideAnim) {
|
|
|
|
return
|
|
}
|
|
clearTimeout(this.clickTimeOutEvent);
|
|
//播放动画
|
|
this.spineClick++
|
|
if (this.spineClick == 5) {
|
|
this.spineScaleTime = 2
|
|
|
|
} else if (this.spineClick == 10) {
|
|
this.spineScaleTime = 2
|
|
|
|
} else if (this.spineClick == 1) {
|
|
// if (this.m_soundName == 'effect/点点点-单次') {
|
|
// Common5.playRemoteAudioEffect('remotesound/effect/点点点-单次')
|
|
// console.log("playRemoteAudioEffect('remotesound/effect/点点点-单次')")
|
|
// }
|
|
} else {
|
|
this.spineScaleTime = 1.5
|
|
|
|
}
|
|
|
|
if (User.getAutoClickTime() > 0) {
|
|
this.spineScaleTime = 2
|
|
}
|
|
if (this.spineClick == 1) {
|
|
// Common5.playRemoteAudioEffect('sound/单次点击')
|
|
// if (this.m_soundName != 'effect/点点点-连续') {
|
|
// this.m_soundName = 'effect/点点点-连续'
|
|
// cc.audioEngine.stopAllEffects()
|
|
cc.audioEngine.stop(this.audioId)
|
|
Common5.playRemoteAudioEffect_id('remotesound/effect/点点点-连续', true, (id) => {
|
|
this.audioId = id
|
|
})
|
|
// Common5.playRemoteAudioEffect('remotesound/effect/点点点-连续', true)
|
|
console.log("playRemoteAudioEffect('remotesound/effect/点点点-连续', true)")
|
|
// }
|
|
}
|
|
|
|
|
|
|
|
if (this.spineClick == 1 || this.spineClick == 5 || this.spineClick == 10) {
|
|
//换摆摊车
|
|
// if (!TanWeiManager.getLockById(5)) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', this.chaofanSpineName, true, null, this.spineScaleTime)
|
|
// } else {
|
|
Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', this.chaofanSpineName, true, null, this.spineScaleTime)
|
|
// }
|
|
if (this.spineScaleTime >= 2) {
|
|
Common5.playRemoteSpine(this.fireSpine_1, 'Spine/mishu', '主角光环', 'animation', true, null, this.spineScaleTime)
|
|
Common5.playRemoteSpine(this.fireSpine_2, 'Spine/mishu', '主角光环', 'animation', true, null, this.spineScaleTime)
|
|
}
|
|
if (this.spineClick == 5) {
|
|
// Common5.playRemoteAudioEffect('sound/煮面音效', true)
|
|
}
|
|
}
|
|
|
|
|
|
this.clickTimeOutEvent = setTimeout(() => {
|
|
this.spineClick = 0
|
|
//换摆摊车
|
|
// if (!TanWeiManager.getLockById(5)) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', '待机', true)
|
|
// } else {
|
|
Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', '待机', true)
|
|
// }
|
|
|
|
this.fireSpine_1.active = false
|
|
this.fireSpine_2.active = false
|
|
// if (this.spineScaleTime >= 3) {
|
|
// Common5.playRemoteSpine(this.fireSpine_1, 'Spine/mishu', '主角光环', 'animation', false)
|
|
// Common5.playRemoteSpine(this.fireSpine_2, 'Spine/mishu', '主角光环', 'animation', false)
|
|
// }
|
|
this.spineScaleTime = 1.5
|
|
// cc.audioEngine.stopAllEffects();
|
|
cc.audioEngine.stop(this.audioId)
|
|
this.m_soundName = 'effect/点点点-单次'
|
|
if (!this.autoCFClick) {
|
|
this.autoCFClick = true
|
|
}
|
|
}, 1200);
|
|
|
|
let posi = event.getLocation()//世界坐标
|
|
EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, posi)
|
|
}
|
|
|
|
onPageSwipe() {
|
|
console.log('PageView 被滑动');
|
|
}
|
|
|
|
|
|
aotuChaofan() {
|
|
let autoClickTime = User.getAutoClickTime()
|
|
if (autoClickTime <= 0) {
|
|
if (this.spineClick == 0) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', '煮面', false)
|
|
// Common5.playRemoteSpine(this.fireSpine_1, 'Spine/mishu', '主角光环', 'animation', false)
|
|
// Common5.playRemoteSpine(this.fireSpine_2, 'Spine/mishu', '主角光环', 'animation', false)
|
|
if (this.chaofanSpine.getComponent(sp.Skeleton).animation != "待机") {
|
|
// //换摆摊车
|
|
// if (!TanWeiManager.getLockById(5)) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', '待机', true)
|
|
// } else {
|
|
Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', '待机', true)
|
|
// }
|
|
}
|
|
cc.audioEngine.stop(this.audioId)
|
|
// cc.audioEngine.stopAllEffects()
|
|
this.fireSpine_1.active = false
|
|
this.fireSpine_2.active = false
|
|
this.autoCFClick = true
|
|
}
|
|
|
|
} else {
|
|
//自动播放
|
|
if (this.autoCFClick) {
|
|
this.autoCFClick = false
|
|
this.spineScaleTime = 2
|
|
//换摆摊车
|
|
// if (!TanWeiManager.getLockById(5)) {
|
|
// Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面2', '煮面2', this.chaofanSpineName, true, null, this.spineScaleTime)
|
|
// } else {
|
|
Common5.playRemoteSpine(this.chaofanSpine, 'Spine/mishu/煮面', '煮面', this.chaofanSpineName, true, null, this.spineScaleTime)
|
|
// }
|
|
|
|
// Common5.playRemoteSpine(this.fireSpine_1, 'Spine/mishu', '主角光环', 'animation', true, null, this.spineScaleTime)
|
|
// Common5.playRemoteSpine(this.fireSpine_2, 'Spine/mishu', '主角光环', 'animation', true, null, this.spineScaleTime)
|
|
// cc.audioEngine.stopAllEffects()
|
|
cc.audioEngine.stop(this.audioId)
|
|
Common5.playRemoteAudioEffect_id('remotesound/effect/轻快-10秒', true, (id) => {
|
|
this.audioId = id
|
|
})
|
|
console.log("playRemoteAudioEffect('remotesound/effect/轻快-10秒', true)")
|
|
this.fireSpine_1.active = false
|
|
this.fireSpine_2.active = false
|
|
}
|
|
EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, cc.v2(375, 667))
|
|
//let level= User.getAutoLevel()
|
|
// if(level >=1 && level<=5){
|
|
// EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, cc.v2(300,667))
|
|
|
|
// }else if(level >5 && level<=19){
|
|
// EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, cc.v2(300,667))
|
|
|
|
// EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, cc.v2(200,667))
|
|
|
|
// }if(level==20){
|
|
// EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, cc.v2(300,667))
|
|
|
|
// EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, cc.v2(200,667))
|
|
|
|
// EventMgr.emitEvent_custom(ryw_Event.clickChaoFan, cc.v2(400,667))
|
|
|
|
// }
|
|
|
|
}
|
|
}
|
|
|
|
pageScrollEvent() {
|
|
this.isScrolling = true
|
|
|
|
let curIndex = this.pageView.getCurrentPageIndex()
|
|
console.log(curIndex, 'curIndex++++++++++===')
|
|
//加载队友
|
|
|
|
if (curIndex == 0 || curIndex == 2) {
|
|
this.loadDuiyou()
|
|
let array = User.getGuideMishu()
|
|
let mishuId2 = 18 //班的多
|
|
let curUserDate2 = MiShuManager.getMishuUserDateById(mishuId2)
|
|
if (curUserDate2.isLock == false && array[0] == 0) {
|
|
//
|
|
this.node.getChildByName('队友').active = false
|
|
array[0] = 1
|
|
User.setGuideMishu(array)
|
|
}
|
|
} if (curIndex == 1) {
|
|
this.loadMishu2()
|
|
let array = User.getGuideMishu()
|
|
let mishuId = 11 //悦澄
|
|
let curUserDate = MiShuManager.getMishuUserDateById(mishuId)
|
|
|
|
if (curUserDate.isLock == false && array[1] == 0) {
|
|
//
|
|
this.node.getChildByName('助理').active = false
|
|
array[1] = 1
|
|
User.setGuideMishu(array)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
// update(dt) {
|
|
// if (this.chaofanSpine) {
|
|
// console.log(this.chaofanSpine.active)
|
|
// console.log(this.chaofanSpine.getComponent(sp.Skeleton).animation)
|
|
// }
|
|
// }
|
|
}
|
|
|