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.
527 lines
23 KiB
527 lines
23 KiB
|
|
import { DateUtils } from "../../../FrameWork/Util/DateUtils";
|
|
import Common5 from "../../../Platform/th/Common5";
|
|
import GameBaseScript from "../../GameRoomRes/GameBaseScript";
|
|
import TaskManager, { MainTaskIdEnum } from "../../JuQingChat/TaskManager";
|
|
import JuQingQiPao from "../../JuQingGuanQia/JuQingQiPao";
|
|
import BagManager from "../../Manager/BagManager";
|
|
import UserManager from "../../Manager/UserManager";
|
|
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
|
|
import GameBase from "../../SCommon/GameBase";
|
|
import TouZiXieYiShu from "../TouZiXieYiShu/TouZiXieYiShu";
|
|
import ChaoCaiResult from "./ChaoCaiResult";
|
|
|
|
let ChadianConfig = {
|
|
chadianLog303: [
|
|
{
|
|
str: "怎么样?还满意吧",
|
|
qiPaoPos: -1,
|
|
delay:1.6,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G3/怎么样?还满意吧"
|
|
},
|
|
{
|
|
str: "还不错,留下来多陪陪我?给你追加投资",
|
|
qiPaoPos: 0,
|
|
delay:4.2,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G3/还不错,留下来多陪陪我?给你追加投资"
|
|
}
|
|
],
|
|
chadianLog706: [
|
|
{
|
|
str: "味道怎么样?",
|
|
qiPaoPos: -1,
|
|
delay:0.9,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G7/味道怎么样?"
|
|
},
|
|
{
|
|
str: "还行,三个人,玩点刺激的?我给你加投资",
|
|
qiPaoPos: 0,
|
|
delay:5.4,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G7/还行,三个人,玩点刺激的?我给你加投资"
|
|
}
|
|
],
|
|
chadianLog1102: [
|
|
{
|
|
str: "清醒些了没",
|
|
qiPaoPos: -1,
|
|
delay:0.8,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G11/清醒些了没"
|
|
},
|
|
{
|
|
str: "留下来陪我运动一下?我给你加投资",
|
|
qiPaoPos: 0,
|
|
delay:3.6,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G11/留下来陪我运动一下?我给你加投资"
|
|
}
|
|
],
|
|
chadianLog1302: [
|
|
{
|
|
str: "味道怎么样?",
|
|
qiPaoPos: -1,
|
|
delay:0.6,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G13/味道怎么样?"
|
|
},
|
|
{
|
|
str: "可以,想要更多投资吗,留下来一起学习吧",
|
|
qiPaoPos: 0,
|
|
delay:5.2,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G13/可以,想要更多投资吗,留下来一起学习吧"
|
|
}
|
|
],
|
|
chadianLog1602: [
|
|
{
|
|
str: "怎么样?",
|
|
qiPaoPos: -1,
|
|
delay:0.5,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G16/怎么样?"
|
|
},
|
|
{
|
|
str: "可以,留下来陪我?我给你加投资",
|
|
qiPaoPos: 0,
|
|
delay:4.2,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G16/可以,留下来陪我?我给你加投资"
|
|
}
|
|
]
|
|
,
|
|
chadianLog1704: [
|
|
{
|
|
str: "味道怎么样?",
|
|
qiPaoPos: -1,
|
|
delay:0.6,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G17/味道怎么样?"
|
|
},
|
|
{
|
|
str: "不错,要不要再来一次三人游戏?",
|
|
qiPaoPos: 0,
|
|
delay:3.7,
|
|
effectUrl: "GameMethodRes/sound/ChaoCai/G17/不错,要不要再来一次三人游戏?"
|
|
}
|
|
]
|
|
}
|
|
|
|
let ChaoCaiPropConfig = [
|
|
{gameId:0,propIdArr:[3620,3621,3622],caiGuan:'湘菜馆',caiMing:'剁椒鱼头',touZiMoney:[150000,200000,250000],jianZaoMoney:150000,huoYuan:'废瓶回收',tiaoZhuanGameType:GameType.JiuPingHuiShou,personInfo:[
|
|
{bundleName:'Room3',url:'spine/坐姿',skin:'浴袍',animation:'待机'}
|
|
]},
|
|
{gameId:1,propIdArr:[3630,3631,3632,3633],caiGuan:'川菜馆',caiMing:'宫保鸡丁',touZiMoney:[240000,320000,400000],jianZaoMoney:800000,huoYuan:'食品回收',tiaoZhuanGameType:GameType.ShiCaiHuiShou,personInfo:[
|
|
{bundleName:'Room7',url:'spine/投资人坐姿',skin:'default',animation:'待机'},{bundleName:'Room7',url:'spine/师妹坐姿',skin:'default',animation:'待机'}
|
|
]},
|
|
{gameId:2,propIdArr:[3640,3641,3642,3643,3644],caiGuan:'苏菜馆',caiMing:'霸王别姬',touZiMoney:[1800000,2300000,2800000],jianZaoMoney:5000000,huoYuan:'食品回收',tiaoZhuanGameType:GameType.ShiCaiHuiShou,personInfo:[
|
|
{bundleName:'Room11',url:'spine/坐姿',skin:'default',animation:'待机'}
|
|
]},
|
|
{gameId:3,propIdArr:[3650,3651,3652,3653,3654,3655],caiGuan:'徽菜馆',caiMing:'徽州一品鲜',touZiMoney:[10000000,12000000,15000000],jianZaoMoney:28000000,huoYuan:'食品回收',tiaoZhuanGameType:GameType.ShiCaiHuiShou,personInfo:[
|
|
{bundleName:'Room13',url:'spine/坐姿',skin:'default',animation:'待机'}
|
|
]},
|
|
{gameId:4,propIdArr:[3660,3661,3662,3663,3664,3665,3666],caiGuan:'浙菜馆',caiMing:'西湖醋鱼',touZiMoney:[20000000,30000000,40000000],jianZaoMoney:100000000,huoYuan:'快递站',tiaoZhuanGameType:GameType.KuaiDiZhan,personInfo:[
|
|
{bundleName:'Room16',url:'spine/坐姿',skin:'default',animation:'待机'}
|
|
]},
|
|
{gameId:5,propIdArr:[3670,3671,3672,3673,3674,3675,3676,3677],caiGuan:'闽菜馆',caiMing:'佛跳墙',touZiMoney:[240000000,360000000,500000000],jianZaoMoney:1000000000,huoYuan:'食品回收',tiaoZhuanGameType:GameType.ShiCaiHuiShou,personInfo:[
|
|
{bundleName:'Room17',url:'spine/投资人坐姿',skin:'default',animation:'待机'},{bundleName:'Room17',url:'spine/货郎坐',skin:'default',animation:'animation'}
|
|
]},
|
|
]
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class ChaoCai extends GameBase {
|
|
|
|
@property(cc.Node)
|
|
progressNode: cc.Node = null
|
|
|
|
@property(cc.Node)
|
|
singleItem: cc.Node = null
|
|
|
|
@property(cc.Node)
|
|
itemLayout: cc.Node = null
|
|
|
|
@property(cc.Label)
|
|
leftTimeStr: cc.Label = null
|
|
|
|
@property(cc.Node)
|
|
chaoFanSpine: cc.Node = null
|
|
|
|
@property(cc.Node)
|
|
huoSpine1: cc.Node = null
|
|
|
|
@property(cc.Node)
|
|
huoSpine2: cc.Node = null
|
|
|
|
@property(cc.Node)
|
|
qiPaoNode: cc.Node = null
|
|
|
|
@property(cc.Node)
|
|
huoYuanNode: cc.Node = null
|
|
|
|
// @property(cc.Node)
|
|
// resultSelectNode: cc.Node = null
|
|
|
|
_dt:number = 0
|
|
_anNiuDt:number = 0
|
|
isStartTime:boolean = false
|
|
isGameOver:boolean = false
|
|
allTime:number = 15
|
|
curGameId:number = 0
|
|
progressReduceRate:number = 0.12
|
|
progressAddRate1:number = 0.05
|
|
progressAddRate2:number = 0.035
|
|
progressAddRate3:number = 0.025
|
|
progressNum = 0
|
|
btnClickNum = 0
|
|
isHaveAllProp = true
|
|
resultMoney:number = 0
|
|
|
|
onLoad() {
|
|
super.onLoad()
|
|
|
|
GameBaseScript.preLoadRemoteAudio(ChadianConfig);
|
|
}
|
|
|
|
|
|
initView(gameId){
|
|
this.curGameId = gameId
|
|
this.initItemContent()
|
|
this.showQiPaoNode()
|
|
this.scheduleOnce(()=>{
|
|
let personInfo = ChaoCaiPropConfig[this.curGameId].personInfo
|
|
for(let i=0;i<personInfo.length;i++){
|
|
Common5.getSpineFromBundle(personInfo[i].bundleName,personInfo[i].url,null,(prefabNode)=>{
|
|
this.node.getChildByName('person'+i).addChild(prefabNode)
|
|
prefabNode.getComponent(sp.Skeleton).setAnimation(0,personInfo[i].animation,true)
|
|
prefabNode.getComponent(sp.Skeleton).setSkin(personInfo[i].skin)
|
|
prefabNode.setPosition(cc.v2(0,0))
|
|
})
|
|
}
|
|
})
|
|
}
|
|
showQiPaoNode(){
|
|
this.qiPaoNode.getChildByName('caiGuanStr').getComponent(cc.Label).string = `开${ChaoCaiPropConfig[this.curGameId].caiGuan}需要:`
|
|
this.qiPaoNode.getChildByName('str1').getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ChaoCaiPropConfig[this.curGameId].jianZaoMoney)}`
|
|
this.qiPaoNode.getChildByName('str2').getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ChaoCaiPropConfig[this.curGameId].touZiMoney[0])}`
|
|
this.qiPaoNode.getChildByName('str3').getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ChaoCaiPropConfig[this.curGameId].touZiMoney[1])}`
|
|
this.qiPaoNode.getChildByName('str4').getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ChaoCaiPropConfig[this.curGameId].touZiMoney[2])}`
|
|
this.huoYuanNode.getChildByName('huoYuan').getComponent(cc.Label).string = ChaoCaiPropConfig[this.curGameId].huoYuan
|
|
this.huoYuanNode.active = !this.isHaveAllProp
|
|
|
|
this.progressNode.getChildByName('str2').getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ChaoCaiPropConfig[this.curGameId].touZiMoney[0])}`
|
|
this.progressNode.getChildByName('str3').getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ChaoCaiPropConfig[this.curGameId].touZiMoney[1])}`
|
|
this.progressNode.getChildByName('str4').getComponent(cc.Label).string = `${Common5.getNumberChangeHanzi(ChaoCaiPropConfig[this.curGameId].touZiMoney[2])}`
|
|
|
|
}
|
|
protected update(dt: number): void {
|
|
if(this.isStartTime && !this.isGameOver){
|
|
this.progressNum -= this.progressReduceRate*dt
|
|
if(this.progressNum <= 0){
|
|
this.progressNum = 0
|
|
}else if(this.progressNum >= 1){
|
|
this.progressNum = 1
|
|
}
|
|
this.changeProgress()
|
|
|
|
this._dt += dt
|
|
this._anNiuDt += dt
|
|
if(this._anNiuDt >= 1){
|
|
if(this.chaoFanSpine.getComponent(sp.Skeleton).animation == '炒'){
|
|
this.chaoFanSpine.getComponent(sp.Skeleton).animation = '静止'
|
|
this.chaoFanSpine.getComponent(sp.Skeleton).timeScale = 1
|
|
this.huoSpine1.active = false
|
|
this.huoSpine2.active = false
|
|
}
|
|
}
|
|
if(this._dt >= 1){
|
|
let timeScale = 1
|
|
if(this.btnClickNum >= 2){
|
|
timeScale = 1.5
|
|
}else if(this.btnClickNum >= 3){
|
|
timeScale = 2
|
|
}else if(this.btnClickNum >= 4){
|
|
timeScale = 2.5
|
|
}
|
|
if(this.chaoFanSpine.getComponent(sp.Skeleton).animation == '炒'){
|
|
this.chaoFanSpine.getComponent(sp.Skeleton).timeScale = timeScale
|
|
}
|
|
this.btnClickNum = 0
|
|
|
|
this._dt = 0
|
|
this.allTime -= 1
|
|
if(this.allTime <= 0){
|
|
this.setGameOver()
|
|
}
|
|
this.leftTimeStr.string = `${DateUtils.formatTime_custom(this.allTime)}`
|
|
}
|
|
}
|
|
}
|
|
setGameOver(){
|
|
this.isGameOver = true
|
|
this.isStartTime = false
|
|
this.chaoFanSpine.getComponent(sp.Skeleton).animation = '静止'
|
|
this.chaoFanSpine.getComponent(sp.Skeleton).timeScale = 1
|
|
this.huoSpine1.active = false
|
|
this.huoSpine2.active = false
|
|
|
|
let resultIndex = 0
|
|
if(this.progressNum <= 0.6){
|
|
resultIndex = 0
|
|
}else if(this.progressNum <= 0.8){
|
|
resultIndex = 1
|
|
}else{
|
|
resultIndex = 2
|
|
}
|
|
this.resultMoney = ChaoCaiPropConfig[this.curGameId].touZiMoney[resultIndex]
|
|
|
|
let finishCallFunc = ()=>{
|
|
this.qiPaoNode.active = false;
|
|
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
|
|
let mainId = mainTaskInfo.Id
|
|
if(mainId == MainTaskIdEnum.MainTask_303){
|
|
PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu,null,(prefab)=>{
|
|
prefab.getComponent(TouZiXieYiShu).initView(0,this.resultMoney,()=>{
|
|
UserManager.addMoney(this.resultMoney)
|
|
PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(this.resultMoney,'1')}`)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_303)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_304)
|
|
|
|
this.showQiPao(ChadianConfig.chadianLog303[0],()=>{
|
|
this.showQiPao(ChadianConfig.chadianLog303[1],()=>{
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
});
|
|
});
|
|
})
|
|
})
|
|
|
|
|
|
}else if(mainId == MainTaskIdEnum.MainTask_706){
|
|
PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu,null,(prefab)=>{
|
|
prefab.getComponent(TouZiXieYiShu).initView(1,this.resultMoney,()=>{
|
|
UserManager.addMoney(this.resultMoney)
|
|
PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(this.resultMoney,'1')}`)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_706)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_707)
|
|
|
|
this.showQiPao(ChadianConfig.chadianLog706[0],()=>{
|
|
this.showQiPao(ChadianConfig.chadianLog706[1],()=>{
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
});
|
|
});
|
|
})
|
|
})
|
|
|
|
}else if(mainId == MainTaskIdEnum.MainTask_1102){
|
|
PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu,null,(prefab)=>{
|
|
prefab.getComponent(TouZiXieYiShu).initView(2,this.resultMoney,()=>{
|
|
UserManager.addMoney(this.resultMoney)
|
|
PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(this.resultMoney,'1')}`)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1102)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1103)
|
|
this.showQiPao(ChadianConfig.chadianLog1102[0],()=>{
|
|
this.showQiPao(ChadianConfig.chadianLog1102[1],()=>{
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
});
|
|
});
|
|
})
|
|
})
|
|
|
|
}else if(mainId == MainTaskIdEnum.MainTask_1302){
|
|
|
|
PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu,null,(prefab)=>{
|
|
prefab.getComponent(TouZiXieYiShu).initView(3,this.resultMoney,()=>{
|
|
UserManager.addMoney(this.resultMoney)
|
|
PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(this.resultMoney,'1')}`)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1302)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1303)
|
|
this.showQiPao(ChadianConfig.chadianLog1302[0],()=>{
|
|
this.showQiPao(ChadianConfig.chadianLog1302[1],()=>{
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
});
|
|
});
|
|
})
|
|
})
|
|
}else if(mainId == MainTaskIdEnum.MainTask_1602){
|
|
|
|
PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu,null,(prefab)=>{
|
|
prefab.getComponent(TouZiXieYiShu).initView(4,this.resultMoney,()=>{
|
|
UserManager.addMoney(this.resultMoney)
|
|
PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(this.resultMoney,'1')}`)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1602)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1603)
|
|
this.showQiPao(ChadianConfig.chadianLog1602[0],()=>{
|
|
this.showQiPao(ChadianConfig.chadianLog1602[1],()=>{
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
});
|
|
});
|
|
})
|
|
})
|
|
}else if(mainId == MainTaskIdEnum.MainTask_1704){
|
|
|
|
PrefabManage.loadPrefabByType(GameType.TouZiXieYiShu,null,(prefab)=>{
|
|
prefab.getComponent(TouZiXieYiShu).initView(5,this.resultMoney,()=>{
|
|
UserManager.addMoney(this.resultMoney)
|
|
PrefabManage.showTextTips(`恭喜获得投资${Common5.getNumberChangeHanzi(this.resultMoney,'1')}`)
|
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_1704)
|
|
TaskManager.setCurUnLockMainTaskInfo(MainTaskIdEnum.MainTask_1705)
|
|
this.showQiPao(ChadianConfig.chadianLog1704[0],()=>{
|
|
this.showQiPao(ChadianConfig.chadianLog1704[1],()=>{
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
});
|
|
});
|
|
})
|
|
})
|
|
}
|
|
}
|
|
let restartCallFunc = ()=>{
|
|
this._dt = 0
|
|
this._anNiuDt = 0
|
|
this.isStartTime = false
|
|
this.isGameOver = false
|
|
this.allTime = 20
|
|
this.progressNum = 0
|
|
this.btnClickNum = 0
|
|
this.leftTimeStr.string = `${DateUtils.formatTime_custom(this.allTime)}`
|
|
this.changeProgress()
|
|
}
|
|
PrefabManage.loadPrefabByType(GameType.ChaoCaiResult,null,(prefab)=>{
|
|
prefab.getComponent(ChaoCaiResult).initView(ChaoCaiPropConfig[this.curGameId],resultIndex,finishCallFunc,restartCallFunc)
|
|
})
|
|
}
|
|
initItemContent(){
|
|
this.leftTimeStr.string = `${DateUtils.formatTime_custom(this.allTime)}`
|
|
let propIdArr = ChaoCaiPropConfig[this.curGameId].propIdArr
|
|
for(let i=0;i<propIdArr.length;i++){
|
|
let item = cc.instantiate(this.singleItem)
|
|
item.active = true
|
|
item.parent = this.itemLayout
|
|
|
|
let spFrame_hui = item.getChildByName('spFrame_hui')
|
|
let spFrame_liang = item.getChildByName('spFrame_liang')
|
|
// Common5.getSpriteFrameFromBundle("GoodIcon", 'icon/' + propIdArr[i], spFrame_hui.getComponent(cc.Sprite));
|
|
// Common5.getSpriteFrameFromBundle("GoodIcon", 'icon/' + propIdArr[i], spFrame_liang.getComponent(cc.Sprite));
|
|
Common5.setRemoteSpriteFrame(spFrame_hui.getComponent(cc.Sprite),'GoodIcon/'+ propIdArr[i])
|
|
Common5.setRemoteSpriteFrame(spFrame_liang.getComponent(cc.Sprite),'GoodIcon/'+ propIdArr[i])
|
|
let _pro = BagManager.getGoodsProperty(propIdArr[i])
|
|
item.getChildByName('nameStr').getComponent(cc.Label).string = _pro.goodName
|
|
|
|
if(BagManager.getBagGoodNums(propIdArr[i]) > 0){
|
|
spFrame_liang.active = true
|
|
spFrame_hui.active = false
|
|
}else{
|
|
this.isHaveAllProp = false
|
|
spFrame_liang.active = false
|
|
spFrame_hui.active = true
|
|
}
|
|
}
|
|
}
|
|
changeProgress(){
|
|
this.progressNode.getComponent(cc.ProgressBar).progress = this.progressNum
|
|
if(this.progressNum < 0.6){
|
|
this.progressNode.getChildByName('一般').active = true
|
|
this.progressNode.getChildByName('一般(灰)').active = false
|
|
this.progressNode.getChildByName('优秀').active = false
|
|
this.progressNode.getChildByName('优秀(灰)').active = true
|
|
this.progressNode.getChildByName('完美').active = false
|
|
this.progressNode.getChildByName('完美(灰)').active = true
|
|
}else if(this.progressNum < 0.8){
|
|
this.progressNode.getChildByName('一般').active = true
|
|
this.progressNode.getChildByName('一般(灰)').active = false
|
|
this.progressNode.getChildByName('优秀').active = true
|
|
this.progressNode.getChildByName('优秀(灰)').active = false
|
|
this.progressNode.getChildByName('完美').active = false
|
|
this.progressNode.getChildByName('完美(灰)').active = true
|
|
}else{
|
|
this.progressNode.getChildByName('一般').active = true
|
|
this.progressNode.getChildByName('一般(灰)').active = false
|
|
this.progressNode.getChildByName('优秀').active = true
|
|
this.progressNode.getChildByName('优秀(灰)').active = false
|
|
this.progressNode.getChildByName('完美').active = true
|
|
this.progressNode.getChildByName('完美(灰)').active = false
|
|
}
|
|
let guangNode = this.progressNode.getChildByName('进度条增长光')
|
|
guangNode.y = -279 + this.progressNum*558
|
|
}
|
|
onBtnFanChao(){
|
|
if(!this.isHaveAllProp){
|
|
PrefabManage.showTextTips('请先获得所有菜品')
|
|
return
|
|
}
|
|
if(this.isGameOver){
|
|
return
|
|
}
|
|
Common5.playEffectCustom('ChaoCai','sound/火焰')
|
|
this.isStartTime = true
|
|
if(this.progressNum <= 0.6){
|
|
this.progressNum += this.progressAddRate1
|
|
}else if(this.progressNum <= 0.8){
|
|
this.progressNum += this.progressAddRate2
|
|
}else{
|
|
this.progressNum += this.progressAddRate3
|
|
}
|
|
this._anNiuDt = 0
|
|
this.btnClickNum += 1
|
|
if(this.chaoFanSpine.getComponent(sp.Skeleton).animation == '静止'){
|
|
this.chaoFanSpine.getComponent(sp.Skeleton).animation = '炒'
|
|
this.huoSpine1.active = true
|
|
this.huoSpine2.active = true
|
|
}
|
|
}
|
|
|
|
//展示气泡
|
|
showQiPao(curLog, func?) {
|
|
|
|
console.log("curLog==", curLog)
|
|
if (!curLog) {
|
|
console.log("xxxxxx")
|
|
return;
|
|
}
|
|
let string_ = curLog.str
|
|
let qiPaoPos_ = curLog.qiPaoPos
|
|
|
|
|
|
if (qiPaoPos_ != -1) {
|
|
if (curLog.effectUrl && curLog.effectUrl.length > 0) {
|
|
Common5.playRemoteAudioEffect(curLog.effectUrl);
|
|
}
|
|
|
|
let node = this.node
|
|
let qiPao = node.getChildByName("qiPao").getChildByName("qiPao_" + qiPaoPos_);
|
|
qiPao.stopAllActions()
|
|
this.showDialogStr(string_,qiPao.getChildByName("str"))
|
|
// qiPao.getChildByName("str").getComponent(cc.Label).string = string_
|
|
qiPao.active = true
|
|
qiPao.scale = 0
|
|
cc.tween(qiPao)
|
|
.to(0.2, { scale: 1 })
|
|
.delay(curLog.delay)
|
|
.call(() => {
|
|
qiPao.active = false;
|
|
if (func) {
|
|
func();
|
|
}
|
|
})
|
|
.start();
|
|
}
|
|
else {
|
|
let qiPao = this.node.getChildByName("dh_qiPao")
|
|
qiPao.getComponent(JuQingQiPao).initView(curLog, func)
|
|
}
|
|
}
|
|
showDialogStr(str,dialogStr,finishFunc?){
|
|
let curStr = ""
|
|
let curIndex = 0
|
|
let callFunc = ()=>{
|
|
curStr += str[curIndex++]
|
|
dialogStr.getComponent(cc.Label).string = curStr
|
|
if(curIndex >= str.length){
|
|
finishFunc && finishFunc()
|
|
}
|
|
}
|
|
this.schedule( callFunc , 0.07,str.length-1)
|
|
}
|
|
onBtnHuoYuanTiaoZhuan(){
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
PrefabManage.loadPrefabByType(ChaoCaiPropConfig[this.curGameId].tiaoZhuanGameType)
|
|
}
|
|
}
|
|
|