MKSystem.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. import TipSystem from "./TipSystem";
  20. import PoolSystem from "./PoolSystem";
  21. /**
  22. * @description mk系统
  23. * @author 邹勇,冯聪,薛鸿潇,kaka
  24. */
  25. class MKSystem {
  26. constructor() {
  27. }
  28. /** 工具 */
  29. private _time: TimeUtil;
  30. public get time(): TimeUtil {
  31. return this._time || (this._time = new TimeUtil());
  32. }
  33. private _file: FileUtil;
  34. public get file(): FileUtil {
  35. return this._file || (this._file = new FileUtil());
  36. }
  37. private _encrypt: EncryptUtil;
  38. public get encrypt(): EncryptUtil {
  39. return this._encrypt || (this._encrypt = new EncryptUtil());
  40. }
  41. private _console: LogUtil;
  42. public get console(): LogUtil {
  43. return this._console || (this._console = new LogUtil());
  44. }
  45. private _game: GameUtil;
  46. public get game(): GameUtil {
  47. return this._game || (this._game = new GameUtil());
  48. }
  49. private _loader: LoadResUtil;
  50. public get loader(): LoadResUtil {
  51. return this._loader || (this._loader = new LoadResUtil());
  52. }
  53. private _storage: StorageUtil;
  54. public get storage(): StorageUtil {
  55. return this._storage || (this._storage = new StorageUtil());
  56. }
  57. private _math: MathUtil;
  58. public get math(): MathUtil {
  59. return this._math || (this._math = new MathUtil());
  60. }
  61. /** SDK */
  62. private _bugly: BuglySDK;
  63. public get bugly(): BuglySDK {
  64. return this._bugly || (this._bugly = new BuglySDK());
  65. }
  66. /** 系统管理 */
  67. private _data: DataSystem;
  68. public get data(): DataSystem {
  69. return this._data || (this._data = new DataSystem());
  70. }
  71. private _ad: AdSystem;
  72. public get ad(): AdSystem {
  73. return this._ad || (this._ad = new AdSystem(ATSDKMgr.getInstance()));
  74. }
  75. private _jsb: JsbSystem;
  76. public get jsb(): JsbSystem {
  77. return this._jsb || (this._jsb = new JsbSystem());
  78. }
  79. private _http: HttpSystem;
  80. public get http(): HttpSystem {
  81. return this._http || (this._http = new HttpSystem());
  82. }
  83. private _audio: AudioSystem;
  84. public get audio(): AudioSystem {
  85. return this._audio || (this._audio = new AudioSystem());
  86. }
  87. private _timer: TimerSystem;
  88. public get timer(): TimerSystem {
  89. return this._timer || (this._timer = new TimerSystem());
  90. }
  91. private _event: EventSystem;
  92. public get event(): EventSystem {
  93. return this._event || (this._event = new EventSystem());
  94. }
  95. private _pool: PoolSystem;
  96. public get pool(): PoolSystem {
  97. return this._pool || (this._pool = new PoolSystem());
  98. }
  99. /** 挂载在MainScene的界面上,不需要new */
  100. private _ui: UISystem;
  101. public get ui(): UISystem {
  102. return this._ui;
  103. }
  104. public set ui(v: UISystem) {
  105. this._ui = v;
  106. }
  107. private _tip: TipSystem;
  108. public get tip(): TipSystem {
  109. return this._tip;
  110. }
  111. public set tip(v: TipSystem) {
  112. this._tip = v;
  113. }
  114. }
  115. declare global {
  116. const mk: MKSystem;
  117. }
  118. window['mk'] = new MKSystem();