MKSystem.ts 5.4 KB

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