const {SenceMap} = require("../utils/GameEnum"); var SenceManager = cc.Class({ extends: cc.Component, properties: { myInfoTop: cc.Node, myTabBottom: cc.Node, friendInfoTop: cc.Node, friendTabBottom: cc.Node, }, init (game) { this.game = game; this.levelHome = game.levelHome this.friendHome = game.friendHome this.userInfo = game.userInfo this.friendSystem = game.friendSystem this.breakOut = game.breakOut this.jobChange = game.jobChange this.finder = game.finder }, onLoad () { this.ctx = cc.find("Canvas"); }, start() { }, enterUserInfo (uid) { // this.ctx.getChildByName(SenceMap.LevelHome).active = true // Global.GameEvent.fire(NotiKey.ShowUserInfomation, uid); }, /** * 进入好友家园 * @param {Number} uid 用户id */ enterFriendHome (uid) { this.friendHome.initFriend(uid, 1, res => { let actionTop = cc.moveBy(0.4, cc.v2(0, -this.friendInfoTop.height)) this.friendInfoTop.runAction(actionTop) let actionBottom = cc.moveBy(0.4, cc.v2(0, this.friendTabBottom.height)) this.friendTabBottom.runAction(actionBottom) this.friendHome.node.active = true; }) }, /** * 离开好友家园 * @param {Number} uid 用户id */ outFriendHome (uid) { let actionTop = cc.moveBy(0.4, cc.v2(0, this.friendInfoTop.height)) this.friendInfoTop.runAction(actionTop) let actionBottom = cc.moveBy(0.4, cc.v2(0, -this.friendTabBottom.height)) this.friendTabBottom.runAction(actionBottom) this.friendHome.node.active = false; }, /** * 进入我的家园 */ enterLevelHome () { let actionTop = cc.moveBy(0.4, cc.v2(0, -this.myInfoTop.height)) this.myInfoTop.runAction(actionTop) let actionBottom = cc.moveBy(0.4, cc.v2(0, this.myTabBottom.height + 6)) this.myTabBottom.runAction(actionBottom) this.levelHome.node.active = true; }, /** * 离开我的家园 */ outLevelHome () { let actionTop = cc.moveBy(0.4, cc.v2(0, this.myInfoTop.height)) this.myInfoTop.runAction(actionTop) let actionBottom = cc.moveBy(0.4, cc.v2(0, -(this.myTabBottom.height + 6))) this.myTabBottom.runAction(actionBottom) }, enterSence (lastSenceName, senceName) { this.node.getChildByName(lastSenceName).active = false; this.node.getChildByName(senceName).active = true; switch (senceName) { case SenceMap.LevelHome: break; case SenceMap.UserPanel: break; case SenceMap.FriendSystem: break; case SenceMap.FriendHome: break; case SenceMap.BreakOut: break; case SenceMap.Finder: break; default: break; } }, }); module.exports.SenceManager = SenceManager;