aa.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { _decorator } from 'cc';
  2. import { dataMgr, EventDispatcher, ResMgr, tgxModuleContext, tgxUIController, tgxUIMgr } from '../core_tgx/tgx';
  3. import { GameUILayers } from './GameUILayers';
  4. import { gridDraw } from './Util/GridDraw';
  5. import { HeadIconMgr } from '../core_tgx/util/HeadIconMgr';
  6. import { UIControllerAnnotation } from '../core_tgx/UIAnnotation/UIControllerAnnotation';
  7. import { ch } from '../ch/ch';
  8. import { MySdk } from './MySdk';
  9. import { AudioManager } from './Audio/AudioManager';
  10. export namespace aa {
  11. export const UIcontroller = tgxUIController
  12. export const UILayers = GameUILayers
  13. export const uIMgr = tgxUIMgr.inst
  14. export const data = dataMgr.inst;
  15. export const moduleContext = tgxModuleContext
  16. export const Util = ({
  17. gridDraw: gridDraw,
  18. resMgr: new ResMgr(),
  19. headIconMgr: new HeadIconMgr,
  20. date: ch.date
  21. })
  22. export const eventDispatch = new EventDispatcher
  23. export const audio = new AudioManager
  24. export const sdk = new MySdk
  25. export const ch_util = ch.util
  26. export const info = { g_name: "" }
  27. }
  28. export function shuffle<T>(array: T[], start: number = 0, end: number = array.length): T[] {
  29. if (start > end) {
  30. let t = end
  31. end = start
  32. start = t
  33. }
  34. end = Math.floor(Math.min(array.length - 1, end))
  35. start = Math.floor(Math.max(0, start))
  36. for (let i = array.length - 1; i > start; i--) {
  37. let j = Math.floor(Math.random() * (i + 1) - start) + start;
  38. [array[i], array[j]] = [array[j], array[i]];
  39. }
  40. return array
  41. }
  42. export const UIController = UIControllerAnnotation.UI
  43. export const UIElement = UIControllerAnnotation.element