ViewManage.ts 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import Main from "./Main";
  2. import ViewObject from "./ViewObject";
  3. /**
  4. * 游戏主界面窗口管理
  5. */
  6. const { ccclass, property } = cc._decorator;
  7. export const GameViewType = cc.Enum({
  8. login: 'prefab/login/login',//登陆界面
  9. fqLogin: 'prefab/login/fqLogin',//凤起登陆
  10. historyArea: 'prefab/area/myzone',//历史登陆过的分区
  11. allArea: 'prefab/area/allzone',//所有分区
  12. area: 'prefab/area/area',//选区界面
  13. home: 'prefab/home/home',//主界面
  14. reward: 'prefab/common/award',//弹出奖励界面
  15. //引导界面
  16. plot_view: 'prefab/plot/plot_view',//插画引导界面
  17. //设置界面
  18. tap_role: 'prefab/setting/tap_role',//角色属性
  19. tap_role_name: 'prefab/setting/tap_role_name',//角色改名
  20. tap_shop: 'prefab/home/shop/shop',//商城
  21. tap_set: 'prefab/setting/tap_set',//设置
  22. tap_set_music: 'prefab/setting/tap_set_music',//声音
  23. tap_set_control: 'prefab/setting/tap_set_control',//按钮设置
  24. tap_set_Ann: 'prefab/setting/tap_set_Ann',//公告
  25. role_icon_view: 'prefab/setting/tap_role_head',//头像设置
  26. role_frame_view: 'prefab/setting/tap_role_headk',//头像框设置
  27. role_title_view: 'prefab/setting/tap_role_headtiezhi',//称号设置
  28. role_icon_info_view: 'prefab/setting/frame_icon/icon_info',//头像详细查看
  29. role_title_info_view: 'prefab/setting/frame_icon/title_info',//称号详细查看
  30. /**关卡 */
  31. stageView: 'prefab/home/stage/stage',//关卡选择界面
  32. stageInfo: 'prefab/home/stage/info/stageInfo',//关卡详情查看
  33. worldMap: 'prefab/home/stage/scene/wordMap',//关卡中选择世界地图
  34. wordTask: 'prefab/home/stage/scene/wordTask',//关卡中选择世界任务
  35. wordTaskItem: 'prefab/home/stage/scene/wordTaskItem',//世界任务说明奖励
  36. wordTaskItem_1: 'prefab/home/stage/scene/wordTaskItem_1',//众神事件
  37. dungeon: 'prefab/home/dungeon/dungeon',//关卡BOSS
  38. fight: 'prefab/fight/fight',//战斗界面
  39. fight_hd_zb: 'prefab/common/hd_zb',//战斗中获得装备
  40. fight_map_event_tips: 'prefab/map/element/map_event_tips',//战斗中机关提示
  41. fight_map_sjp_tips: 'prefab/map/element/shuijingping',//水晶瓶提示
  42. fight_dialog_box: 'prefab/fight/ff_dialog',//战斗中对话框
  43. fight_auto_equip: 'prefab/fight/ff_auto_equip',//战斗中获得装备自动使用
  44. fight_zsj_tips: 'prefab/fight/ff_tips',//获得紫水晶提示
  45. pack: 'prefab/home/pack/beibao',//背包界面
  46. god_card: 'prefab/home/godcard/god_card_view',//神庙界面
  47. god_card_info: 'prefab/home/godcard/card_about_view',//神卡说明
  48. god_card_star: 'prefab/home/godcard/card_star_view',//神卡升星
  49. god_card_star_success: 'prefab/home/godcard/card_star_success_view',//神卡进阶成功
  50. equip: 'prefab/home/equip/role_zb',//装备界面
  51. mohe: 'prefab/home/mohe/mohe',//魔盒界面
  52. moheInfo: 'prefab/home/mohe/magic_info_view',//魔盒详细查看
  53. moheReward: 'prefab/home/mohe/magic_reward_view',//魔盒奖励查看
  54. email: 'prefab/home/mail/mail',//邮箱
  55. emailInfo: 'prefab/home/mail/mail_info',//邮箱
  56. goodAbout: 'prefab/home/pack/good_Info',//道具说明
  57. // equipAbout: 'prefab/common/zbsx',//装备说明
  58. goodEat: 'prefab/home/pack/food_view',//道具说明
  59. changeEquip: 'prefab/home/equip/zb_gh',//换装备
  60. IntensifyEquip: 'prefab/home/equip/equi_pintensify',//装备强化
  61. petInfo: 'prefab/home/equip/pet_info',//宠物属性详细说明
  62. exchangeAmethyst: "prefab/home/shop/lottery_sj",//紫水晶兑换
  63. firstPay: "prefab/activity/1001_sc",//首冲
  64. wish: "prefab/activity/1002_mrlb",//每日祝福
  65. revenge: "prefab/activity/1003_fclb",//复仇礼包
  66. });
  67. export const AudioMgr = cc.Enum({
  68. homeMusic: "music/bgm/home",
  69. openDoor: "music/01_woodendoor",
  70. getCoin: "music/01_money",
  71. box: "music/01_treasure",
  72. amethyst: "music/01_crystal",
  73. star: "music/01_star",
  74. wooden: "music/01_wooden",
  75. qh: "music/01_intensify",
  76. qh2: "music/01_pack",
  77. click: "music/BT_common",
  78. equip: "music/01_clad", //角色穿装备
  79. gift: "music/01_purchase", //商店购买道具,礼包
  80. blood: "music/01_blood", //关卡中补血的果子(摘果子就播放)
  81. award: "music/01_award", //游戏奖励界面,通用的
  82. })
  83. @ccclass
  84. export default class ViewManage extends cc.Component {
  85. public main: Main;
  86. @property(cc.Node)
  87. mLayer: cc.Node = null;//弹出层
  88. @property(cc.Node)
  89. mLayer1: cc.Node = null;//弹出层
  90. /**
  91. * 是否已经在执行中
  92. */
  93. private runclick = false;
  94. onLoad() {
  95. this.main = this.node.getComponent(Main);
  96. }
  97. /**
  98. *
  99. * @param node 弹出窗口
  100. */
  101. public popView(node: cc.Node) {
  102. node.parent = this.mLayer;
  103. this.runclick = false;
  104. }
  105. /**
  106. *
  107. * @param node 弹出窗口
  108. */
  109. public popView1(node: cc.Node) {
  110. node.parent = this.mLayer1;
  111. this.runclick = false;
  112. }
  113. /**
  114. * 载入功能界面
  115. */
  116. public loadFunc(func, callback: (viewObject: ViewObject) => void, prev?: cc.Node) {
  117. if (this.runclick) {
  118. return;
  119. }
  120. this.runclick = true;
  121. //开始加载
  122. this.main.startLoad();
  123. cc.resources.load(func, cc.Prefab, (err, prefab: cc.Prefab) => {
  124. if (err) {
  125. cc.error(err);
  126. } else {
  127. //加载结束
  128. let node: cc.Node = cc.instantiate(prefab);
  129. let viewObject = node.getComponent(ViewObject);
  130. viewObject.main = this.main;
  131. callback(viewObject);
  132. }
  133. this.main.stopLoad();
  134. });
  135. }
  136. }