MKSystem.ts 5.6 KB

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