YZ_Tool_4399.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import PlatUtils from "./PlatUtils";
  2. import { utils } from "./Utils";
  3. import YZ_Constant, { LevelStatus } from "./YZ_Constant";
  4. const { ccclass, property } = cc._decorator;
  5. //<script src="http://h.api.4399.com/h5mini-2.0/h5api-interface.php"></script>
  6. /**
  7. * uc工具类
  8. */
  9. @ccclass
  10. export default class YZ_Tool_4399 {
  11. //@ts-ignore
  12. _4399 = window.h5api;
  13. _sysInfo: any = {};
  14. public get SysInfo() {
  15. return this._sysInfo;
  16. }
  17. /**
  18. * 服务器配置信息
  19. */
  20. _serverConfig: any = null;
  21. public get ServerConfig() {
  22. return this._serverConfig;
  23. }
  24. /**
  25. *
  26. * @param data 配置数据
  27. */
  28. public init(data: string) {
  29. if (PlatUtils.Is4399) {
  30. // if (data) {
  31. // let configObj: any = JSON.parse(data);
  32. // if (configObj && configObj.uc) {
  33. // ST_DefaultServerConfig = JSON.stringify(configObj.uc);
  34. // }
  35. // }
  36. utils.showLog("4399 h5 平台初始化完成 >>");
  37. utils.emitServerInitEvent();
  38. }
  39. }
  40. public share(callBack: Function) {
  41. this._4399.share();
  42. callBack && callBack(true, "");
  43. }
  44. /**
  45. * 显示推荐弹窗
  46. */
  47. public showRecommend() {
  48. this._4399.showRecommend()
  49. }
  50. }