GameModel.ts 22 KB

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