MKSystem.ts 4.6 KB

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