SenceManager.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. const { SenceMap } = require("../utils/GameEnum");
  2. var SenceManager = cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. myInfoTop: cc.Node,
  6. myTabBottom: cc.Node,
  7. friendInfoTop: cc.Node,
  8. friendTabBottom: cc.Node,
  9. },
  10. init(game) {
  11. this.game = game;
  12. this.levelHome = game.levelHome
  13. this.friendHome = game.friendHome
  14. this.userInfo = game.userInfo
  15. this.friendSystem = game.friendSystem
  16. this.breakOut = game.breakOut
  17. this.jobChange = game.jobChange
  18. this.finder = game.finder
  19. },
  20. onLoad() {
  21. this.ctx = cc.find("Canvas");
  22. },
  23. start() {
  24. },
  25. enterUserInfo(uid) {
  26. // this.ctx.getChildByName(SenceMap.LevelHome).active = true
  27. // GameEvent.fire(NotiKey.ShowUserInfomation, uid);
  28. },
  29. /**
  30. * 进入好友家园
  31. * @param {Number} uid 用户id
  32. */
  33. enterFriendHome(uid) {
  34. this.friendHome.initFriend(uid, res => {
  35. let actionTop = cc.moveBy(0.4, cc.v2(0, -this.friendInfoTop.height))
  36. this.friendInfoTop.runAction(actionTop)
  37. let actionBottom = cc.moveBy(0.4, cc.v2(0, this.friendTabBottom.height))
  38. this.friendTabBottom.runAction(actionBottom)
  39. this.friendHome.node.active = true;
  40. })
  41. },
  42. /**
  43. * 离开好友家园
  44. * @param {Number} uid 用户id
  45. */
  46. outFriendHome(uid) {
  47. let actionTop = cc.moveBy(0.4, cc.v2(0, this.friendInfoTop.height))
  48. this.friendInfoTop.runAction(actionTop)
  49. let actionBottom = cc.moveBy(0.4, cc.v2(0, -this.friendTabBottom.height))
  50. this.friendTabBottom.runAction(actionBottom)
  51. this.friendHome.node.active = false;
  52. },
  53. /**
  54. * 进入我的家园
  55. */
  56. enterLevelHome() {
  57. let actionTop = cc.moveBy(0.4, cc.v2(0, -this.myInfoTop.height))
  58. this.myInfoTop.runAction(actionTop)
  59. let actionBottom = cc.moveBy(0.4, cc.v2(0, this.myTabBottom.height + 6))
  60. this.myTabBottom.runAction(actionBottom)
  61. this.levelHome.node.active = true;
  62. },
  63. /**
  64. * 离开我的家园
  65. */
  66. outLevelHome() {
  67. let actionTop = cc.moveBy(0.4, cc.v2(0, this.myInfoTop.height))
  68. this.myInfoTop.runAction(actionTop)
  69. let actionBottom = cc.moveBy(0.4, cc.v2(0, -(this.myTabBottom.height + 6)))
  70. this.myTabBottom.runAction(actionBottom)
  71. },
  72. enterSence(lastSenceName, senceName) {
  73. this.node.getChildByName(lastSenceName).active = false;
  74. this.node.getChildByName(senceName).active = true;
  75. switch (senceName) {
  76. case SenceMap.LevelHome:
  77. break;
  78. case SenceMap.UserPanel:
  79. break;
  80. case SenceMap.FriendSystem:
  81. break;
  82. case SenceMap.FriendHome:
  83. break;
  84. case SenceMap.BreakOut:
  85. break;
  86. case SenceMap.Finder:
  87. break;
  88. default:
  89. break;
  90. }
  91. },
  92. });
  93. module.exports.SenceManager = SenceManager;