HomeView.ts 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import LayerPanel, {UrlInfo} from "../../Common/manage/Layer/LayerPanel";
  2. import GameInfoView from "./GameInfoView";
  3. import GameView from "./GameView";
  4. import Shop from "./logic/game/shop";
  5. import Sign from "./logic/game/sign";
  6. import PanelMgr, {Layer} from "../../Common/manage/PanelMgr";
  7. import ShowConfig from "../../Common/ShowConfig";
  8. import QgBanner from "../../Common/manage/Api/QgBanner";
  9. import Global from "../../Common/Global";
  10. import Emit from "../../Common/manage/Emit/Emit";
  11. import EmitData from "../../Common/manage/Emit/EmitData";
  12. //import QgApi from "../../Common/manage/Api/QgApi";
  13. const {ccclass} = cc._decorator;
  14. @ccclass
  15. export default class HomeView extends LayerPanel {
  16. public static getUrl(): UrlInfo {
  17. return {
  18. bundle: "homeView",
  19. name: "homeView"
  20. }
  21. }
  22. private _exportData: any = null;
  23. //node
  24. private _button: cc.Node = null;
  25. private _setting: cc.Node = null;
  26. private _shopBtn: cc.Node = null ;
  27. private _shortBtn : cc.Node = null ;
  28. public initUI() {
  29. //todo 逻辑
  30. PanelMgr.INS.openPanel({
  31. panel: GameInfoView,
  32. layer: Layer.gameInfoLayer,
  33. })
  34. this._button = this.getNode("next");
  35. this.onTouch(this._button, () => {
  36. PanelMgr.INS.openPanel({
  37. panel : GameView,
  38. layer : Layer.gameLayer,
  39. call : ()=>{
  40. PanelMgr.INS.closePanel(HomeView) ;
  41. PanelMgr.INS.closePanel(Shop) ;
  42. PanelMgr.INS.closePanel(Sign) ;
  43. }
  44. })
  45. });
  46. this._setting = this.getNode("setting")
  47. this._shopBtn = this.getNode("bottomUI/shopIcon")
  48. this.onTouch(this._shopBtn, () => {
  49. PanelMgr.INS.openPanel({
  50. panel : Shop,
  51. layer : Layer.gameLayer
  52. })
  53. })
  54. //下面是原始的代码
  55. // this._shortBtn = this.getNode('shortBtn') ;
  56. // QgApi.judgeShortIcon().then((res : boolean)=>{
  57. // this._shortBtn.active = res;
  58. // })
  59. // this.onTouch(this._shortBtn, () => {
  60. // QgApi.addShortcutIcon().then((res)=>{
  61. // if (res) {
  62. // this._shortBtn.active = false ;
  63. // }
  64. // })
  65. // })
  66. }
  67. public show(param: any) {
  68. ShowConfig.show('homeConfig').then((res) => {
  69. if (Global.config.homeConfig.bannerShow == 1) {
  70. QgBanner.showBanner();
  71. } else {
  72. QgBanner.hideBanner();
  73. }
  74. });
  75. }
  76. public hide() {
  77. if (Global.config.homeConfig.nativeConfig.type == 2) {
  78. Emit.instance().emit(EmitData.CLOSE_NATIVE) ;
  79. }
  80. }
  81. //todo logic 方法
  82. }