GameOverData.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. export class GameOverData {
  2. private static _instance: GameOverData = null;
  3. private win: boolean = true;
  4. private killCount: number = 0;
  5. private lifePercent: number = 0;
  6. //金币奖励
  7. private killAward: number = 0;
  8. private lifeAward: number = 0;
  9. private stageClearAward: number = 0;
  10. private totalAward: number = 0;
  11. //经验奖励
  12. private xp: number = 0;
  13. //钻石奖励
  14. private lifeDia: number = 0;
  15. private stageClearDia: number = 0;
  16. private totalDia: number = 0;
  17. private constructor() { };
  18. static get Instance(): GameOverData {
  19. if (!this._instance) {
  20. this._instance = new GameOverData();
  21. }
  22. return this._instance;
  23. }
  24. clearData() {
  25. this.win = true;
  26. this.killCount = 0;
  27. this.lifePercent = 0;
  28. this.killAward = 0;
  29. this.lifeAward = 0;
  30. this.stageClearAward = 0;
  31. this.totalAward = 0;
  32. this.xp = 0;
  33. this.lifeDia = 0;
  34. this.stageClearDia = 0;
  35. this.totalDia = 0;
  36. }
  37. get Win(): boolean { return this.win }
  38. set Win(win: boolean) { this.win = win }
  39. get KillCount(): number { return this.killCount }
  40. set KillCount(count: number) { this.killCount = count }
  41. get LifePercent(): number { return this.lifePercent }
  42. set LifePercent(percent: number) { this.lifePercent = percent }
  43. get KillAward(): number { return this.killAward }
  44. set KillAward(award: number) { this.killAward = award }
  45. get LifeAward(): number { return this.lifeAward }
  46. set LifeAward(award: number) { this.lifeAward = award }
  47. get StageClearAward(): number { return this.stageClearAward }
  48. set StageClearAward(award: number) { this.stageClearAward = award }
  49. get TotalAward(): number { return this.totalAward }
  50. set TotalAward(award: number) { this.totalAward = award }
  51. get Xp(): number { return this.xp }
  52. set Xp(xp: number) { this.xp = xp }
  53. get LifeDia(): number { return this.lifeDia }
  54. set LifeDia(award: number) { this.lifeDia = award }
  55. get StageClearDia(): number { return this.stageClearDia }
  56. set StageClearDia(award: number) { this.stageClearDia = award }
  57. get TotalDia(): number { return this.totalDia }
  58. set TotalDia(award: number) { this.totalDia = award }
  59. }