Global.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. public static EventType_CLICK_SHU = "EventType_CLICK_SHU";
  10. //音效
  11. public static Audio_Bg = "/audio/bg"
  12. public static Audio_AddScore = "/audio/addScore"
  13. public static Audio_MinusScore = "/audio/minusScore"
  14. public static Audio_gameOver = "/audio/gameOver"
  15. public static Audio_level = "/audio/level"
  16. public static Audio_zhangai = "/audio/zhangai"
  17. public static Audio_pashu = "/audio/pashu"
  18. public static Audio_Success = "/audio/success"
  19. public static Audio_GameFail = "/audio/gameFail"
  20. public static Audio_TimeOutFail = "/audio/timeOutFail"
  21. //游戏
  22. public static StartLv = 1;
  23. public static MaxLv = 10;
  24. public static GameSetTime = 120;
  25. public static DifficultyRate = 1;
  26. //全局定时器
  27. public static cdSchedule: CountDownSchedule = new CountDownSchedule();
  28. /**
  29. * 获取xxx-xxx之间的随机数
  30. * @param min 最小数
  31. * @param max 最大数
  32. * @returns 随机数字
  33. */
  34. public static getRandom(min, max): number {
  35. return Math.floor(Math.random() * (max - min)) + min;
  36. }
  37. /**
  38. * 获取两个数字之差
  39. * @param num1
  40. * @param num2
  41. * @returns
  42. */
  43. public static getDifference(num1, num2): number {
  44. return Math.abs(num1 - num2);
  45. }
  46. }