Prechádzať zdrojové kódy

Merge branch 'master' of http://120.79.128.142:3000/904118851/car

xx 1 rok pred
rodič
commit
d75a26e763

+ 813 - 0
assets/resources/ui/loading_view.prefab

@@ -0,0 +1,813 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "loading_view",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "loading_view",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 10
+      },
+      {
+        "__id__": 24
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 30
+      },
+      {
+        "__id__": 32
+      },
+      {
+        "__id__": 34
+      }
+    ],
+    "_prefab": {
+      "__id__": 36
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "public_bg",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      },
+      {
+        "__id__": 7
+      }
+    ],
+    "_prefab": {
+      "__id__": 9
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 4
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 1080,
+      "height": 1920
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "7fsdAg6SlFL5Ck69l8Z0ou"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "433b4378-f731-459b-be68-93cd8b0899a6@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "f7hDm2w+FEaLmp+6NqxTEd"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 8
+    },
+    "_alignFlags": 45,
+    "_target": null,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_horizontalCenter": 0,
+    "_verticalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 1080,
+    "_originalHeight": 1920,
+    "_alignMode": 2,
+    "_lockFlags": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "d1YnMlMudMUKBRVOJP6Qvl"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "98r7ZicNtPlr0h5a1bYQTY",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "ProgressBar",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 11
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 17
+      },
+      {
+        "__id__": 19
+      },
+      {
+        "__id__": 21
+      }
+    ],
+    "_prefab": {
+      "__id__": 23
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": -317.908,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Bar",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 10
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 12
+      },
+      {
+        "__id__": 14
+      }
+    ],
+    "_prefab": {
+      "__id__": 16
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": -401,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 11
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 13
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 800,
+      "height": 17
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "20KYQ8lqFP3qmj1BkMGNGs"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 11
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 15
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "24a704da-2867-446d-8d1a-5e920c75e09d@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 1,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "feddqNsohJDa2lZGsrDnP3"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "36/YkVF8RFOZS2FfN6xTKR",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 10
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 18
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 822,
+      "height": 37
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "88kJrvL4FHFLRSCxFw7sdJ"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 10
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 20
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "9fd900dd-221b-4f89-8f2c-fba34243c835@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 1,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "7e9x4Hxm5Bn65CvonC7mD/"
+  },
+  {
+    "__type__": "cc.ProgressBar",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 10
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 22
+    },
+    "_barSprite": {
+      "__id__": 14
+    },
+    "_mode": 0,
+    "_totalLength": 800,
+    "_progress": 1,
+    "_reverse": false,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "a35VviRS9LMqkssMG2zGGF"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "9aUi5M0VtCZqpw18INfu1Z",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Label",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 25
+      },
+      {
+        "__id__": 27
+      }
+    ],
+    "_prefab": {
+      "__id__": 29
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": -431.515,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 24
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 26
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 72.265625,
+      "height": 63
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "f2cr+2hpZHTaN5mlmZI6Jp"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 24
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 28
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_string": "0%",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 50,
+    "_fontSize": 50,
+    "_fontFamily": "Arial",
+    "_lineHeight": 50,
+    "_overflow": 0,
+    "_enableWrapText": true,
+    "_font": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": true,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_enableOutline": false,
+    "_outlineColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_outlineWidth": 2,
+    "_enableShadow": false,
+    "_shadowColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_shadowOffset": {
+      "__type__": "cc.Vec2",
+      "x": 2,
+      "y": 2
+    },
+    "_shadowBlur": 2,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "2c15Z2+cZD1KddDZLgPxA3"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "1e+YRe3GFEOIHJfUa8723f",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 31
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 1080,
+      "height": 1920
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "6bsbYGzexGPYgqJ56vwJId"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 33
+    },
+    "_alignFlags": 45,
+    "_target": null,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_horizontalCenter": 0,
+    "_verticalCenter": 0,
+    "_isAbsLeft": false,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 100,
+    "_originalHeight": 100,
+    "_alignMode": 2,
+    "_lockFlags": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "32/gDcnGRJh572yeNXbyer"
+  },
+  {
+    "__type__": "2cd173lr2JD1Jqq4X6lWcBG",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 35
+    },
+    "loading_bar": {
+      "__id__": 10
+    },
+    "lab_loading_bar": {
+      "__id__": 24
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "feSj9wy+1MgrI4OhWQ28I4"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "c46/YsCPVOJYA4mWEpNYRx",
+    "instance": null,
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/resources/ui/loading_view.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.50",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "33857b54-ed63-449e-80a2-aa5c00780d53",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "loading_view"
+  }
+}

