Global.ts 1.5 KB

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