future 1 rok temu
rodzic
commit
35f1ef5006
3 zmienionych plików z 56 dodań i 45 usunięć
  1. 22 22
      assets/edit_game.scene
  2. 1 1
      assets/script/config.ts
  3. 33 22
      assets/script/http.ts

+ 22 - 22
assets/edit_game.scene

@@ -122,8 +122,8 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 960.0000000000001,
-      "y": 960.0000000000002,
+      "x": 960,
+      "y": 960,
       "z": 0
     },
     "_lrot": {
@@ -212,8 +212,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920.0000000000002,
-      "height": 1920.0000000000002
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -350,7 +350,7 @@
     "_priority": 0,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 960.0000000000001,
+    "_orthoHeight": 960,
     "_near": 0,
     "_far": 1000,
     "_color": {
@@ -539,8 +539,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 840.0000000000001,
-      "height": 1920.0000000000002
+      "width": 840,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -7339,7 +7339,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -510.0000000000001,
+      "y": -510,
       "z": 0
     },
     "_lrot": {
@@ -7396,7 +7396,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 420.00000000000006,
+      "x": 420,
       "y": 0,
       "z": 0
     },
@@ -7796,7 +7796,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 800.0000000000001,
+      "width": 800,
       "height": 860
     },
     "_anchorPoint": {
@@ -7914,7 +7914,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -285.00000000000006,
+      "x": -285,
       "y": -105,
       "z": 0
     },
@@ -8197,7 +8197,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 800.0000000000001,
+      "width": 800,
       "height": 210
     },
     "_anchorPoint": {
@@ -8281,7 +8281,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 840.0000000000001,
+      "width": 840,
       "height": 900
     },
     "_anchorPoint": {
@@ -19662,8 +19662,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 840.0000000000001,
-      "height": 1920.0000000000002
+      "width": 840,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -21557,7 +21557,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 750.133,
+      "x": 750.1330000000002,
       "y": 0,
       "z": 0
     },
@@ -182798,8 +182798,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 419.9999999999999,
-      "height": 1870.0000000000002
+      "width": 419.9999999999998,
+      "height": 1870
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -183023,8 +183023,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 419.9999999999999,
-      "height": 1920.0000000000002
+      "width": 419.9999999999998,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -188942,8 +188942,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920.0000000000002,
-      "height": 1920.0000000000002
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 1 - 1
assets/script/config.ts

@@ -4,7 +4,7 @@ const { ccclass, property } = _decorator;
 
 export class config {
     static debug = true;
-    static domain = "https://zcapi.xwrun.com";
+    static domain = "https://tstzcapi.hainanmlwl.com";
     static version = '调试 v2.1.0'
     static is_MAC_edit = false; //目前临时处理:如果是Mac并且浏览器打开了检查时设置为true,正式打包需要设置为false
     static LevelType = {

+ 33 - 22
assets/script/http.ts

@@ -1,15 +1,14 @@
 import { _decorator, Component, Node } from 'cc';
 import { config } from './config';
+import { tools } from './tools';
 const { ccclass, property } = _decorator;
 @ccclass('http')
 export class http  {
-    public static domain  = "https://zcapi.xwrun.com";
-
     static post(url,data,call_back){
-         var xml =  new XMLHttpRequest()
-         xml.open('POST',http.domain+url)
-         xml.setRequestHeader('Content-Type','application/json');
-         xml.send(JSON.stringify(data));
+        var xml =  new XMLHttpRequest()
+        xml.open('POST',config.domain+url)
+        xml.setRequestHeader('Content-Type','application/json');
+        xml.send(JSON.stringify(data));
         var array:String[] = ['loadstart','abort', 'error', 'load', 'loadend', 'timeout'];
         array.forEach(function (eventName) {
             xml[('on' + eventName) as 'onloadstart' | 'onabort' | 'onerror' | 'onload' | 'onloadend' | 'ontimeout'] = function () {
@@ -50,13 +49,16 @@ export class http  {
             } else if (xml.readyState === 0) {
                 call_back( 'Request hasn\'t been initiated!',null);
                 console.log("status ==", 'Request hasn\'t been initiated!')
+            } else {
+                console.log('请求出错=',url)
+                tools.showToast('请求出错')
             }
         };
     }
 
     static get(url,call_back){
         var xml =  new XMLHttpRequest()
-        xml.open('GET',http.domain+url)
+        xml.open('GET',config.domain+url)
         xml.setRequestHeader('Content-Type','application/json');
         xml.send()
         var array:String[] = ['loadstart','abort', 'error', 'load', 'loadend', 'timeout'];
@@ -79,10 +81,13 @@ export class http  {
 
         // Special event
         xml.onreadystatechange = function () {
-            if (xml.readyState === 4 && xml.status >= 200) {
+            if(xml.readyState === 4 && xml.status >= 200) {
                 call_back(null,xml.responseText);
             } else if (xml.status === 404) {
                 call_back('404 page not found!',null);
+            } else {
+                console.log('请求出错=',url)
+                tools.showToast('请求出错')
             } 
         }
     }
@@ -117,7 +122,7 @@ export class http  {
 
     public static run_get(url,call_back){
         var xml =  new XMLHttpRequest()
-        xml.open('GET',http.domain+url)
+        xml.open('GET',config.domain+url)
         xml.setRequestHeader('Content-Type','application/json');
         xml.send();
    
@@ -135,24 +140,27 @@ export class http  {
                }else if (eventName === 'onerror') {
    
                }
-               console.log("str==",str)
-               console.log("lstr==",lstr)
+            //    console.log("str==",str)
+            //    console.log("lstr==",lstr)
            };
        });
 
        // Special event
        xml.onreadystatechange = function () {
-           if (xml.readyState === 4 && xml.status >= 200) {
-               call_back(null,xml.responseText);
-           } else if (xml.status === 404) {
-               call_back('404 page not found!',null);
-           }
+            if(xml.readyState === 4 && xml.status >= 200) {
+                call_back(null,xml.responseText);
+            } else if (xml.status === 404) {
+                call_back('404 page not found!',null);
+            } else {
+                console.log('请求出错=',url)
+                tools.showToast('请求出错')
+            }
        };
    }
 
     public static run_post(url,data,call_back){
         var xml =  new XMLHttpRequest()
-        xml.open('POST',http.domain+url)
+        xml.open('POST',config.domain+url)
         xml.setRequestHeader('Content-Type','application/json');
         xml.setRequestHeader('token',config.TOKEN);
         xml.send(JSON.stringify(data));
@@ -178,11 +186,14 @@ export class http  {
 
        // Special event
        xml.onreadystatechange = function () {
-           if (xml.readyState === 4 && xml.status >= 200) {
-               call_back(null,xml.responseText);
-           } else if (xml.status === 404) {
-               call_back('404 page not found!',null);
-           } 
+            if(xml.readyState === 4 && xml.status >= 200) {
+                call_back(null,xml.responseText);
+            } else if (xml.status === 404) {
+                call_back('404 page not found!',null);
+            } else {
+                console.log('请求出错=',url)
+                tools.showToast('请求出错')
+            }
        };
    }
 }