Global.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import CountDownSchedule from "./CountDownSchedule";
  2. export class Global {
  3. //是否开发环境
  4. public static IsDevelop = false;
  5. //事件类型
  6. public static EventType_AddScore = "AddScore";
  7. public static EventType_MinusScore = "MinusScore";
  8. public static EventType_ShowTips = "ShowTips";
  9. public static EventType_GameOver = "GameOver";
  10. //音效
  11. public static Audio_Bg = "/audio/bg"
  12. public static Audio_Success="/audio/success"
  13. public static Audio_GameFail="/audio/gameFail"
  14. public static Audio_TimeOutFail="/audio/timeOutFail"
  15. //游戏
  16. public static StartLv = 1;
  17. public static MaxLv = 5;
  18. public static GameSetTime = 60;
  19. public static DifficultyRate=1; //游戏难度系数
  20. //全局定时器
  21. public static cdSchedule: CountDownSchedule = new CountDownSchedule();
  22. /**
  23. * 获取xxx-xxx之间的随机数
  24. * @param min 最小数
  25. * @param max 最大数
  26. * @returns 随机数字
  27. */
  28. public static getRandom(min, max): number {
  29. return Math.floor(Math.random() * (max - min + 1)) + min;
  30. }
  31. /**
  32. * 获取两个数字之差
  33. * @param num1
  34. * @param num2
  35. * @returns
  36. */
  37. public static getDifference(num1, num2): number {
  38. return Math.abs(num1 - num2);
  39. }
  40. }