1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114 |
- const Api = require('../net/Api');
- const { GameNotificationKey } = require("../utils/GameEnum");
- const GameModule = require("../utils/GameModule");
- const AlertManager = require("../utils/AlertManager");
- cc.Class({
- extends: cc.Component,
- properties: {
- guideText: cc.Label,
- dialog: cc.Node,
- finger: cc.Node,
- secretary: cc.Node,
- mask: cc.Node,
- maskBg: cc.Node,
- blockEvent: cc.Node
- },
- onLoad () {
- },
-
- init (game) {
- this.game = game
- this.homeSV = this.game.levelHome.scrollView // levelHome的scrollView组件
- this.vsize = cc.view.getVisibleSize()
- this.initEvent()
- this.stateRecord = {} //
- // AlertManager.showArtistOperationAlert()
- this.guideState = {
- state1 : {
- tips: '点击可以解锁房间噢!',
- pass: 0,
- mask: 1,
- rect: [328, 128],
- pos: [0, 10]
- },
- state2 : {
- tips: '点击可以收取金币~',
- pass: 0,
- mask: 1,
- rect: [60, 60],
- pos: [-140, -55]
- },
- state3 : {
- tips: '升级房间可以产出更多金币~',
- pass: 0,
- mask: 1,
- rect: [188, 72],
- pos: [207, -130]
- },
- state4 : {
- tips: '让我们开启更多的房间',
- pass: 0,
- mask: 1,
- rect: [328, 128],
- pos: [0, 0]
- },
- state5 : {
- tips: '涉猎更多的行业,为签约艺人做好准备~',
- pass: 0,
- mask: 1,
- rect: [328, 128],
- pos: [0, 0]
- },
- state6 : {
- tips: '看~我们已经解锁好友了~签约你的好友成为你的艺人,一起发展公司!',
- pass: 0,
- mask: 1,
- rect: [130, 130],
- pos: [-305, -720]
- },
- state7 : {
- tips: '派出你的星探签约好友~让Ta成为你的旗下艺人',
- pass: 0,
- mask: 1,
- rect: [240, 80],
- pos: [-168, -735]
- },
- state12 : {
- tips: '艺人不够怎么办?\n除了派出星探,还可以抢人~',
- pass: 0,
- mask: 1,
- rect: [0, 0],
- pos: [0, 0]
- },
- state13 : {
- tips: '点击全部好友',
- pass: 0,
- mask: 1,
- rect: [130, 130],
- pos: [-305, -720]
- },
- state14 : {
- tips: '艺人不够怎么办?\n点击这里抢夺的艺人',
- pass: 0,
- mask: 1,
- rect: [700, 190],
- pos: [0, 137]
- },
- state15 : {
- tips: '点击这里的抢夺',
- pass: 0,
- mask: 1,
- rect: [182, 72],
- pos: [-273, -368]
- },
- state16 : {
- tips: '点击确定就可以抢夺啦\n注意~抢夺有几率失败的噢',
- pass: 0,
- mask: 1,
- rect: [236, 80],
- pos: [132, -275]
- },
- state17 : {
- tips: '我们的艺人已经准备好啦\n让我们来把艺人入驻到房间内开始工作',
- pass: 0,
- mask: 1,
- rect: [0, 0],
- pos: [0, 0]
- },
- state18 : {
- tips: '点击房间旁的添加按钮',
- pass: 0,
- mask: 1,
- rect: [70, 70],
- pos: [-328, 42]
- },
- state19 : {
- tips: '选择这名艺人',
- pass: 0,
- mask: 1,
- rect: [640, 190],
- pos: [0, 100]
- },
- state20 : {
- tips: '点击确定就好啦~',
- pass: 0,
- mask: 1,
- rect: [240, 80],
- pos: [0, -740]
- },
- state21 : {
- tips: '看~这样就入驻好啦,\n艺人会帮你赚更多的钱\n有新的艺人不要忘记入驻哦',
- pass: 0,
- mask: 1,
- rect: [0, 0],
- pos: [0, 0]
- },
- state25 : {
- tips: '点击安抚',
- pass: 0,
- mask: 1,
- rect: [102, 87],
- pos: [-285, 15]
- },
- state26 : {
- tips: '选择互动事件',
- pass: 0,
- mask: 1,
- rect: [510, 80],
- pos: [0, -40]
- },
- state27 : {
- tips: '提醒你的好友一起互动\n可以获得更多的亲密度噢~',
- pass: 0,
- mask: 1,
- rect: [236, 80],
- pos: [0, -300]
- },
- state28 : {
- tips: '培养可以提高艺人的等级\n赚取更多的金币噢~',
- pass: 0,
- mask: 1,
- rect: [182, 72],
- pos: [273, -368]
- },
- state29 : {
- tips: '选择一个培养任务开始培养',
- pass: 0,
- mask: 1,
- rect: [176, 56],
- pos: [217, 147]
- },
- state30 : {
- tips: '很好,培养倒计时结束后记得来完成任务',
- pass: 0,
- mask: 1,
- rect: [720, 880],
- pos: [0, -142]
- },
- state31 : {
- tips: '守护可以保护自己的艺人\n不被他人抢走',
- pass: 0,
- mask: 1,
- rect: [102, 76],
- pos: [-290, -180]
- },
- state32 : {
- tips: '选择空的槽位',
- pass: 0,
- mask: 1,
- rect: [184, 244],
- pos: [-208, -110]
- },
- state33 : {
- tips: '将这张谈心卡装备上去吧~',
- pass: 0,
- mask: 1,
- rect: [136, 136],
- pos: [-225, 102]
- },
- state34 : {
- tips: '想要重点守护的艺人\n记得把槽位装满噢~',
- pass: 0,
- mask: 1,
- rect: [720, 542],
- pos: [0, -119]
- },
- state35 : {
- tips: '看~有别的艺人入驻我们的公司了,赶走他,抢掉Ta的收益~',
- pass: 0,
- mask: 1,
- rect: [0, 0],
- pos: [0, 0]
- },
- state36 : {
- tips: '抢走Ta的收益,这可是好大一笔钱呢!',
- pass: 0,
- mask: 1,
- rect: [240, 85],
- pos: [0, (this.vsize.height - 1624) / 2 - 115]
- },
- state37 : {
- tips: '点击装备',
- pass: 0,
- mask: 1,
- rect: [180, 54],
- pos: [-227, 250]
- },
- }
- this.syncStatePass()
- this.game.updateUIState(this.guideState)
- // this.guideState.state17.pass = 0
- // this.guideState.state18.pass = 0
- // this.guideState.state19.pass = 0
- // this.guideState.state20.pass = 0
- // this.guideState.state21.pass = 0
- // For Test: state4
- // this.handleState('state17')
- },
- /**
- * 同步用户guideState
- */
- syncStatePass () {
- let _guideState = window.guideState
- // let _guideState = cc.sys.localStorage.getItem('guideState');
- if(!!_guideState) {
- for(let i in _guideState) {
- if(this.guideState[i]) {
- this.guideState[i].pass = _guideState[i]
- }
- }
- } else {
- let _guideState = Object.assign({}, this.guideState)
- this.uploadUserState(_guideState)
- }
- },
- /**
- * 上报用户guideState
- * @param {Object} stateObj guideState对象
- */
- uploadUserState (stateObj) {
- for(let i in stateObj) {
- stateObj[i] = stateObj[i].pass
- }
- let stateStr = JSON.stringify(stateObj)
- // cc.sys.localStorage.setItem('guideState', stateStr)
- // 上报用户数据
- Api.httpPost({
- url: "/direct/add.do",
- data: {
- directJson: stateStr
- },
- success: res => {
- }
- })
- },
- initEvent() {
- this.mask.on(cc.Node.EventType.TOUCH_END, () => {
- this.homeSV.vertical = true
- if(this.curState == 'state6') {
- // state6 结束后直接跳到 state7
- this.handlePass(this.curState)
- this.handleState('state7')
- } else if(this.curState == 'state7') {
- this.handlePass(this.curState)
- // state7 点击后显示邀请好友弹窗
- this.game.friendSystem.showTalent()
- } else if(this.curState == 'state13') {
- // state13 结束后直接跳到 state14
- this.handlePass(this.curState)
- setTimeout(() => {
- this.handleState('state14')
- }, 300)
- } else if(this.curState == 'state14') {
- // 跳转userinfo界面
- if(this.guideState.state14.uid) {
- this.game.gameFSM.showuserinfo(this.guideState.state14.uid)
- }
- this.handlePass(this.curState)
- } else if(this.curState == 'state18') {
- this.handleGuideState18()
- this.handlePass(this.curState)
- setTimeout(() => {
- this.handleState('state19')
- }, 300)
- } else if(this.curState == 'state19') {
- let cnode = cc.find('Canvas/artist_resident')
- cnode = cnode.getComponent('ArtistResident')
- cnode.guide()
- this.curState = null
- this.handleState('state20')
- } else if(this.curState == 'state20') {
- let cnode = cc.find('Canvas/artist_resident')
- cnode = cnode.getComponent('ArtistResident')
- cnode.confirm()
- this.curState = null
- this.handleState('state21')
- } else if(!!this.curState) {
- // 其他state的操作处理,触发在此节点上的自定义事件
- this.node.emit(`Fire_${this.curState}`)
- this.handlePass(this.curState)
- }
- }, this)
- },
- /**
- * 设置手指指示位置
- * @param {Number} x mask的x坐标
- * @param {Number} y mask的y坐标
- */
- setFingerPos (x, y) {
- this.finger.active = true;
- let offsetY = 20
- // 手指当前位置 = mask矩形位置的右下角 + 偏移量
- this.finger.x = x
- this.finger.y = y - this.finger.height / 2
- let actionUp = cc.moveBy(0.5, 0, offsetY)
- let actionDown = cc.moveBy(0.5, 0, -offsetY)
- let seq = cc.repeatForever(cc.sequence(actionUp, actionDown))
- this.finger.runAction(seq)
- },
- //隐藏指示点击手指,部分引导不需要
- hideFinger () {
- this.finger.active = false;
- this.finger.stopAllActions();
- },
- /**
- * 显示遮罩层
- */
- showMask () {
- let target = this.guideState[this.curState]
- this.maskBg.active = !!target.mask
- this.mask.active = true
- this.mask.width = target.rect[0]
- this.mask.height = target.rect[1]
- this.mask.x = target.pos[0]
- this.mask.y = (1624 - this.vsize.height) / 2 + target.pos[1]
- },
- /**
- * levelhome 的 scrollView 组件滚动到底部
- * 某些任务状态下必须 [state1, state2, state3]
- */
- scrollToBottom () {
- this.homeSV.scrollToBottom(0)
- },
- /**
- * 显示秘书人物内容
- * @param {Number} offsetY 显示节点的Y轴偏移量,默认为0
- */
- showSecretary (offsetY = 0) {
- let targetX = this.secretary.width / 2 - this.vsize.width / 2
- let secretaryY = this.secretary.height / 2 - this.vsize.height / 2 + offsetY
- this.secretary.x = -this.vsize.width
- this.secretary.y = secretaryY
- this.secretary.active = true
-
- let action1 = cc.moveTo(0.4, targetX, secretaryY)
- this.secretary.runAction(action1)
- },
- /**
- * 显示对话框内容
- * @param {Number} offsetY 显示节点的Y轴偏移量,默认为0
- */
- showDialog (offsetY = 0) {
- let target = this.guideState[this.curState]
- let targetX = this.secretary.width / 2 - this.vsize.width / 2
- let dialogY = this.dialog.height / 2 - this.vsize.height / 2 + 250 + offsetY
- this.dialog.x = this.vsize.width
- this.dialog.y = dialogY
- this.dialog.active = true
- let action2 = cc.moveTo(0.5, targetX + this.secretary.width, dialogY)
- this.dialog.runAction(action2)
- this.guideText.string = target.tips
- },
- /**
- * 根据状态key显示对应引导内容
- * @param {String} state 当前状态key
- */
- handleState (state) {
- if(this.stateRecord[state] || this.curState != null) {
- return
- } else {
- this.stateRecord[state] = true
- }
- if(state && !this.guideState[state].pass) {
-
- if(this.guideState[state]) {
- this.node.active = true
- this.curState = state
- this.guideState[state].pass = 1
- let stateClone = Object.assign({}, this.guideState)
- // 显示引导之后立即上报同步对应state数据
- this.uploadUserState(stateClone)
- } else {
- return
- }
- console.log("Show " + state);
- switch (state) {
- case 'state1': {
- // 滚动到底部
- this.scrollToBottom()
- setTimeout(() => {
- // 遮罩区域
- this.showMask()
-
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
-
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y)
- }, 50);
- break;
- }
- case 'state2' : {
- // 滚动到底部
- this.scrollToBottom()
- this.homeSV.vertical = false
- setTimeout(() => {
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width, this.mask.y)
- }, 50)
- break;
- }
- case 'state3' : {
- // 滚动到底部
- this.scrollToBottom()
- this.homeSV.vertical = false
- setTimeout(() => {
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y)
- }, 50)
- break;
- }
- case 'state4' : {
- let maxScrollOffset = this.homeSV.getMaxScrollOffset() // scrollView组件最大偏移量
- let itemH = 340 // 每一层的高度
- let offsetY = maxScrollOffset.y - itemH
- this.homeSV.scrollToOffset(cc.v2(0, offsetY), 0.2)
- setTimeout(() => {
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y)
- }, 50)
- break;
- }
- case 'state5' : {
- let maxScrollOffset = this.homeSV.getMaxScrollOffset() // scrollView组件最大偏移量
- let itemH = 340 * 2 - 10
- let offsetY = maxScrollOffset.y - itemH
- this.homeSV.scrollToOffset(cc.v2(0, offsetY), 0.2)
-
- setTimeout(() => {
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y)
- }, 50)
- break;
- }
- case 'state6' : {
- this.game.updateUIState(this.guideState)
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary(250)
-
- // 对话框
- this.showDialog(250)
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y)
- break;
- }
- case 'state7' : {
- this.game._showFriendSystem()
- setTimeout(() => {
- // 遮罩区域
- this.showMask()
-
- // 秘书人物
- this.showSecretary(200)
-
- // 对话框
- this.showDialog(200)
-
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y)
- }, 50)
- break;
- }
- case 'state12' : {
- this.game.friendSystem.close()
- this.dialog.once(cc.Node.EventType.TOUCH_END, () => {
- this.handlePass()
- this.handleState('state13')
- })
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary(250)
-
- // 对话框
- this.showDialog(250)
- this.hideFinger()
- break;
- }
- case 'state13' : {
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary(250);
-
- // 对话框
- this.showDialog(250);
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- }
- case 'state14' : {
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
- // 指示位置
- this.setFingerPos(this.mask.x, this.mask.y)
- break;
- }
- case 'state15':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1624) {
- this.mask.y += 238;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state16':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1624) {
- this.mask.y += 146;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state17': {
- this.game.friendSystem.close()
- if(this.game.userInfo) {
- this.game.userInfo.closeInformationAction()
- }
- this.dialog.once(cc.Node.EventType.TOUCH_END, () => {
- this.handlePass()
- setTimeout(() => {
- this.handleState('state18')
- }, 300);
- })
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
- this.hideFinger()
- break;
- }
- case 'state18': {
- let index = 4 - this.state18data.index
- let maxScrollOffset = this.homeSV.getMaxScrollOffset() // scrollView组件最大偏移量
- let itemH = 333 * index
- let offsetY = maxScrollOffset.y - itemH
- this.homeSV.scrollToOffset(cc.v2(0, offsetY), 0.3)
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary()
-
- // 对话框
- this.showDialog()
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width, this.mask.y);
- break;
- }
- case 'state19': {
- // 遮罩区域
- this.showMask()
- // 秘书人物
- this.showSecretary(250)
-
- // 对话框
- this.showDialog(250)
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- }
- case 'state20': {
- // 遮罩区域
- this.showMask()
- // 对话框
- this.showDialog(250)
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- }
- case 'state21': {
- this.dialog.once(cc.Node.EventType.TOUCH_END, () => {
- this.handleEnd()
- })
- // 遮罩区域
- this.showMask()
- // 对话框
- this.showDialog(250)
- // 指示位置
- this.hideFinger()
- break;
- }
- case 'state25':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state26':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 83;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state27':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 84;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state28':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 178;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state29':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 84;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state30':
- // 遮罩区域
- this.showMask();
- if (this.vsize.height >= 1500) {
- this.mask.y += 83;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- this.hideFinger ();
- break;
- case 'state31':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 176;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state32':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 86;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state33':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 164;
- this.mask.y += this.vsize.height - 1500;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state34':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 83;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- this.hideFinger ();
- break;
- case 'state35':
- this.dialog.once(cc.Node.EventType.TOUCH_END, () => {
- this.handlePass(this.curState)
- this.node.emit(`Fire_state35`)
- })
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- this.hideFinger ();
- break;
- case 'state36':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- case 'state37':
- // 遮罩区域
- this.showMask();
- // 秘书人物
- this.showSecretary();
- // 对话框
- this.showDialog();
- if (this.vsize.height >= 1500) {
- this.mask.y += 167;
- this.mask.y += this.vsize.height - 1500;
- }
- // 指示位置
- this.setFingerPos(this.mask.x + this.mask.width / 2, this.mask.y);
- break;
- default:
- break;
- }
- return true
- } else {
- // return false
- }
- },
- /**
- * 隐藏遮罩半透明层
- */
- hideMask () {
- this.maskBg.active = false
- },
- /**
- * 已完成某一State,并上报
- *
- */
- handlePass (state) {
- let stateClone = Object.assign({}, this.guideState)
- this.game.updateUIState(stateClone)
- this.curState = null
- this.handleEnd()
- },
- handleEnd () {
- this.mask.active = false
- this.secretary.x = -700
- this.secretary.active = false
- this.dialog.x = 870
- this.dialog.active = false
- this.node.active = false
- this.finger.stopAllActions()
- },
- /**
- * 【特殊处理】开启好友功能引导
- */
- handleGuideState6 () {
- if(this.guideState.state5.pass) {
- this.handleState('state6')
- }
- },
- /**
- * 【特殊处理】抢夺好友引导
- * @param {Array} list 好友列表数组
- */
- handleGuideState14 (list) {
- // 好友数量大于0,同时已经完成了state7,触发抢夺好友引导state14
- if(list && list.length > 0 && this.guideState.state7.pass) {
- // 如果好友列表第一个为老板,则需要再判断除老板以外的好友
- if(list[0].role == 1) {
- if(list.length >= 2) {
- this.guideState.state14.pos = [0, -53]
- this.guideState.state14.uid = list[1].uid
- this.handleState('state14')
- }
- } else {
- // 如果好友列表第一个不是老板,则直接显示引导好友列表第一条
- this.guideState.state14.uid = list[0].uid
- this.handleState('state14')
- }
- }
- },
- /**
- * 【特殊处理】艺人入驻引导-17
- * @param {Array} list 艺人列表数组
- */
- handleGuideState17 (list) {
- let result = null
- list.forEach(n => {
- if(n.role == 2 && n.jobId && result == null) {
- result = {
- jobId: n.jobId
- }
- }
- })
- let unlockCount = 0
- this.game.levelHome.buildingInfos.forEach(n => {
- unlockCount += parseInt(n.isUnlocked)
- })
- // 拥有一名可入驻的艺人,
- // 同时已解锁5层建筑,
- // 同时已经完成了state16,
- // 触发抢夺好友引导state17
- if(result != null && this.guideState.state16.pass && unlockCount == 5) {
- // 遍历查找jobId对应的buildingInfo
- this.game.levelHome.buildingInfos.forEach((item, index) => {
- if(item.jobId == result.jobId) {
- result = Object.assign({index: index}, item)
- }
- })
- this.state18data = result
- this.handleState('state17')
- }
- },
-
- /**
- * 【特殊处理】艺人入驻引导-18
- */
- handleGuideState18 () {
- if(this.state18data) {
- let uid = parseInt(Global.user.uid)
- AlertManager.showArtistResident(this.state18data, uid, true);
- }
- },
- /**
- * 【特殊处理】判断当前引导结束后才执行下一个引导
- */
- handleGuideStateNext(current, next) {
- if (this.guideState[current].pass) {
- this.handleState(next);
- }
- },
- /**
- * 【特殊处理】培养和守护都完成后才触发互动引导
- */
- handleGuideState25 () {
- if (this.guideState.state28.pass && this.guideState.state31.pass) {
- this.handleState('state25');
- }
- },
- start () {
- },
- // update (dt) {},
- });
|