GameModel.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. class GameModel{
  2. constructor(){
  3. console.log('GameModel初始化');
  4. this.token = null;
  5. this.phone = null;
  6. this.updateSign = null;
  7. this.idVerified = 0;
  8. this.guestTimeout = false;
  9. this.regTime = 0;
  10. this.userInfo = null;
  11. this.player = null;
  12. this.resList = [];
  13. this.taskList = {};
  14. this.mailList = null;
  15. this.cannonList = {};
  16. this.heroList = {};
  17. this.realm = null; //矩阵
  18. this.chapter = {}; //闯关进度数据
  19. this.equip = {}; //装备
  20. this.equipAttributes = null; //--当前穿戴装备的所有属性总和
  21. this.StatuAttribute = null; //境界属性总和
  22. this.matrixAttribute = null; //矩阵属性
  23. this.notifyList = {};
  24. this.systemNotifyList = {};
  25. this.gameScene = null;
  26. this.inGame = false;
  27. this.inGameChangeAccount = false;
  28. this.fishList = {};
  29. this.realBulletHit = null;
  30. this.bulletHitList = null;
  31. this.bulletList = null;
  32. this.gamePlayers = null;
  33. this.connonConfig = null;
  34. this.redpackConfig = null;
  35. this.roomType = 0;
  36. this.selfSeat = 0;
  37. this.redBonus = 0;
  38. this.goldBonus = 0;
  39. this.pool1 = 0;
  40. this.pool3 = 0;
  41. this.pool4 = 0;
  42. this.pool5 = 0;
  43. this.quitFromTorpedoGame = false;
  44. this.lotteryCache = 0;
  45. this.selfBulletID = 1;
  46. this.skillList = {};
  47. this.newEquips = {};
  48. this.statePanelWuDaoNotice = false;
  49. this.enemyHpList = {};
  50. this.openSystemList = {};
  51. this.primaryLimit = [0, 300000];
  52. this.intermediateLimit = [100000, 3000000];
  53. this.highLimit = [500000, 999999999999999999999];
  54. this.shareBindInfo = {}; //分享绑定信息
  55. this.PassTaskList = {};
  56. this.EggInfoList = {};
  57. this.GrowthInfoList = {};
  58. thisrelationWX = null;
  59. thiswxType = 0;
  60. thisNiudanInfoList = {};
  61. this.chargeNum = 0;
  62. this.heroskinID = null;
  63. this.bossdata3 = null;
  64. this.redBujiOpeb = false;
  65. this.redFishNextData = null;
  66. this.noviceTime = 0;
  67. this.luckyStoneHint = true;
  68. this.isUseWxPay = null;
  69. this.specialPlayer = 999;
  70. this.Yuchao = 0;
  71. }
  72. clear(){
  73. this.token = null;
  74. this.phone = null;
  75. this.updateSign = null;
  76. this.realName = null;
  77. this.idCardCode = null;
  78. this.guestTimeOver = false;
  79. this.userInfo = null;
  80. this.idVerified = 0;
  81. this.player = null;
  82. this.resList = [];
  83. this.taskList = {};
  84. this.chapter = {};
  85. this.equip = {};
  86. this.mailList = null;
  87. this.notifyList = {};
  88. this.systemNotifyList = {};
  89. this.heroList = {};
  90. this.selfBulletID = 1;
  91. this.skillList = {};
  92. this.equipAttributes = null;
  93. this.matrixAttribute = null;
  94. this.newEquips = {};
  95. this.realm = null;
  96. this.StatuAttribute = null;
  97. this.statePanelWuDaoNotice = false;
  98. this.PassTaskList = {};
  99. this.GrowthInfoList = {};
  100. this.relationWX = null;
  101. this.noviceTime = 0;
  102. this.luckyStoneHint = true;
  103. }
  104. init(){
  105. this.clear();
  106. }
  107. //--任务更新
  108. updateTask(value){
  109. for(let key in value){
  110. let find = false;
  111. for(let m in this.taskList){
  112. if(this.taskList[m].ID = value[key].ID){
  113. this.taskList[m] = value[key];
  114. find = true;
  115. break;
  116. }
  117. }
  118. if(!find){
  119. this.taskList[key] = value[key];
  120. }
  121. }
  122. }
  123. getItemCountByModel(model){
  124. for(let i=0; i < this.resList.length; i++){
  125. if(this.resList[i].Model == model){
  126. return this.resList[i].Num;
  127. }
  128. }
  129. return 0;
  130. }
  131. setItemCountByModel(model, count){
  132. for(let i=0; i < this.resList.length; i++){
  133. if(this.resList[i].Model == model){
  134. this.resList[i].Num = count;
  135. return;
  136. }
  137. }
  138. this.resList.push({'Model': model, 'Num': count});
  139. }
  140. }
  141. let instance = null;
  142. GameModel.getInstance = function(){
  143. if(!instance){
  144. instance = new GameModel();
  145. }
  146. return instance;
  147. }
  148. // export default GameModel.getInstance();
  149. window.GameModel = GameModel.getInstance();