MKSystem.ts 5.8 KB

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