Global.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. public static GameMain = null
  16. //游戏
  17. public static StartLv = 1;
  18. public static MaxLv = 3;
  19. public static GameSetTime = 60;
  20. public static DifficultyRate=1; //游戏难度系数
  21. //全局定时器
  22. public static cdSchedule: CountDownSchedule = new CountDownSchedule();
  23. /**
  24. * 获取xxx-xxx之间的随机数
  25. * @param min 最小数
  26. * @param max 最大数
  27. * @returns 随机数字
  28. */
  29. public static getRandom(min, max): number {
  30. return Math.floor(Math.random() * (max - min + 1)) + min;
  31. }
  32. /**
  33. * 获取两个数字之差
  34. * @param num1
  35. * @param num2
  36. * @returns
  37. */
  38. public static getDifference(num1, num2): number {
  39. return Math.abs(num1 - num2);
  40. }
  41. }