future 1 tahun lalu
induk
melakukan
b7f297e525

+ 1 - 0
assets/script/GameManager.ts

@@ -286,6 +286,7 @@ export class GameManager extends Component {
     // 请求同步数据
     public static requestSyncNumber(opt,success_cb=null,fail_cb=null) {
         http.post(config.API.sync_free_number, opt, (err,data)=>{
+            console.log('请求分享===',data)
             if(!err) {
                 let _data = JSON.parse(data)
                 if(_data.code==config.status.SUCCESS) {

+ 1 - 1
assets/script/config.ts

@@ -3,7 +3,7 @@ const { ccclass, property } = _decorator;
 
 @ccclass('config')
 export class config  {
-    static debug = true
+    static debug = false
     static gameName = "开局自行车";
     static websocket_domain = config.debug?'wss://snakews.xwrun.com':"wss://snakews.hainanmlwl.com" 
     public static Platform_id = {

+ 8 - 16
assets/script/main.ts

@@ -14,8 +14,6 @@ export class main extends Component {
     @property(Node) laoding_view_wait = null;
     @property(Node) send_msg_wait = null;
 
-    private m_home_view:Node = null
-
     protected start(): void {
         game.frameRate = 61;  //修复 iphone 15 抖动问题
         // PhysicsSystem2D.instance.fixedTimeStep = 1 / 60;
@@ -24,31 +22,25 @@ export class main extends Component {
         this.home_node.removeAllChildren()
         uiManager.Instance().init(this.ui_parent,this.laoding_view_wait,this.send_msg_wait)
 
-        this.preloadHomeView()
         this.showLoadingView()
     }
 
     private showLoadingView() {
         uiManager.Instance().showUi(config.UI.loading_view, this.node, (node:Node)=>{
-            node.getComponent(loading_view).startLoading(()=>{
-                this.showHomeView()
+            node.getComponent(loading_view).startLoading((v:loading_view)=>{
+                this.showHomeView(()=>{
+                    v.close()
+                })
             })
         })
     }
-
-    private preloadHomeView() {
-        this.home_node.active = false
+    
+    private showHomeView(cb) {
         uiManager.Instance().showUi(config.UI.home,this.home_node,(node:Node)=>{
-            this.m_home_view = node
+            node.getComponent(home).init()
+            cb && cb()
         })
     }
-
-    private showHomeView() {
-        this.home_node.active = true
-        setTimeout(()=>{ 
-            this.m_home_view.getComponent(home).init()
-        },20)
-    }
 }
 
 

+ 1 - 1
assets/script/manager/userDataManager.ts

@@ -25,7 +25,7 @@ export class userDataManager  {
             return 
         }
         userDataManager.user_data.share_number+=1
-        // console.log('同步接口  今天分享数:',userDataManager.user_data.share_number)
+        console.log('同步接口  今天分享数:',userDataManager.user_data.share_number)
         let opt = {'share_number':userDataManager.user_data.share_number}
         GameManager.requestSyncNumber(opt)
     }

+ 8 - 2
assets/script/sdkUtil.ts

@@ -360,12 +360,18 @@ export class SdkUtil {
     public static shareGame(title: string, desc:string, call_back=null) {
         if(desc==undefined||desc==null) { desc = config.gameName}
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
-            SdkUtil.ttShare(title,desc, null, ()=>{
+            SdkUtil.ttShare(title,desc, ()=>{
+                call_back(true)
+            }, ()=>{
                 this.showToast('分享失败')
             })
         } else if(sys.platform == sys.Platform.WECHAT_GAME) {
             if(SdkUtil.KS_GAME) {
-                SdkUtil.ksShare(desc)
+                SdkUtil.ksShare(desc, '', ()=>{
+                    call_back(true)
+                }, ()=>{
+                    this.showToast('分享失败')
+                })
             } else {
                 SdkUtil.wxShare(desc)
             }

+ 11 - 11
assets/script/ui/car_lib/car_lib_top.ts

@@ -22,18 +22,18 @@ export class car_lib_top extends Component {
     @property(Node) img_car:Node = null
 
     protected start(): void {
-        uiManager.Instance().onButtonListen(this.btn_region,()=>{
-            if(tools.sys_config.k_region==0) { return }
-            
-            if(userDataManager.user_data.update_region_status==1) {
-                uiManager.Instance().showUi(config.UI.ui_tips_view)
-                return
-            }
-            uiManager.Instance().showUi(config.UI.ui_select_area, null, (node:Node)=>{
-                node.getComponent(select_area).initView(true, this.onSelectArea.bind(this))
+        if(tools.sys_config.k_region==1) {
+            uiManager.Instance().onButtonListen(this.btn_region,()=>{
+                if(userDataManager.user_data.update_region_status==1) {
+                    uiManager.Instance().showUi(config.UI.ui_tips_view)
+                    return
+                }
+                uiManager.Instance().showUi(config.UI.ui_select_area, null, (node:Node)=>{
+                    node.getComponent(select_area).initView(true, this.onSelectArea.bind(this))
+                })
             })
-        })
-
+        }
+        
         if(tools.sys_config.k_region==0) {
             this.btn_region.getComponent(Button).interactable = false
             this.img_region_edit.active = false

+ 8 - 4
assets/script/ui/loading_view.ts

@@ -113,17 +113,21 @@ export class loading_view extends Component {
 
             if(progress >= 1) {
                 if(this.m_finish_load_call!=null){
-                    this.m_finish_load_call()
+                    this.m_finish_load_call(this)
                 }
-                this.img_ride_bike.getComponent(Animation).stop()
-                this.node.removeFromParent()
-                this.unscheduleAllCallbacks()
+                // this.close() 外部关闭
                 return;
             } 
 
         },0.1)
     }
 
+    public close() {
+        this.img_ride_bike.getComponent(Animation).stop()
+        this.node.removeFromParent()
+        this.unscheduleAllCallbacks()
+    }
+
     private initUserData(login_finish_cb){
         this.userLogin((openid)=>{
             // console.log('openid=',openid)

+ 7 - 1
assets/script/ui/select_area/select_area.ts

@@ -4,6 +4,8 @@ import { select_area_item } from './select_area_item';
 import { http } from '../../http';
 import { config } from '../../config';
 import { area_item_data } from '../../data';
+import { GameManager } from '../../GameManager';
+import { uiManager } from '../../manager/uiManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('select_area')
@@ -42,7 +44,9 @@ export class select_area extends base_ui {
             this.onClickCityTrue()
         })
 
-        this.requestProvinceListData()
+        GameManager.requestDelay(()=>{
+            this.requestProvinceListData()
+        })
     }
 
     initView(is_modified:boolean, city_cb) {
@@ -85,7 +89,9 @@ export class select_area extends base_ui {
     }
 
     private requestProvinceListData() {
+        uiManager.Instance().showLoading()
         http.get(config.STATIC_API.regions, (err,d)=>{
+            uiManager.Instance().hideLoading()
             if(!err){
                 let data = JSON.parse(d)
                 if(data.code===config.status.SUCCESS){