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.
708 lines
35 KiB
708 lines
35 KiB
2 months ago
|
|
||
|
import { ryw_Event } from "../../../FrameWork/Event/EventEnum";
|
||
|
import EventMgr from "../../../FrameWork/Event/EventMgr";
|
||
|
import User from "../../../FrameWork/User/User";
|
||
|
import { DateUtils } from "../../../FrameWork/Util/DateUtils";
|
||
|
import Common5 from "../../../Platform/th/Common5";
|
||
|
import renZheng from "../../DH/renZheng";
|
||
|
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 NewGuideScript from "../../NewGuide/NewGuideScript";
|
||
|
import PrefabManage, { GameType } from "../../PrefabManager/PrefabManage";
|
||
|
import GameBase from "../../SCommon/GameBase";
|
||
|
import TouZiXieYiShu from "../TouZiXieYiShu/TouZiXieYiShu";
|
||
|
import ChaoCaiResult from "./ChaoCaiResult";
|
||
|
|
||
|
let ChadianConfig = {
|
||
|
chadianLog512: [
|
||
|
{
|
||
|
str: "制作面点需要先获取食材哦!",
|
||
|
qiPaoPos: 0,
|
||
|
delay: 2.2,
|
||
|
effectUrl: "DH/MainHall/sound/制作面点需要先获取食材哦!"
|
||
|
}
|
||
|
],
|
||
|
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:[3701,3702,3703],caiGuan:'湘菜馆',caiMing:'海鲜拉面',touZiMoney:[150000,200000,250000],jianZaoMoney:150000,huoYuan:'钓鱼场',tiaoZhuanGameType:GameType.HJHA,personInfo:[
|
||
|
// {bundleName:'Room3',url:'spine/坐姿',skin:'浴袍',animation:'待机'}
|
||
|
// ]},
|
||
|
// {gameId:1,propIdArr:[3704,3705,3706,3707,3708],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:[3709,3710,3711,3712,3713,3714],caiGuan:'苏菜馆',caiMing:'霸王别姬',touZiMoney:[1800000,2300000,2800000],jianZaoMoney:5000000,huoYuan:'食品回收',tiaoZhuanGameType:GameType.ShiCaiHuiShou,personInfo:[
|
||
|
// {bundleName:'Room11',url:'spine/坐姿',skin:'default',animation:'待机'}
|
||
|
// ]},
|
||
|
// {gameId:3,propIdArr:[3715,3716,3717,3718,3719,3720,3721],caiGuan:'徽菜馆',caiMing:'徽州一品鲜',touZiMoney:[10000000,12000000,15000000],jianZaoMoney:28000000,huoYuan:'食品回收',tiaoZhuanGameType:GameType.ShiCaiHuiShou,personInfo:[
|
||
|
// {bundleName:'Room13',url:'spine/坐姿',skin:'default',animation:'待机'}
|
||
|
// ]},
|
||
|
// {gameId:4,propIdArr:[3722,3723,3724,3725,3726,3727,3728,3729],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'}
|
||
|
// ]},
|
||
|
|
||
|
{
|
||
|
gameId: 0, propIdArr: [3701, 3702, 3703], caiGuan: '湘菜馆', caiMing: '海鲜拉面', touZiMoney: [150000, 200000, 250000], jianZaoMoney: 150000, huoYuan: '钓鱼场', tiaoZhuanGameType: GameType.HJHA, personInfo: [
|
||
|
{ bundleName: 'Room3', url: 'spine/坐姿', skin: '浴袍', animation: '待机' }
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
gameId: 1, propIdArr: [3704, 3705, 3706, 3707, 3708], caiGuan: '川菜馆', caiMing: '鲜肉馄饨', touZiMoney: [240000, 320000, 400000], jianZaoMoney: 800000, huoYuan: '后山', tiaoZhuanGameType: GameType.XiuXianNongZhuang, personInfo: [
|
||
|
{ bundleName: 'Room7', url: 'spine/投资人坐姿', skin: 'default', animation: '待机' }, { bundleName: 'Room7', url: 'spine/师妹坐姿', skin: 'default', animation: '待机' }
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
gameId: 2, propIdArr: [3709, 3710, 3711, 3712, 3713, 3714], caiGuan: '苏菜馆', caiMing: '三鲜饺子', touZiMoney: [1800000, 2300000, 2800000], jianZaoMoney: 5000000, huoYuan: '农贸市场', tiaoZhuanGameType: GameType.ShiCaiHuiShou, personInfo: [
|
||
|
{ bundleName: 'Room11', url: 'spine/坐姿', skin: 'default', animation: '待机' }
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
gameId: 3, propIdArr: [3715, 3716, 3717, 3718, 3719, 3720, 3721], caiGuan: '徽菜馆', caiMing: '多味茶酥', touZiMoney: [10000000, 12000000, 15000000], jianZaoMoney: 28000000, huoYuan: '茶场', tiaoZhuanGameType: GameType.ChaChang, personInfo: [
|
||
|
{ bundleName: 'Room13', url: 'spine/坐姿', skin: 'default', animation: '待机' }
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
gameId: 4, propIdArr: [3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729], caiGuan: '浙菜馆', caiMing: '鲜花饼', touZiMoney: [20000000, 30000000, 40000000], jianZaoMoney: 100000000, huoYuan: '花卉基地', tiaoZhuanGameType: GameType.BaiCaoJi, personInfo: [
|
||
|
{ bundleName: 'Room16', url: 'spine/坐姿', skin: 'default', 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
|
||
|
chushiXieHuiConfig: any;
|
||
|
clickTimeOutEvent = null;
|
||
|
spineClick: number = 0;
|
||
|
|
||
|
onLoad() {
|
||
|
super.onLoad()
|
||
|
|
||
|
// GameBaseScript.preLoadRemoteAudio(ChadianConfig);
|
||
|
}
|
||
|
|
||
|
protected start() {
|
||
|
EventMgr.onEvent_custom(ryw_Event.ExitBtnEvent, () => {
|
||
|
this.isHaveAllProp = true
|
||
|
this.initView(this.chushiXieHuiConfig)
|
||
|
}, this)
|
||
|
}
|
||
|
|
||
|
|
||
|
initView(config) {
|
||
|
this.chushiXieHuiConfig = config
|
||
|
if (config.configId == 0) {
|
||
|
this.curGameId = 0
|
||
|
} else if (config.configId == 2) {
|
||
|
this.curGameId = 1
|
||
|
} else if (config.configId == 3) {
|
||
|
this.curGameId = 2
|
||
|
} else if (config.configId == 5) {
|
||
|
this.curGameId = 3
|
||
|
} else if (config.configId == 7) {
|
||
|
this.curGameId = 4
|
||
|
}
|
||
|
let gameId = this.curGameId
|
||
|
|
||
|
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))
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
|
||
|
// Config = [
|
||
|
// { configId: 0, icon: 'res/三级面点师', isNeedAd: false, descLab: '三级面点师', miaoshu: '等级:300', moneystr: 8000000000, dengji: 300, goodids: [] },
|
||
|
// { configId: 1, icon: 'res/厨神', isNeedAd: false, descLab: '协会会员', miaoshu: '等级:400', moneystr: 400000000000, dengji: 400 },
|
||
|
// { configId: 2, icon: 'res/二级面点师', isNeedAd: false, descLab: '二级面点师', miaoshu: '等级:600', moneystr: 100000000000000, dengji: 600 },
|
||
|
// { configId: 3, icon: 'res/一级面点师', isNeedAd: false, descLab: '一级面点师', miaoshu: '等级:900', moneystr: 1000000000000000000, dengji: 900 },
|
||
|
// { configId: 4, icon: 'res/厨神', isNeedAd: false, descLab: '协会副会长', miaoshu: '等级:1000', moneystr: 6000000000000000000, dengji: 1000 },
|
||
|
// { configId: 5, icon: 'res/特一级面点师', isNeedAd: false, descLab: '特一级面点师', miaoshu: '等级:1200', moneystr: 4000000000000000000000, dengji: 1200, isShenQing: true },
|
||
|
// { configId: 6, icon: 'res/厨神', isNeedAd: false, descLab: '厨神', miaoshu: '等级:1500', moneystr: 2000000000000000000000000000, dengji: 1500, ganxiezhi: 50, isShenQing: true },
|
||
|
// { configId: 7, icon: 'res/厨神', isNeedAd: false, descLab: '协会会长', miaoshu: '等级:1400', moneystr: 200000000000000000000000, dengji: 1400, ganxiezhi: 100, isShenQing: true },
|
||
|
// ]
|
||
|
let node = this.node.getChildByName("认证气泡")
|
||
|
if (gameId == 0) {
|
||
|
node.getChildByName("lab1").getComponent(cc.Label).string = `认证三级面点师:`
|
||
|
node.getChildByName("lab2").getComponent(cc.Label).string = `制作达到优秀品质的${ChaoCaiPropConfig[this.curGameId].caiMing}`
|
||
|
} else if (gameId == 1) {
|
||
|
node.getChildByName("lab1").getComponent(cc.Label).string = `认证二级面点师:`
|
||
|
node.getChildByName("lab2").getComponent(cc.Label).string = `制作达到优秀品质的${ChaoCaiPropConfig[this.curGameId].caiMing}`
|
||
|
} else if (gameId == 2) {
|
||
|
node.getChildByName("lab1").getComponent(cc.Label).string = `认证一级面点师:`
|
||
|
node.getChildByName("lab2").getComponent(cc.Label).string = `制作达到优秀品质的${ChaoCaiPropConfig[this.curGameId].caiMing}`
|
||
|
} else if (gameId == 3) {
|
||
|
node.getChildByName("lab1").getComponent(cc.Label).string = `认证特一级面点师:`
|
||
|
node.getChildByName("lab2").getComponent(cc.Label).string = `制作达到优秀品质的${ChaoCaiPropConfig[this.curGameId].caiMing}`
|
||
|
} else if (gameId == 4) {
|
||
|
node.getChildByName("lab1").getComponent(cc.Label).string = `认证厨神:`
|
||
|
node.getChildByName("lab2").getComponent(cc.Label).string = `制作达到优秀品质的${ChaoCaiPropConfig[this.curGameId].caiMing}`
|
||
|
}
|
||
|
|
||
|
let isNeedGuide = cc.sys.localStorage.getItem("货源引导") ?? 0
|
||
|
if (TaskManager.getCurUnLockMainTaskId() == MainTaskIdEnum.MainTask_512 && !isNeedGuide) {
|
||
|
cc.sys.localStorage.setItem("货源引导", "1")
|
||
|
this.showQiPao(ChadianConfig.chadianLog512[0], () => {
|
||
|
|
||
|
});
|
||
|
let node = this.node.getChildByName('huanYuanNode')
|
||
|
this.guideView([node], 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_512 && ChaoCaiPropConfig[this.curGameId].caiMing == "海鲜拉面") {
|
||
|
let level = User.getChuShiXieHuiLevel()
|
||
|
level[0] = 1
|
||
|
User.setChuShiXieHuiLevel(level)
|
||
|
let lastConfig = TaskManager.getTaskConfigById(MainTaskIdEnum.MainTask_511)
|
||
|
if (lastConfig && lastConfig.taskNum) {
|
||
|
UserManager.subMoney(lastConfig.taskNum)
|
||
|
}
|
||
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_512)
|
||
|
TaskManager.setCurTask(MainTaskIdEnum.MainTask_513)
|
||
|
User.setFirstStepIndex(1103)
|
||
|
} else if (mainId == MainTaskIdEnum.MainTask_528 && ChaoCaiPropConfig[this.curGameId].caiMing == "鲜肉馄饨") {
|
||
|
let level = User.getChuShiXieHuiLevel()
|
||
|
level[2] = 1
|
||
|
User.setChuShiXieHuiLevel(level)
|
||
|
let lastConfig = TaskManager.getTaskConfigById(MainTaskIdEnum.MainTask_527_2)
|
||
|
if (lastConfig && lastConfig.taskNum) {
|
||
|
UserManager.subMoney(lastConfig.taskNum)
|
||
|
}
|
||
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_528)
|
||
|
TaskManager.setCurTask(MainTaskIdEnum.MainTask_529)
|
||
|
} else if (mainId == MainTaskIdEnum.MainTask_537 && ChaoCaiPropConfig[this.curGameId].caiMing == "三鲜饺子") {
|
||
|
let level = User.getChuShiXieHuiLevel()
|
||
|
level[3] = 1
|
||
|
User.setChuShiXieHuiLevel(level)
|
||
|
let lastConfig = TaskManager.getTaskConfigById(MainTaskIdEnum.MainTask_536)
|
||
|
if (lastConfig && lastConfig.taskNum) {
|
||
|
UserManager.subMoney(lastConfig.taskNum)
|
||
|
}
|
||
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_537)
|
||
|
TaskManager.setCurTask(MainTaskIdEnum.MainTask_538)
|
||
|
} else if (mainId == MainTaskIdEnum.MainTask_548 && ChaoCaiPropConfig[this.curGameId].caiMing == "多味茶酥") {
|
||
|
let level = User.getChuShiXieHuiLevel()
|
||
|
level[5] = 1
|
||
|
User.setChuShiXieHuiLevel(level)
|
||
|
let lastConfig = TaskManager.getTaskConfigById(MainTaskIdEnum.MainTask_547_2)
|
||
|
if (lastConfig && lastConfig.taskNum) {
|
||
|
UserManager.subMoney(lastConfig.taskNum)
|
||
|
}
|
||
|
TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_548)
|
||
|
TaskManager.setCurTask(MainTaskIdEnum.MainTask_549)
|
||
|
} else if (mainId == MainTaskIdEnum.MainTask_555 && ChaoCaiPropConfig[this.curGameId].caiMing == "鲜花饼") {
|
||
|
// let level = User.getChuShiXieHuiLevel()
|
||
|
// level[4] = 1
|
||
|
// User.setChuShiXieHuiLevel(level)
|
||
|
PrefabManage.showBlackGuoDu(() => {
|
||
|
PrefabManage.loadPrefabByType(GameType.DH_43)
|
||
|
this.node.removeFromParent()
|
||
|
this.node.destroy()
|
||
|
EventMgr.emitEvent_custom(ryw_Event.ExitBtnEvent, '');
|
||
|
})
|
||
|
// TaskManager.finishCurMainTask(MainTaskIdEnum.MainTask_548)
|
||
|
// TaskManager.setCurTask(MainTaskIdEnum.MainTask_549)
|
||
|
}
|
||
|
// 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.renZheng, null, (prefab) => {
|
||
|
prefab.getComponent(renZheng).showResult(this.curGameId, resultIndex, finishCallFunc, restartCallFunc)
|
||
|
})
|
||
|
// 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
|
||
|
this.itemLayout.removeAllChildren()
|
||
|
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/texture/icon/' + propIdArr[i])
|
||
|
Common5.setRemoteSpriteFrame(spFrame_liang.getComponent(cc.Sprite), 'GoodIcon/texture/icon/' + 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
|
||
|
item.getChildByName('nameStr').color = cc.color(250, 167, 29)
|
||
|
item.getChildByName('nameStr').getComponent(cc.LabelOutline).enabled = true
|
||
|
} else {
|
||
|
this.isHaveAllProp = false
|
||
|
spFrame_liang.active = false
|
||
|
spFrame_hui.active = true
|
||
|
item.getChildByName('nameStr').color = cc.Color.BLACK
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
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 = -356 + this.progressNum * 731
|
||
|
}
|
||
|
onBtnFanChao() {
|
||
|
if (!this.isHaveAllProp) {
|
||
|
PrefabManage.showTextTips('请先获得所有食材')
|
||
|
return
|
||
|
}
|
||
|
if (this.isGameOver) {
|
||
|
return
|
||
|
}
|
||
|
clearTimeout(this.clickTimeOutEvent);
|
||
|
let node = this.node.getChildByName('翻炒按钮')
|
||
|
// this.guideView([node], 0)
|
||
|
// node.getChildByName("tiptext").active = true
|
||
|
// Common5.playRemoteAudioEffect('remotesound/effect/点点点-单次')
|
||
|
//播放动画
|
||
|
this.spineClick++
|
||
|
if (this.spineClick == 1) {
|
||
|
// Common5.playRemoteAudioEffect('sound/单次点击')
|
||
|
// if (this.m_soundName != 'effect/点点点-连续') {
|
||
|
// this.m_soundName = 'effect/点点点-连续'
|
||
|
cc.audioEngine.stopAllEffects()
|
||
|
Common5.playRemoteAudioEffect('remotesound/effect/点点点-连续', true)
|
||
|
// }
|
||
|
}
|
||
|
|
||
|
this.clickTimeOutEvent = setTimeout(() => {
|
||
|
this.spineClick = 0
|
||
|
cc.audioEngine.stopAllEffects();
|
||
|
}, 1000);
|
||
|
// 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)
|
||
|
}
|
||
|
|
||
|
guideView(nodeArray, opacity = -1) {
|
||
|
PrefabManage.loadPrefabByType(GameType.GuideMskNode, null, (prefab) => {
|
||
|
// prefab.zIndex = 199
|
||
|
let guideNodeArray = nodeArray
|
||
|
let firstNode = guideNodeArray.shift()
|
||
|
prefab.getComponent(NewGuideScript).setBindNode(firstNode, guideNodeArray)
|
||
|
if (opacity != -1) {
|
||
|
prefab.getComponent(NewGuideScript).setOpacityMaskNode(opacity)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|