GameModel.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. import { _decorator, Component, Node, Prefab, director, find } from 'cc';
  2. import BufferManager from '../../engines/buffers/BufferManager';
  3. import IBuffer from '../../engines/buffers/IBuffer';
  4. import { EventDispatcher } from '../../engines/events/EventDispatcher';
  5. import { DataModel } from '../../engines/models/DataModel';
  6. import { DataModelEventType } from '../../engines/models/DataModelEventType';
  7. import { NoticeManager } from '../../engines/notices/NoticeManager';
  8. import { PlatformManager } from '../../Platform/PlatformManager';
  9. import { branchIdType } from '../../Platform/WeChat/branchIdType';
  10. import { WeChatPlatform } from '../../Platform/WeChat/WeChatPlatform';
  11. import AccelerateBuffer from '../buffers/AccelerateBuffer';
  12. import AutoSyntheticBuffer from '../buffers/AutoSyntheticBuffer';
  13. import GameConfigManager from './GameConfigManager';
  14. import { GamePropertys } from './GamePropertys';
  15. import { WeaponCell } from './weapons/WeaponCell';
  16. const { ccclass, property } = _decorator;
  17. export class GameModel extends DataModel {
  18. /**
  19. * 武器格子列表
  20. */
  21. private __weaponCells: WeaponCell[] = [];
  22. /**
  23. * 购买记录
  24. */
  25. private __buyHistory: Map<number, number> = new Map<number, number>();
  26. /**
  27. * 当前武器格子
  28. */
  29. currentWeaponCell: WeaponCell;
  30. /**
  31. * 上次空投的时间点
  32. */
  33. lastDropBoxTime:number=0;
  34. constructor() {
  35. super();
  36. }
  37. /**
  38. * 设置默认属性
  39. */
  40. SetDefaultPropertys(): void {
  41. //7日登录
  42. this.signGetRecord=[0,0,0,0,0,0,0];
  43. //第一天
  44. this.signDay=1;
  45. //默认关卡
  46. this.currentLevel = 1;
  47. //默认栅栏
  48. this.currentFenceId = 30001;
  49. //默认最大已合成枪ID
  50. this.synthesisMaxWeaponId = 10101;
  51. this.gold = 0;
  52. this.diamond = 0;
  53. //12个默认格子
  54. let weaponCell: WeaponCell;
  55. for (let index = 0; index < 12; index++) {
  56. weaponCell = new WeaponCell();
  57. weaponCell.cellId = index;
  58. weaponCell.weaponId = index < 2 ? 10101 : -1;
  59. weaponCell.lastOutputTime = 0;
  60. this.__weaponCells.push(weaponCell);
  61. }
  62. //默认武器
  63. this.currentWeaponCell=this.__weaponCells[0];
  64. //保存到本地
  65. this.SaveToLoacl();
  66. }
  67. private lastTime: number = 0;
  68. /**
  69. * 计算收益
  70. */
  71. CheckEarnings(): void {
  72. let currentTime: number = director.getCurrentTime();
  73. if (currentTime - this.lastTime < this.earningTime) {
  74. return;
  75. }
  76. this.lastTime = currentTime;
  77. let fullEarnings: number = this.fullEarnings;
  78. if (fullEarnings > 0) {
  79. console.log("产出金币:" + fullEarnings);
  80. this.gold += fullEarnings * (this.earningTime / 1000);
  81. }
  82. if (this.DataChanged) {
  83. this.SaveToLoacl();
  84. }
  85. }
  86. /**
  87. * 每秒总收益
  88. */
  89. get fullEarnings(): number {
  90. let result: number = 0;
  91. this.__weaponCells.forEach(weaponCell => {
  92. if (weaponCell.weaponId >= 0) {
  93. result += weaponCell.weaponConfig.earnings;
  94. }
  95. });
  96. return result;
  97. }
  98. /**
  99. * 收益计算间隔
  100. */
  101. get earningsInterval(): number {
  102. return GameConfigManager.getGlobalValue("earningsInterval");
  103. }
  104. /**
  105. * 收益间隔时间
  106. */
  107. get earningTime(): number {
  108. let bufferList: IBuffer[] = BufferManager.GetBufferGroup("Accelerate");
  109. if (bufferList == null || bufferList.length == 0) {
  110. return this.earningsInterval;
  111. }
  112. let buffer: AccelerateBuffer = bufferList[0] as AccelerateBuffer;
  113. return this.earningsInterval * buffer.rate;
  114. }
  115. /**
  116. * 自动合成武器
  117. */
  118. public AutoSynthetic(max: number = 1): void {
  119. let a: WeaponCell;
  120. let b: WeaponCell;
  121. let synIndex: number = 0;
  122. for (let aIndex = 0; aIndex < this.weaponCells.length; aIndex++) {
  123. a = this.weaponCells[aIndex];
  124. if (a.weaponId < 0 || GameConfigManager.WeaponIsMaxLevel(a.weaponId)) {
  125. continue;
  126. }
  127. for (let bIndex = aIndex + 1; bIndex < this.weaponCells.length; bIndex++) {
  128. b = this.weaponCells[bIndex];
  129. if (b.weaponId < 0 || GameConfigManager.WeaponIsMaxLevel(b.weaponId)) {
  130. continue;
  131. }
  132. //可以合成
  133. if (a.weaponId == b.weaponId) {
  134. this.SynthesisWeapon(a.cellId, b.cellId);
  135. synIndex++;
  136. //如果大于最大数
  137. if (synIndex >= max) {
  138. return;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. private DataChanged: boolean;
  145. DispatchEvent(key: string, data?: any): void {
  146. super.DispatchEvent(key, data);
  147. this.DataChanged = true;
  148. }
  149. // /**
  150. // * 设置当前武器ID
  151. // */
  152. // set currentWeaponId(value: number) {
  153. // this.__currentWeaponCell.weaponId = value;
  154. // this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.currentWeaponId);
  155. // }
  156. get currentWeaponId(): number {
  157. if(this.currentWeaponCell==null){
  158. return -1;
  159. }
  160. return this.currentWeaponCell.weaponId;
  161. }
  162. /**
  163. * 合成武器
  164. * @param sourceCellId
  165. * @param targetCellId
  166. */
  167. public SynthesisWeapon(sourceCellId: number, targetCellId: number): void {
  168. let sourceCell: WeaponCell = this.FindCell(sourceCellId);
  169. let targetCell: WeaponCell = this.FindCell(targetCellId);
  170. if (sourceCell.weaponId != targetCell.weaponId) {
  171. console.error("要合成的武器ID不同!");
  172. return;
  173. }
  174. if (GameConfigManager.WeaponIsMaxLevel(sourceCell.weaponId)) {
  175. console.error("武器已到达最高等级!");
  176. }
  177. let newWeaponId: number = GameConfigManager.GetNextLevelWeaponId(sourceCell.weaponId);
  178. //删除
  179. sourceCell.weaponId = -1;
  180. targetCell.weaponId = newWeaponId;
  181. targetCell.lastOutputTime = director.getCurrentTime();
  182. //对比新枪和老记录的合成枪
  183. let newWeaponConfig = GameConfigManager.GetWeaponConfig(newWeaponId);
  184. let synthesisMaxWeaponConfig = GameConfigManager.GetWeaponConfig(this.synthesisMaxWeaponId);
  185. //新记录
  186. if (newWeaponConfig.level > synthesisMaxWeaponConfig.level) {
  187. this.synthesisMaxWeaponId = newWeaponId;
  188. }
  189. //打点合成最高等级的枪
  190. let weChat = PlatformManager.impl as WeChatPlatform;
  191. if (weChat instanceof WeChatPlatform) {
  192. let level = synthesisMaxWeaponConfig.level;
  193. if (newWeaponConfig.level > synthesisMaxWeaponConfig.level) {
  194. level = newWeaponConfig.level;
  195. }
  196. weChat.branchAnalytics(branchIdType.Synthetic, String(level))
  197. }
  198. if(this.currentWeaponCell!=null){
  199. if(this.currentWeaponCell==sourceCell){
  200. this.currentWeaponCell=null;
  201. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.currentWeaponId);
  202. }else if(this.currentWeaponCell==targetCell){
  203. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.currentWeaponId);
  204. //如果比手上的好
  205. if(this.currentWeaponCell.weaponConfig && newWeaponConfig.level > this.currentWeaponCell.weaponConfig.level){
  206. this.EquipWeapon(targetCell);
  207. return;
  208. }
  209. }
  210. }
  211. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.WeaponCell);
  212. }
  213. /**
  214. * 添加一个武器到武器格子
  215. * @param cellId
  216. * @param weaponID
  217. */
  218. public AddWeapon(cellId: number, weaponID: number): void {
  219. for (let index = 0; index < this.__weaponCells.length; index++) {
  220. const element = this.__weaponCells[index];
  221. if (element.cellId == cellId) {
  222. element.weaponId = weaponID;
  223. element.lastOutputTime = director.getCurrentTime();
  224. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.WeaponCell);
  225. return;
  226. }
  227. }
  228. }
  229. /**
  230. * 删除武器
  231. * @param cellId
  232. */
  233. public RemoveWeapon(cellId: number): void {
  234. let cell:WeaponCell=this.FindCell(cellId);
  235. cell.weaponId=-1;
  236. if(cell==this.currentWeaponCell){
  237. this.currentWeaponCell=null;
  238. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.currentWeaponId);
  239. }
  240. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.WeaponCell);
  241. }
  242. // /**
  243. // * 卸下武器
  244. // */
  245. // public UnequipWeapon(cellId: number): void {
  246. // let id: number = this.__currentWeaponCell.weaponId;
  247. // this.currentWeaponId = -1;
  248. // this.__currentWeaponCell.lastOutputTime = 0;
  249. // this.AddWeapon(cellId, id);
  250. // }
  251. /**
  252. * 装配武器
  253. * @param weaponId
  254. */
  255. public EquipWeapon(sourceCell:WeaponCell): void {
  256. this.currentWeaponCell=sourceCell;
  257. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.WeaponCell);
  258. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.currentWeaponId);
  259. }
  260. /**
  261. * 武器空槽位置
  262. */
  263. public get WeaponEmptyCellCount(): number {
  264. let count: number = 0;
  265. this.__weaponCells.forEach(element => {
  266. if (element.weaponId < 0) {
  267. count++;
  268. }
  269. });
  270. return count;
  271. }
  272. /**
  273. * 寻找武器空槽位
  274. */
  275. public FindWeaponEmptyCell(): WeaponCell {
  276. for (let index = 0; index < this.__weaponCells.length; index++) {
  277. const element = this.__weaponCells[index];
  278. if (element.weaponId < 0) {
  279. return element;
  280. }
  281. }
  282. return null;
  283. }
  284. /**
  285. * 当前快捷可购买的武器
  286. */
  287. public get CurrentQuickBuyWeaponId(): number {
  288. return GameConfigManager.GetQuickBuyWeaponId(this.synthesisMaxWeaponId);
  289. }
  290. /**
  291. * 查询购买价格
  292. * @param weapon
  293. */
  294. public GetQuickBuyPrice(): number {
  295. return this.GetWeaponBuyPrice(this.CurrentQuickBuyWeaponId);
  296. }
  297. /**
  298. * 查询购买价格
  299. * @param weaponId
  300. */
  301. public GetWeaponBuyPrice(weaponId: number): number {
  302. //已购买的次数
  303. let buyCount: number = this.GetBuyCount(weaponId);
  304. let weaponConfig: any = GameConfigManager.GetWeaponConfig(weaponId);
  305. //价格
  306. let price: number = weaponConfig.consumeGold;
  307. //系数
  308. let coefficient: number = weaponConfig.coefficient;
  309. if (buyCount < 0) {
  310. buyCount = 0;
  311. }
  312. return Math.floor(price * Math.pow(coefficient, buyCount));
  313. }
  314. /**
  315. * 已购买次数
  316. * @param weaponId
  317. */
  318. public GetBuyCount(weaponId: number): number {
  319. let buyCount: number = 0;
  320. if (this.__buyHistory.has(weaponId)) {
  321. buyCount = this.__buyHistory.get(weaponId);
  322. }
  323. return buyCount;
  324. }
  325. /**
  326. * 购买武器
  327. * @param type 0 金币购买 1钻石购买 2视频购买
  328. * @param weaponId
  329. */
  330. public BuyWeapon(type: number, weaponId: number): boolean {
  331. let price: number;
  332. let weaponConfig: any
  333. //找到空槽位
  334. let weaponCell: WeaponCell = this.FindWeaponEmptyCell();
  335. if (weaponCell == null) {
  336. NoticeManager.ShowPrompt("没有空槽位了!");
  337. return false;
  338. }
  339. if (type == 0) {
  340. price = this.GetWeaponBuyPrice(weaponId);
  341. if (this.gold < price) {
  342. NoticeManager.ShowPrompt("金币不足,不能购买武器!");
  343. return false;
  344. }
  345. //扣钱
  346. let currentGold: number = this.gold;
  347. currentGold -= price;
  348. if (currentGold < 0) {
  349. currentGold = 0;
  350. }
  351. this.gold = currentGold;
  352. //记录购买次数
  353. weaponConfig = GameConfigManager.GetWeaponConfig(weaponId);
  354. let buyCount: number = this.GetBuyCount(weaponId);
  355. buyCount++;
  356. if (buyCount > weaponConfig.frequencyLimit) {
  357. buyCount = weaponConfig.frequencyLimit;
  358. }
  359. this.__buyHistory.set(weaponId, buyCount);
  360. } else if (type == 1) {
  361. let weaponConfig: any = GameConfigManager.GetWeaponConfig(weaponId);
  362. price = weaponConfig.consumeDiamond;
  363. if (this.diamond < price) {
  364. NoticeManager.ShowPrompt("宝石不足,不能购买武器!");
  365. return false;
  366. }
  367. //扣钱
  368. let currentDiamond: number = this.gold;
  369. currentDiamond -= price;
  370. if (currentDiamond < 0) {
  371. currentDiamond = 0;
  372. }
  373. this.diamond = currentDiamond;
  374. }
  375. //发货
  376. this.AddWeapon(weaponCell.cellId, weaponId);
  377. return true;
  378. }
  379. /**
  380. * 通过武器槽ID查找
  381. * @param id
  382. */
  383. public FindCell(id: number): WeaponCell {
  384. for (let index = 0; index < this.__weaponCells.length; index++) {
  385. const element = this.__weaponCells[index];
  386. if (element.cellId == id) {
  387. return element;
  388. }
  389. }
  390. return null;
  391. }
  392. /**
  393. * 武器格子列表
  394. */
  395. public get weaponCells(): WeaponCell[] {
  396. return this.__weaponCells;
  397. }
  398. protected OnReadByLocal(data: any): void {
  399. //7日登录
  400. let date:Date=new Date();
  401. if(date.getTime()-this.lastSignTime>24*60*60*1000){
  402. this.signDay++;
  403. this.lastGetGoldTime=date.getTime();
  404. }
  405. let currentTime: number = director.getCurrentTime();
  406. //武器格子
  407. let weaponCells: any[] = data.weaponCells;
  408. this.__weaponCells = [];
  409. let weaponCell: WeaponCell;
  410. if (weaponCells != null) {
  411. weaponCells.forEach(element => {
  412. weaponCell = new WeaponCell();
  413. for (const key in element) {
  414. if (Object.prototype.hasOwnProperty.call(element, key) && Object.prototype.hasOwnProperty.call(weaponCell, key)) {
  415. const item = element[key];
  416. weaponCell[key] = item;
  417. }
  418. }
  419. weaponCell.lastOutputTime = currentTime;
  420. this.__weaponCells.push(weaponCell);
  421. });
  422. }
  423. //当前武器格
  424. if(data.currentWeaponCellId>0){
  425. this.currentWeaponCell=this.FindCell(data.currentWeaponCellId);
  426. this.currentWeaponCell.lastOutputTime = currentTime;
  427. }
  428. //自动合成Buffer剩余时间
  429. if (data.autoSynthesisTime > 0) {
  430. let buffer: AutoSyntheticBuffer = new AutoSyntheticBuffer("AutoSynthesis", data.autoSynthesisTime);
  431. BufferManager.RunBuffer(buffer);
  432. }
  433. //加速Buffer
  434. if (data.accelerateTime > 0) {
  435. let buffer: AccelerateBuffer = new AccelerateBuffer("Accelerate", data.accelerateTime);
  436. BufferManager.RunBuffer(buffer);
  437. }
  438. }
  439. protected OnSaveToLocal(data: any): void {
  440. data.weaponCells = this.__weaponCells;
  441. if(this.currentWeaponCell!=null){
  442. data.currentWeaponCellId = this.currentWeaponCell.cellId;
  443. }else{
  444. data.currentWeaponCellId=-1;
  445. }
  446. //自动合成Buffer剩余时间
  447. let buffers: IBuffer[] = BufferManager.GetBufferGroup("AutoSynthesis");
  448. if (buffers != null && buffers.length > 0) {
  449. let buffer: IBuffer = buffers[0];
  450. data.autoSynthesisTime = buffer.GetTimeRemaining();
  451. } else {
  452. data.autoSynthesisTime = 0;
  453. }
  454. //加速Buffer
  455. buffers = BufferManager.GetBufferGroup("Accelerate");
  456. if (buffers != null && buffers.length > 0) {
  457. let accelerateBuffer: AccelerateBuffer = buffers[0] as AccelerateBuffer;
  458. data.accelerateTime = accelerateBuffer.GetTimeRemaining();
  459. } else {
  460. data.accelerateTime = 0;
  461. }
  462. }
  463. /**
  464. * 领取记录
  465. */
  466. get signGetRecord():number[]{
  467. return this.GetProperty(GamePropertys.signGetRecord);
  468. }
  469. set signGetRecord(value:number[]){
  470. this.SetProperty(GamePropertys.signGetRecord,value);
  471. }
  472. /**
  473. * 自动领取奖励
  474. */
  475. AutoSignAward():void{
  476. let index:number=this.GetSignAwardIndex();
  477. this.GetSignAward(index+1);
  478. }
  479. /**
  480. * 领取奖励
  481. * @param day 1-7
  482. */
  483. private GetSignAward(day:number):void{
  484. if(day<1||day>7){
  485. throw new Error("7日索引范围必须在1-7");
  486. }
  487. let state:number=this.GetSignAwardByDay(day);
  488. if(state>0){
  489. throw new Error("重复领取")
  490. }
  491. let list:number[]=this.signGetRecord;
  492. list[day-1]=1;
  493. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED,GamePropertys.signGetRecord);
  494. //发放奖励
  495. let config:any=GameConfigManager.GetSignConfig(day);
  496. //0.金币 1.钻石 2.枪 3.栅栏
  497. switch (config.type) {
  498. case 0:
  499. this.gold+=config.number;
  500. NoticeManager.ShowPrompt("金币+"+config.number);
  501. break;
  502. case 1:
  503. this.diamond+=config.number;
  504. NoticeManager.ShowPrompt("钻石+"+config.number);
  505. break;
  506. case 2:
  507. let cell:WeaponCell=this.FindWeaponEmptyCell();
  508. if(cell!=null){
  509. this.AddWeapon(cell.cellId,config.number);
  510. }
  511. break;
  512. case 3:
  513. this.currentFenceId=config.number;
  514. break;
  515. }
  516. }
  517. /**
  518. * 获取7日登录领取状态
  519. * @param day 1-7
  520. */
  521. GetSignAwardByDay(day:number):number{
  522. if(day>7){
  523. throw new Error("超出7天")
  524. }
  525. return this.signGetRecord[day-1];
  526. }
  527. /**
  528. * 获取领取奖励的天数索引
  529. */
  530. GetSignAwardIndex():number{
  531. for (let index = 0; index < this.signDay; index++) {
  532. if(this.GetSignAwardByDay(index+1)==0){
  533. let config:any=GameConfigManager.GetSignConfig(index+1);
  534. //0.金币 1.钻石 2.枪 3.栅栏
  535. switch (config.type) {
  536. case 2:
  537. if(this.WeaponEmptyCellCount>0){
  538. return index;
  539. }else{
  540. NoticeManager.ShowPrompt("武器槽没有空位了!");
  541. }
  542. break;
  543. default:
  544. return index;
  545. }
  546. }
  547. }
  548. return -1;
  549. }
  550. private static instance: GameModel;
  551. public static get single(): GameModel {
  552. if (this.instance == null) {
  553. this.instance = new GameModel();
  554. }
  555. return this.instance;
  556. }
  557. /**
  558. * 自动合成Buffer剩余时间
  559. */
  560. get autoSynthesisTime(): number {
  561. return this.GetProperty(GamePropertys.autoSynthesisTime);
  562. }
  563. /**
  564. * 加速Buffer剩余时间
  565. */
  566. get accelerateTime(): number {
  567. return this.GetProperty(GamePropertys.accelerateTime);
  568. }
  569. /**
  570. * 当前关卡
  571. */
  572. get currentLevel(): number {
  573. return this.GetProperty(GamePropertys.currentLevel);
  574. }
  575. set currentLevel(value: number) {
  576. this.SetProperty(GamePropertys.currentLevel, value);
  577. }
  578. /**
  579. * 试用栅栏ID
  580. */
  581. trialFenceId: number = -1;
  582. /**
  583. * 当前栅栏ID
  584. */
  585. get currentFenceId(): number {
  586. return this.GetProperty(GamePropertys.currentFenceId);
  587. }
  588. set currentFenceId(value: number) {
  589. this.SetProperty(GamePropertys.currentFenceId, value);
  590. }
  591. /**
  592. * 栅栏ID (包括试用)
  593. */
  594. get fenceId(): number {
  595. if (this.trialFenceId > 0) {
  596. return this.trialFenceId;
  597. }
  598. return this.currentFenceId;
  599. }
  600. /**
  601. * 金币
  602. */
  603. get gold(): number {
  604. return this.GetProperty(GamePropertys.gold);
  605. }
  606. set gold(value: number) {
  607. this.SetProperty(GamePropertys.gold, value);
  608. }
  609. /**
  610. * 积分
  611. */
  612. get integral(): number {
  613. return this._interal
  614. }
  615. private _interal: number;
  616. set integral(value: number) {
  617. this._interal = value;
  618. this.DispatchEvent(DataModelEventType.PROPERTY_CHANGED, GamePropertys.integral);
  619. }
  620. /**
  621. * 钻石
  622. */
  623. get diamond(): number {
  624. return this.GetProperty(GamePropertys.diamond);
  625. }
  626. set diamond(value: number) {
  627. this.SetProperty(GamePropertys.diamond, value);
  628. }
  629. /**
  630. * 击杀数量
  631. */
  632. get killCount(): number {
  633. return this.GetProperty(GamePropertys.killCount);
  634. }
  635. set killCount(value: number) {
  636. this.SetProperty(GamePropertys.killCount, value);
  637. }
  638. /**
  639. * 怒气值
  640. */
  641. get angerCount(): number {
  642. return this.GetProperty(GamePropertys.angerCount);
  643. }
  644. set angerCount(value: number) {
  645. this.SetProperty(GamePropertys.angerCount, value);
  646. }
  647. /**
  648. * 当前最大合成等级
  649. */
  650. get synthesisMaxWeaponId(): number {
  651. return this.GetProperty(GamePropertys.synthesisMaxWeaponId);
  652. }
  653. set synthesisMaxWeaponId(value: number) {
  654. this.SetProperty(GamePropertys.synthesisMaxWeaponId, value);
  655. }
  656. /**
  657. * 上一次领取金币的时间
  658. */
  659. get lastGetGoldTime(): number {
  660. return this.GetProperty(GamePropertys.synthesisMaxWeaponId);
  661. }
  662. set lastGetGoldTime(value: number) {
  663. this.SetProperty(GamePropertys.synthesisMaxWeaponId, value);
  664. }
  665. /**
  666. * 登录天数
  667. */
  668. get signDay():number{
  669. return this.GetProperty(GamePropertys.signDay);
  670. }
  671. /**
  672. * 登录天数
  673. */
  674. set signDay(value:number){
  675. this.SetProperty(GamePropertys.signDay,value);
  676. }
  677. /**
  678. * 上次登录日期
  679. */
  680. get lastSignTime():number{
  681. return this.GetProperty(GamePropertys.lastSignTime);
  682. }
  683. /**
  684. * 登录天数
  685. */
  686. set lastSignTime(value:number){
  687. this.SetProperty(GamePropertys.lastSignTime,value);
  688. }
  689. }