MKSystem.ts 4.0 KB

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