ch_sdk_comp.ts 698 B

12345678910111213141516171819202122
  1. import { _decorator, Component, Game, game, Node } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('ch_sdk_comp')
  4. export class ch_sdk_comp extends Component {
  5. protected onLoad(): void {
  6. game.on(Game.EVENT_SHOW, () => {
  7. chsdk.sdk_event.emit(chsdk.sdk_event.key.show);
  8. }, this);
  9. game.on(Game.EVENT_HIDE, () => {
  10. chsdk.sdk_event.emit(chsdk.sdk_event.key.hide);
  11. }, this);
  12. /*window.addEventListener("blur", () => {
  13. chsdk.sdk_event.emit(chsdk.sdk_event.key.hide);
  14. });
  15. window.addEventListener("focus", () => {
  16. chsdk.sdk_event.emit(chsdk.sdk_event.key.show);
  17. });*/
  18. }
  19. }