فهرست منبع

服务端自定义数据 对象改number

薛鸿潇 5 سال پیش
والد
کامیت
4ad121108e
1فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 5 5
      assets/script/game/data/GameData.ts

+ 5 - 5
assets/script/game/data/GameData.ts

@@ -16,7 +16,7 @@ export class GameData {
 
     public configs: any = {};
 
-    public props: Map<number, object>;
+    public props: Map<number, number>;
 
 
     /**
@@ -38,7 +38,7 @@ export class GameData {
         }
 
         if (this.props == null) {
-            this.props = new Map<number, object>();
+            this.props = new Map<number, number>();
         }
 
         this.initProps(response.data.gameUserData);
@@ -49,7 +49,7 @@ export class GameData {
     /**
      * 保存单个数据
      */
-    public async setProp(key: GameProp, value: object) {
+    public async setProp(key: GameProp, value: number) {
         let data = {
             key: key + '',
             value: value + ''
@@ -62,7 +62,7 @@ export class GameData {
     /**
      * 保存多个数据
      */
-    public async setProps(arr: { key: GameProp, value: object }[]) {
+    public async setProps(arr: { key: GameProp, value: number }[]) {
         let needProp = {};
         for (let i = 0; i < arr.length; i++) {
             needProp[arr[i].key + ''] = arr[i].value + "";
@@ -80,7 +80,7 @@ export class GameData {
     }
 
     /** 获取属性 */
-    public getProp(key: GameProp): object {
+    public getProp(key: GameProp): number {
         if (this.props == null) {
             return null;
         }