MKSystem.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import BuglySDK from "../sdk/BuglySDK";
  2. import FileUtil from "../utils/FileUtil";
  3. import TimeUtil from "../utils/TimeUtil";
  4. import DataSystem from "./DataSystem";
  5. import HttpSystem from "./HttpSystem";
  6. import LoadResUtil from "../utils/LoadResUtil";
  7. import LogUtil from "../utils/LogUtil";
  8. import { EncryptUtil } from "../utils/EncryptUtil";
  9. import GameUtil from "../utils/GameUtil";
  10. import UISystem from "./UISystem";
  11. import StorageUtil from "../utils/StorageUtil";
  12. import TimerSystem from "./TimerSystem";
  13. import EventSystem from "./EventSystem";
  14. import MathUtil from "../utils/MathUtil";
  15. import AdSystem from "./AdSystem";
  16. import JsbSystem from "./JsbSystem";
  17. import ATSDKMgr from "../sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr";
  18. import AudioSystem from "./AudioSystem";
  19. /**
  20. * @description mk系统
  21. * @author 邹勇,冯聪,薛鸿潇,kaka
  22. */
  23. class MKSystem {
  24. constructor() {
  25. this.init();
  26. }
  27. /** 工具 */
  28. time: TimeUtil;
  29. file: FileUtil;
  30. encrypt: EncryptUtil;
  31. console: LogUtil;
  32. game: GameUtil;
  33. loader: LoadResUtil;
  34. storage: StorageUtil;
  35. math: MathUtil;
  36. /** SDK */
  37. bugly: BuglySDK;
  38. /** 系统管理 */
  39. data: DataSystem;
  40. ad: AdSystem;
  41. jsb: JsbSystem;
  42. http: HttpSystem;
  43. audio: AudioSystem;
  44. timer: TimerSystem;
  45. event: EventSystem;
  46. /** 挂载在MainScene的界面上,不需要new */
  47. ui: UISystem;
  48. init() {
  49. //工具
  50. this.time = new TimeUtil();
  51. this.file = new FileUtil();
  52. this.encrypt = new EncryptUtil();
  53. this.console = new LogUtil();
  54. this.game = new GameUtil();
  55. this.loader = new LoadResUtil();
  56. this.storage = new StorageUtil();
  57. this.math = new MathUtil();
  58. //sdk
  59. this.bugly = new BuglySDK();
  60. //system
  61. this.data = new DataSystem();
  62. this.http = new HttpSystem();
  63. this.audio = new AudioSystem();
  64. this.ad = new AdSystem(ATSDKMgr.getInstance());
  65. this.jsb = new JsbSystem();
  66. this.timer = new TimerSystem();
  67. this.event = new EventSystem();
  68. }
  69. }
  70. declare global {
  71. const mk: MKSystem;
  72. }
  73. window['mk'] = new MKSystem();