MKSystem.ts 4.2 KB

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