Global.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import CountDownSchedule from "./CountDownSchedule";
  2. export class Global {
  3. //网络
  4. public static Net_SaveUrl = "http://60.205.201.7:8110/game/play/record/save";
  5. public static Net_DetailUrl = 'http://60.205.201.7:8110/app/game/detailByCode?';
  6. public static Net_ShowResultUrl = 'http://60.205.201.7:8110/game/play/record/showResult';
  7. public static Net_UserToken = '';
  8. public static GameCode = 0;
  9. public static IsDevelop = false;
  10. //事件类型
  11. public static EventType_AddScore = "AddScore";
  12. public static EventType_MinusScore = "MinusScore";
  13. public static EventType_ShowTips = "ShowTips";
  14. public static EventType_GameOver = "GameOver";
  15. //音效
  16. public static Audio_Bg = "/audio/bg"
  17. public static Audio_AddScore = "/audio/addScore"
  18. public static Audio_MinusScore = "/audio/minusScore"
  19. public static Audio_gameOver = "/audio/gameOver"
  20. //游戏
  21. public static StartLv = 1;
  22. public static MaxLv = 10;
  23. public static GameSetTime = 120;
  24. public static DifficultyRate=1; //游戏难度系数
  25. public static IsFirstGame = false;
  26. public static GameBgImage='';
  27. public static IsSound='false';
  28. public static IsFull='false';
  29. //全局定时器
  30. public static cdSchedule: CountDownSchedule = new CountDownSchedule();
  31. /**
  32. * 获取xxx-xxx之间的随机数
  33. * @param min 最小数
  34. * @param max 最大数
  35. * @returns 随机数字
  36. */
  37. public static getRandom(min, max): number {
  38. return Math.floor(Math.random() * (max - min + 1)) + min;
  39. }
  40. /**
  41. * 获取两个数字之差
  42. * @param num1
  43. * @param num2
  44. * @returns
  45. */
  46. public static getDifference(num1, num2): number {
  47. return Math.abs(num1 - num2);
  48. }
  49. }