MKSystem.ts 5.2 KB

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