+ 6 - 3
assets/resources/ui/select_area.prefab

@@ -143,7 +143,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920.0000000000002
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -2912,7 +2912,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "select_area_info",
+    "_name": "note_info",
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
@@ -3197,7 +3197,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920.0000000000002
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -3294,6 +3294,9 @@
       "__uuid__": "529e8d50-2a59-4b9e-afff-95478e2de2a3",
       "__expectedType__": "cc.Prefab"
     },
+    "note_info": {
+      "__id__": 122
+    },
     "_id": ""
   },
   {

+ 1 - 0
assets/script/config.ts

@@ -94,6 +94,7 @@ export class config  {
         ui_gameplay_view:"ui/gameplay_view",
         ui_select_area:"ui/select_area",
         ui_unLock_view:"ui/unLock_view",
+        loading_view:"ui/loading_view",
         home:"ui/home",
         rank:"ui/rank",
     }

+ 10 - 105
assets/script/main.ts

@@ -9,6 +9,7 @@ import { uiManager } from './manager/uiManager';
 import { userDataManager } from './manager/userDataManager';
 import { imageCacheManager } from './manager/imageCacheManager';
 import { home } from './ui/home/home';
+import { loading_view } from './ui/loading_view/loading_view';
 const { ccclass, property } = _decorator;
 
 @ccclass('main')
@@ -22,119 +23,23 @@ export class main extends Component {
         // PhysicsSystem2D.instance.fixedTimeStep = 1 / 60;
         tools.init(this.node)
         this.home_node.removeAllChildren()
-        this.initData(()=>{
-            this.getUserCarList(this.initConfig.bind(this))
-        })
-
         uiManager.Instance().init(this.ui_parent,this.laoding_view_wait,this.send_msg_wait)
-    }
-
-    onAllDataLoadingFinish(){
-        imageCacheManager.start_cache(this.onAllResLoadingFinish.bind(this))
-    }
 
-    onAllResLoadingFinish(){
-        uiManager.Instance().showUi(config.UI.home,this.home_node,(node:Node)=>{
-            node.getComponent(home).init()
-            this.home_node.active = true
-        })
+        this.showLoadingView()
     }
-    getUserCarList(cb){
-        http.post(config.API.user_car_list,null,(err,d)=>{
-            if(!err){
-                let nd = JSON.parse(d)
-                if(nd.code === config.status.SUCCESS){
-                    userDataManager.user_car_list = nd.content
-                    // console.log("user_car_list", userDataManager.user_car_list)
-                    if(cb!=null){
-                        cb()
-                    }
-                }   
-            }
-        },'GET')
-    }
-
-    initConfig(){
-        let count = 2;
-        let num = 0;
-        let call_back = ()=>{
-            if(num>=count){
-                this.onAllDataLoadingFinish()
-            }
-        }
-        http.get(config.STATIC_API.levels,(err,d)=>{
-            if(!err){
-                let data = JSON.parse(d)
-                if(data.code===config.status.SUCCESS){
-                    tools.levels =  JSON.parse(data.content.levels_info)
-                    tools.tpl_list = data.content.tpl_list
-                    tools.game_config = JSON.parse(data.content.levels_config)
-                    // console.log("tools.levels",tools.levels)
-                    // console.log("tools.tpl_list",tools.tpl_list)
-                    // console.log("tools.game_config",tools.game_config)
-                    num++;
-                    call_back()
-                }
-            }else{
-                console.log("initData err",err)
-            }
-        })
 
-        http.get(config.STATIC_API.car_list,(err,d)=>{
-            if(!err){
-                let data = JSON.parse(d)
-                if(data.code===config.status.SUCCESS){
-                    tools.all_car_list =  data.content
-                    console.log("tools.all_car_list",tools.all_car_list)
-                    num++;
-                    call_back()
-                }
-            }else{
-                console.log("all_car_list err",err)
-            }
-        })
-    }
-    initData(login_finish_cb){
-        this.Login((openid)=>{
-            GameManager.openId =  openid
-            SdkUtil.getUserInfo((data:userInfo)=>{
-                let opt;
-                if(data!=null){
-                    opt = {"openid":GameManager.openId,"platform":config.Platform.platform,"avatarUrl":data.avatarUrl,"nickName":data.nickName,"region_id":1}
-                }else{
-                    GameManager.openId = "asd"
-                    opt = {"openid":GameManager.openId,"platform":config.Platform.platform,"region_id":1,"nickName":"大靓仔"}
-                }
-                http.post(config.API.login,opt,(err,d)=>{
-                    if(!err){
-                        let nd = JSON.parse(d)
-                        if(nd.code === config.status.SUCCESS){
-                            userDataManager.user_data = nd.content
-                            if(login_finish_cb!=null){
-                                login_finish_cb()
-                            }
-                        }
-                    }
-                })
+    showLoadingView() {
+        uiManager.Instance().showUi(config.UI.loading_view, this.node, (node:Node)=>{
+            node.getComponent(loading_view).startLoading(()=>{
+                this.showHomeView()
             })
         })
-
     }
 
-    Login(call_back){
-        SdkUtil.login((res)=>{
-            if(res!=null){
-                http.post(config.API.get_dyopen_id,res,(err,data)=>{
-                    if(!err){
-                        let d = JSON.parse(data)
-                        if(d.code === config.status.SUCCESS){
-                            call_back(d.content.openid)
-                        }
-                    }
-                })
-            }else{
-                call_back("123")
-            }
+    showHomeView() {
+        uiManager.Instance().showUi(config.UI.home,this.home_node,(node:Node)=>{
+            node.getComponent(home).init()
+            this.home_node.active = true
         })
     }
 }

+ 14 - 0
assets/script/tools.ts

@@ -5,6 +5,7 @@ import { main } from './main';
 import { car_item_data, edit_game_config_data, model_item_data, userData } from './data';
 import { game } from './game/game';
 import { Util } from './util';
+import { http } from './http';
 const { ccclass, property } = _decorator;
 
 @ccclass('tools')
@@ -60,6 +61,19 @@ export class tools  {
             }
         }); 
     }
+
+    // stype 1:注册 2:重新设置
+    public static requestUserSetRegion(region_id:number,stype:number,cb) {
+        let opt = {'region_id':region_id, 'stype':stype}
+        http.post(config.API.user_set_region, opt, (err,d)=>{
+            let nd = JSON.parse(d)
+                if(nd.code === config.status.SUCCESS){
+                    if(cb!=null){
+                        cb(nd.content)
+                    }
+                }  
+        })
+    }
 }
 
 

+ 9 - 0
assets/script/ui/loading_view.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.2.0",
+  "importer": "directory",
+  "imported": true,
+  "uuid": "da1e0ef1-e8fd-4ecf-91b2-bd95c12d7d65",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 197 - 0
assets/script/ui/loading_view/loading_view.ts

@@ -0,0 +1,197 @@
+import { _decorator, Component, Label, Node, ProgressBar } from 'cc';
+import { SdkUtil } from '../../sdkUtil';
+import { http } from '../../http';
+import { config } from '../../config';
+import { GameManager } from '../../GameManager';
+import { userDataManager } from '../../manager/userDataManager';
+import { area_item_data, userInfo } from '../../data';
+import { tools } from '../../tools';
+import { imageCacheManager } from '../../manager/imageCacheManager';
+import { uiManager } from '../../manager/uiManager';
+import { select_area } from '../select_area/select_area';
+const { ccclass, property } = _decorator;
+
+@ccclass('loading_view')
+export class loading_view extends Component {
+    @property(Node) loading_bar:Node = null;
+    @property(Node) lab_loading_bar:Node = null;
+    private m_finish_load_call = null;
+    private m_pause_status = false;
+
+    startLoading(finish_load_call) {
+        this.m_finish_load_call = finish_load_call;
+        let progress = 0
+        this.loading_bar.getComponent(ProgressBar).progress = progress;
+        
+        this.schedule(()=>{
+            if(this.m_pause_status){
+                return;
+            }
+            progress += 0.1
+            // console.log('progress=',progress)
+            
+            this.loading_bar.getComponent(ProgressBar).progress = progress
+            this.lab_loading_bar.getComponent(Label).string = `${(progress*100).toFixed()}%`
+
+            switch (progress) {
+                case 0.1:
+                    this.m_pause_status = true
+                    this.initUserData(()=>{
+                        if(userDataManager.user_data.region_id<=0) {
+                            this.setUserSelectArea()
+                        } else {
+                            this.m_pause_status = false
+                        }
+                    })
+                    break
+                case 0.2:
+                    this.m_pause_status = true
+                    this.getUserCarList(()=>{
+                        this.m_pause_status = false
+                    })
+                    break
+                case 0.5:
+                    this.m_pause_status = true
+                    this.initLevels(()=>{
+                        this.m_pause_status = false
+                    })
+                    break
+                case 0.6:
+                    this.m_pause_status = true
+                    this.initAllCarList(()=>{
+                        this.m_pause_status = false
+                    })
+                    break
+                case 0.7:
+                    this.m_pause_status = true
+                    imageCacheManager.start_cache(()=>{
+                        this.m_pause_status = false
+                    })
+                    break
+                default:
+                    break;
+            }
+
+            if(progress >= 1) {
+                if(this.m_finish_load_call!=null){
+                    this.m_finish_load_call()
+                }
+                this.node.removeFromParent()
+                this.unscheduleAllCallbacks()
+                return;
+            } 
+
+        },0.1)
+    }
+
+    private initUserData(login_finish_cb){
+        this.userLogin((openid)=>{
+            GameManager.openId =  openid
+            SdkUtil.getUserInfo((data:userInfo)=>{
+                let opt;
+                if(data!=null){
+                    opt = {"openid":GameManager.openId,"platform":config.Platform.platform,"avatarUrl":data.avatarUrl,"nickName":data.nickName}
+                }else{
+                    opt = {"openid":GameManager.openId,"platform":config.Platform.platform,"nickName":"大靓仔"}
+                }
+                http.post(config.API.login,opt,(err,d)=>{
+                    if(!err){
+                        let nd = JSON.parse(d)
+                        if(nd.code === config.status.SUCCESS){
+                            userDataManager.user_data = nd.content
+                            console.log('user_data=',userDataManager.user_data)
+                            if(login_finish_cb!=null){
+                                login_finish_cb()
+                            }
+                        }
+                    }
+                })
+            })
+        })
+
+    }
+
+    private userLogin(cb){
+        SdkUtil.login((res)=>{
+            if(res!=null){
+                http.post(config.API.get_dyopen_id,res,(err,data)=>{
+                    if(!err){
+                        let d = JSON.parse(data)
+                        if(d.code === config.status.SUCCESS){
+                            cb(d.content.openid)
+                        }
+                    }
+                })
+            }else{
+                cb("456")
+            }
+        })
+    }
+
+    private setUserSelectArea() {
+        uiManager.Instance().showUi(config.UI.ui_select_area, this.node, (node:Node)=>{
+            node.getComponent(select_area).initView(false, (obj:select_area, data:area_item_data)=>{
+                tools.requestUserSetRegion(data.id, 1, (d)=>{
+                    userDataManager.user_data.region_id = d.region_id
+                    userDataManager.user_data.region_pid = d.region_pid
+                    this.m_pause_status = false
+                    obj.closeSelf()
+                })
+            })
+        })
+    }
+
+    private getUserCarList(cb){
+        http.post(config.API.user_car_list,null,(err,d)=>{
+            if(!err){
+                let nd = JSON.parse(d)
+                if(nd.code === config.status.SUCCESS){
+                    userDataManager.user_car_list = nd.content
+                    // console.log("user_car_list", userDataManager.user_car_list)
+                    if(cb!=null){
+                        cb()
+                    }
+                }   
+            }
+        },'GET')
+    }
+
+    private initLevels(cb) {
+        http.get(config.STATIC_API.levels,(err,d)=>{
+            if(!err){
+                let data = JSON.parse(d)
+                if(data.code===config.status.SUCCESS){
+                    tools.levels =  JSON.parse(data.content.levels_info)
+                    tools.tpl_list = data.content.tpl_list
+                    tools.game_config = JSON.parse(data.content.levels_config)
+                    // console.log("tools.levels",tools.levels)
+                    // console.log("tools.tpl_list",tools.tpl_list)
+                    // console.log("tools.game_config",tools.game_config)
+                    if(cb!=null) {
+                        cb()
+                    }
+                }
+            }else{
+                console.log("initLevels err",err)
+            }
+        })
+    }
+
+    private initAllCarList(cb) {
+        http.get(config.STATIC_API.car_list,(err,d)=>{
+            if(!err){
+                let data = JSON.parse(d)
+                if(data.code===config.status.SUCCESS){
+                    tools.all_car_list =  data.content
+                    // console.log("tools.all_car_list",tools.all_car_list)
+                    if(cb!=null) {
+                        cb()
+                    }
+                }
+            }else{
+                console.log("init all_car_list err",err)
+            }
+        })
+    }
+}
+

+ 9 - 0
assets/script/ui/loading_view/loading_view.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "2cd17de5-af62-43d4-9aaa-e17ea559c046",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 21 - 3
assets/script/ui/select_area/select_area.ts

@@ -19,15 +19,18 @@ export class select_area extends base_ui {
     @property(Node) city_btn_true:Node = null
     @property(Node) list_content:Node = null
     @property(Prefab) list_item:Prefab = null
+    @property(Node) note_info:Node = null
     private province_list = []
     private province_selected_index:number = 0
     private province_selected_data:area_item_data = null
     private city_selected_index:number = 0
     private city_selected_data:area_item_data = null
+    private m_is_modified:boolean = true //是否为修改
+    private m_city_cb = null
 
     protected start(): void {
         this.onButtonListen(this.btn_close, ()=>{
-            this.close()
+            this.closeSelf()
         })
         this.onButtonListen(this.province_btn_next, ()=>{
             this.onClickProviceNext()
@@ -42,6 +45,19 @@ export class select_area extends base_ui {
         this.requestProvinceListData()
     }
 
+    initView(is_modified:boolean, city_cb) {
+        this.m_is_modified = is_modified
+        this.m_city_cb = city_cb
+        if(!this.m_is_modified) {
+            this.btn_close.active = false
+            this.note_info.active = false
+        }
+    }
+
+    closeSelf() {
+        this.close()
+    }
+
     private onClickProviceNext() {
         this.img_title.getComponent(Sprite).spriteFrame = this.sf_city
         this.province_btn_node.active = false
@@ -62,8 +78,10 @@ export class select_area extends base_ui {
     }
 
     private onClickCityTrue() {
-        console.log('province:',this.province_selected_data.name,'  ','city:',this.city_selected_data.name)
-        this.close()
+        // console.log('province:',this.province_selected_data.name,'  ','city:',this.city_selected_data.name)
+        if(this.m_city_cb) {
+            this.m_city_cb(this,this.city_selected_data)
+        }
     }
 
     private requestProvinceListData() {