dd28d8be-9396-4c3c-ac4b-45bd9f6fb79a.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. "use strict";
  2. cc._RF.push(module, 'dd28di+k5ZMPKxLRb2fb7ea', 'Global');
  3. // Script/Global.ts
  4. "use strict";
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. var Global = /** @class */ (function () {
  7. function Global() {
  8. this.StartNode = null;
  9. /**
  10. * 主场景节点
  11. */
  12. this.MainNode = null;
  13. /**
  14. * 落脚点碰撞标志,默认未碰撞,false
  15. */
  16. this.CollisionFlag = false;
  17. /**
  18. * 顶碰撞标准,默认未碰撞,false
  19. */
  20. this.CollisionWithDing = false;
  21. /**
  22. * 落脚点碰撞标签
  23. */
  24. this.KIND_FootHold = 0;
  25. /**
  26. * player初始下落速度,8.5px/帧
  27. */
  28. this.InitSpeed = 8.5;
  29. /**
  30. * player移动速度,1px/帧
  31. */
  32. this.moveSpeed = 10;
  33. /**
  34. * 落脚点移动速度
  35. */
  36. this.FHFallSpeed = 2;
  37. /**
  38. * 剩余命数
  39. */
  40. this.reLife = new Array();
  41. /**
  42. * 受到伤害标志
  43. */
  44. this.Injured = false;
  45. /**
  46. * 失败标志
  47. */
  48. this.OverFlag = false;
  49. /**
  50. * 等级增加标志位,0表示未增加,当前为1级
  51. */
  52. this.LevelAddFlag = 1;
  53. /**
  54. * 本地分数存储
  55. */
  56. this.LocalScore = {
  57. BestScore: 0,
  58. SecondScore: 0,
  59. ThirdScore: 0,
  60. CurrentScore: 0,
  61. length: 3,
  62. };
  63. /**
  64. * 远程分数存储
  65. */
  66. this.remoteScore = new Array();
  67. /**
  68. * 网络连接标志位
  69. */
  70. this.NetStatus = false;
  71. /**
  72. * stop Animations falg;
  73. */
  74. this.AniFalg = false;
  75. /**
  76. * info
  77. */
  78. this.USERINFO = {
  79. userId: "",
  80. uTim: Number,
  81. score: 0,
  82. };
  83. /**
  84. * player排行
  85. */
  86. this.MyRank = null;
  87. this.LorR = 0; //0 for right
  88. }
  89. ;
  90. /**
  91. * return the local score
  92. */
  93. Global.prototype.getLocalScore = function () {
  94. return this.LocalScore;
  95. };
  96. /**
  97. * return the remote score
  98. */
  99. Global.prototype.getRemoteScore = function () {
  100. return this.remoteScore;
  101. };
  102. Global.prototype.setRemoteScore = function (score) {
  103. this.remoteScore = score;
  104. };
  105. /**
  106. * 开始场景节点获取
  107. */
  108. Global.prototype.getSN = function () {
  109. return this.StartNode;
  110. };
  111. /**
  112. *
  113. * @param sn 开始场景节点
  114. */
  115. Global.prototype.setSN = function (sn) {
  116. this.StartNode = sn;
  117. };
  118. /**
  119. * 主场景节点获取
  120. */
  121. Global.prototype.getMN = function () {
  122. return this.MainNode;
  123. };
  124. /**
  125. *
  126. * @param mn 主场景节点
  127. */
  128. Global.prototype.setMN = function (mn) {
  129. this.MainNode = mn;
  130. };
  131. /**
  132. * 获取玩家信息
  133. */
  134. Global.prototype.GetUSer = function () {
  135. return this.USERINFO;
  136. };
  137. /**
  138. * 设置玩家信息
  139. * @param user 玩家
  140. */
  141. Global.prototype.SetUser = function (user) {
  142. this.USERINFO = user;
  143. };
  144. /**
  145. * 获取个人排行
  146. */
  147. Global.prototype.GetR = function () {
  148. return this.MyRank;
  149. };
  150. /**
  151. * 设置个人排行
  152. * @param r 排行
  153. */
  154. Global.prototype.SetR = function (r) {
  155. this.MyRank = r;
  156. };
  157. /**
  158. * 获取排行分数
  159. */
  160. Global.prototype.GetS = function () {
  161. return this.remoteScore;
  162. };
  163. /**
  164. * 设置排行分数
  165. * @param s 分数
  166. */
  167. Global.prototype.SetS = function (s) {
  168. this.remoteScore = s;
  169. };
  170. Global.instance = new Global(); //全局下不可少
  171. return Global;
  172. }());
  173. exports.default = Global;
  174. /**
  175. * 这里应当添加当前局分数存储,
  176. * 只需要游戏最高分
  177. * 从服务器获取的分数也是先与本地分数对比,交换,
  178. * 拿到最高分,上传;
  179. * 之后刷新排行榜
  180. */
  181. cc._RF.pop();