123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116 |
- 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 >= 1500) {
- this.mask.y += 165;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- 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 >= 1500) {
- this.mask.y += 85;
- this.mask.y += (this.vsize.height - 1500)/2.0;
- }
- // 指示位置
- 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) {},
- });
|