npzzwq99 2 miesięcy temu
rodzic
commit
5f2b9bced4

+ 1 - 1
assets/Scene/Launch.fire

@@ -341,7 +341,7 @@
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
     "_spriteFrame": {
-      "__uuid__": "b96f3f46-6369-4b73-b41c-44e3d73fcc03"
+      "__uuid__": "3ee1b2e3-15f6-43ea-b38b-dbf778c5f51a"
     },
     "_type": 0,
     "_sizeMode": 0,

Plik diff jest za duży
+ 206 - 136
assets/Scene/Lobby.fire


+ 19 - 2
assets/Scene/Script/Launch.js

@@ -3,6 +3,7 @@ cc.Class({
 
     properties: {
         m_updateTipNode: cc.Node,
+
     },
 
     ctor: function () {
@@ -99,8 +100,15 @@ cc.Class({
         if (this.m_updateTipNode) {
             this.m_updateTipNode.active = false;
         }
-        this.scheduleOnce(this.getServerIP, 2);
-        this.scheduleOnce(this.getServerIP, 5);
+        // 在初始化页面时显示加载提示
+        // this.scheduleOnce(this.ShowLoading(null, '加载中...'),3)
+        this.ShowLoading(null, '加载中...')
+        // this.setTimeout(() => {
+        //     this.getServerIP
+        // }, 2000);
+        this.timeoutID = setTimeout(this.getServerIP.bind(this), 3000);
+        // this.scheduleOnce(this.getServerIP, 2);
+        // this.scheduleOnce(this.getServerIP, 5);
         this.getServerIP();
 
     },
@@ -191,12 +199,16 @@ cc.Class({
     getServerIP() {
         if (window.GET_IP == false) return;
         if ((window.OPEN_DOMAIN_NET == true && cc.sys.isNative != cc.sys.os)) return;
+        //this.ShowLogin(null, '加载中');
         console.log("获取IP--")
         this.updateIP = true;
         var xhr = new XMLHttpRequest();
         xhr.onreadystatechange = function () {
             if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 400)) {
+                //this.StopLogin();
                 console.log("获取到ip:");
+                //获取到ip了就关闭定时器,不再轮询
+                clearTimeout(this.timeoutID);
                 console.log("a1.wangpaimj.com 返回", xhr.responseText);
                 this.updateIP = false;
                 window.UpdateIPRelatedAddresses(xhr.responseText);
@@ -366,8 +378,11 @@ cc.Class({
                 if (this.m_updateTipNode) {
                     this.m_updateTipNode.active = true;
                 }
+                console.log("加载完毕");
+                this.StopLoading();
             } else {
                 this.ShowLogin();
+
             }
             return;
 
@@ -423,6 +438,8 @@ cc.Class({
             this.node,      // 父节点:当前场景根节点
             function () {   // 加载完成回调(空操作)
                 // 可在此处添加登录界面初始化后操作
+                console.log("加载完毕");
+                this.StopLoading();
             }.bind(this)     // 确保回调函数中的this指向当前组件
         );
     },

Plik diff jest za duży
+ 86 - 50
assets/Scene/Script/Lobby.js


+ 1 - 1
assets/Scene/Script/Platform.js

@@ -8,7 +8,7 @@ window.APP_VERSION_UI = `1.0.0.0`;
 window.APK_NAME = 'MJ'
 window.LOCAL_DEBUG = 10;
 window.VCODE_GET = 0;
-window.LOG_NET_DATA = 0;
+window.LOG_NET_DATA = 1;
 window.LOG_WEB_DATA = 10;
 window.LOG_DEBUG = 10;
 window.POP_NOTICE = 1;

+ 94 - 95
assets/Scene/Script/Table.js

@@ -4,11 +4,11 @@ cc.Class({
     properties: {
     },
 
-    ctor :function () {
+    ctor: function () {
         this.mGameServerItem = null;
         this.mShowReLink = false;
     },
-    onLoad:function () {
+    onLoad: function () {
         cc.debug.setDisplayStats(false);
         FitSize(this.node);
         ShowO2I(this.node, 0.5);
@@ -17,10 +17,10 @@ cc.Class({
         this.m_BGSprite = this.m_gameNode.getComponent(cc.Sprite);
         this.m_bTipGPS = true;
         window.g_CntGameGPS = 0;
-        this.schedule(this.NetworkHeartbeat, 5);  
+        this.schedule(this.NetworkHeartbeat, 5);
         this.$('BtInvite').active = false;
         this.m_Loading = this.$('loading');
-        if(window.gGameBG == null) window.gGameBG = 'loading';
+        if (window.gGameBG == null) window.gGameBG = 'loading';
 
         // var bg = this.$('loading/logo@Sprite');
         //   if (window.WPMJ==0){
@@ -32,89 +32,89 @@ cc.Class({
         //         bg.spriteFrame = spriteFrame;
         //     });
         // }
-        
-         if (window.WPMJ==0){
-             this.$('loading/Logowp').active = true;
-             this.$('loading/Logommh').active = false;
-        }else{
-             this.$('loading/Logowp').active = false;
-             this.$('loading/Logommh').active = true;
+
+        if (window.WPMJ == 0) {
+            this.$('loading/Logowp').active = true;
+            this.$('loading/Logommh').active = false;
+        } else {
+            this.$('loading/Logowp').active = false;
+            this.$('loading/Logommh').active = true;
         }
     },
-    update :function (dt) {
-        if(window.gGameBG == 'loading') {
+    update: function (dt) {
+        if (window.gGameBG == 'loading') {
 
-            window.gGameBG = cc.gPreLoader.LoadRes(`${GameDef.BGPath}`, '' + GameDef.KIND_ID, function(res) {
+            window.gGameBG = cc.gPreLoader.LoadRes(`${GameDef.BGPath}`, '' + GameDef.KIND_ID, function (res) {
                 this.m_BGSprite.spriteFrame = res;
             }.bind(this));
 
-        } else if(window.gGameBG instanceof cc.SpriteFrame) {
+        } else if (window.gGameBG instanceof cc.SpriteFrame) {
             this.m_BGSprite.spriteFrame = window.gGameBG;
             window.gGameBG = null;
         }
     },
 
     // use this for initialization
-    start :function () {
+    start: function () {
         g_Launch = null;
         g_Login = null;
         g_Lobby = null;
         g_Table = this;
         g_CurScene = this;
         this.mGameServerItem = g_ServerListDataLast;
-        console.log("房间列表:",this.mGameServerItem)
+        console.log("房间列表:", this.mGameServerItem)
         this.m_ServerItem = this.node.getComponent("CServerItem")
-        if(this.m_ServerItem == null) this.m_ServerItem = this.node.addComponent("CServerItem");
+        if (this.m_ServerItem == null) this.m_ServerItem = this.node.addComponent("CServerItem");
         var TableViewNode = new cc.Node('TableViewFrame');
         this.node.addChild(TableViewNode);
         this.m_TableViewFrame = TableViewNode.addComponent("TableViewFrame");
         this.m_ServerItem.SetServerItemSink(this);
         this.m_ServerItem.SetStringMessageSink(this);
         this.m_ServerItem.mTableViewFrame = this.m_TableViewFrame;
-        this.m_TableViewFrame.SetServerItem( this.m_ServerItem );
+        this.m_TableViewFrame.SetServerItem(this.m_ServerItem);
 
         this.CreateKernel();
-       window.isJoinGame = false;
-       
+        window.isJoinGame = false;
+
     },
 
-    InsertPromptString:function (pszString, iButtonType) {
+    InsertPromptString: function (pszString, iButtonType) {
         //提示信息
         this.ShowAlert(pszString);
     },
-    OnAlertExitLogin:function(Res){
-        if(Res) this.ExitGameLogin();
+    OnAlertExitLogin: function (Res) {
+        if (Res) this.ExitGameLogin();
     },
-    InsertSystemString:function (pszString, iButtonType) {
+    InsertSystemString: function (pszString, iButtonType) {
     },
-    InsertPromptStringAndClose:function (pszString, iButtonType) {
+    InsertPromptStringAndClose: function (pszString, iButtonType) {
         //提示信息
-        this.ShowAlert(pszString,Alert_Yes,"OnAlertExitLogin",this);
+        this.ShowAlert(pszString, Alert_Yes, "OnAlertExitLogin", this);
     },
     //登陆完成
-    OnGRLogonFinish :function() {
+    OnGRLogonFinish: function () {
         var pMySelfUserItem = this.m_ServerItem.GetMeUserItem();
-        if(pMySelfUserItem.GetTableID()==INVALID_CHAIR){
-            if(g_ServerListDataLast.wServerType & (GAME_GENRE_PERSONAL|GAME_GENRE_PERSONAL_S|GAME_GENRE_PERSONAL_G)){
+        if (pMySelfUserItem.GetTableID() == INVALID_CHAIR) {
+            if (g_ServerListDataLast.wServerType & (GAME_GENRE_PERSONAL | GAME_GENRE_PERSONAL_S | GAME_GENRE_PERSONAL_G)) {
                 this.m_ServerItem.PerformEnterRoom();
-            }else{
+            } else {
                 this.m_ServerItem.PerformSitDownAction(this.mGameServerItem.wTableID, INVALID_CHAIR, false);
             }
-        }else{
+        } else {
             this.m_ServerItem.OnGFGameReady();
         }
     },
 
     //比赛消息
-    InsertMatchJoinString:function (lMatchFee){
+    InsertMatchJoinString: function (lMatchFee) {
         this.m_lMatchFee = lMatchFee;
-        if(confirm("參賽將扣除報名費 "+this.m_lMatchFee.toString()+" 遊戲幣,確認要參賽嗎?")){
+        if (confirm("參賽將扣除報名費 " + this.m_lMatchFee.toString() + " 遊戲幣,確認要參賽嗎?")) {
             this.OnJionCallBack();
         }
         return true;
     },
 
-    OnJionCallBack :function() {
+    OnJionCallBack: function () {
         pServerItem = IServerItem.get();
         var cbData = new Uint8Array(8);
         gCByte.w8(cbData, 0, this.m_lMatchFee);
@@ -122,21 +122,21 @@ cc.Class({
     },
 
     //请求失败
-    onGRRequestFailure :function(szDescribeString){
-        this.ShowAlert(szDescribeString,Alert_Yes,"OnAlertExitGame",this);
+    onGRRequestFailure: function (szDescribeString) {
+        this.ShowAlert(szDescribeString, Alert_Yes, "OnAlertExitGame", this);
     },
-    OnAlertExitGame:function(Res){
-        if(Res) this.ExitGame();
+    OnAlertExitGame: function (Res) {
+        if (Res) this.ExitGame();
     },
     //创建游戏内核
-    CreateKernel :function() {
+    CreateKernel: function () {
         var kernel = gClientKernel.create();
         if (kernel == null) return false;
         kernel.SetServerItem(this.m_ServerItem);
         kernel.SetStringMessageSink(this);
-        kernel.mIClientKernelSink=null;
+        kernel.mIClientKernelSink = null;
         this.InitGameLayer();
-       // this.schedule(this.InitGameLayer, 0.05);
+        // this.schedule(this.InitGameLayer, 0.05);
 
         if (kernel.Init()) return true;
 
@@ -145,128 +145,127 @@ cc.Class({
     },
 
     //创建游戏
-    InitGameLayer:function (){
+    InitGameLayer: function () {
         var kernel = gClientKernel.get();
-        if(kernel.mIClientKernelSink) return
+        if (kernel.mIClientKernelSink) return
 
-        this.ShowGamePrefab("GameClientEngine", GameDef.KIND_ID, this.m_gameNode, function(Js){
+        this.ShowGamePrefab("GameClientEngine", GameDef.KIND_ID, this.m_gameNode, function (Js) {
             this.m_GameEngine = Js;
             Js.SetTableScene(this);
             kernel.SetClientKernelSink(Js);
-            if(Js.LoadSound) Js.LoadSound();
+            if (Js.LoadSound) Js.LoadSound();
             this.m_ServerItem.ConnectServer(this.mGameServerItem, 0, 0);
         }.bind(this));
     },
 
     //用户更新
-    OnGRUserUpdate :function(pIClientUserItem)
-    {
+    OnGRUserUpdate: function (pIClientUserItem) {
     },
 
-    LoadingOver:function(){
-        if(this.m_ReLinkTime != null){
+    LoadingOver: function () {
+        if (this.m_ReLinkTime != null) {
             this.OnGFServerReLink();
-        }else{
+        } else {
             this.StopLoading();
         }
     },
 
     //房间退出
-    OnGFServerClose :function(szMessage){
-        this.ShowAlert("您掉線了! 請檢查網路設備連接狀態! 點擊確定後將返回遊戲大廳.",Alert_Yes,"OnAlertExitGame",this);
+    OnGFServerClose: function (szMessage) {
+        this.ShowAlert("您掉線了! 請檢查網路設備連接狀態! 點擊確定後將返回遊戲大廳.", Alert_Yes, "OnAlertExitGame", this);
     },
-    OnGFServerReLink :function(){
-        if(this.m_ServerItem.mInterval != null || this.mShowReLink) return this.StopLoading();
-        if(window.ReLinkTime == null) window.ReLinkTime  = 0;
+    OnGFServerReLink: function () {
+        if (this.m_ServerItem.mInterval != null || this.mShowReLink) return this.StopLoading();
+        if (window.ReLinkTime == null) window.ReLinkTime = 0;
         window.ReLinkTime++;
         this.StopLoading();
-        if(window.ReLinkTime%7 >= 6){
+        if (window.ReLinkTime % 7 >= 6) {
             this.mShowReLink = true;
-            this.ShowAlert('網路异常,是否嘗試重連?',Alert_YesNo,function(Res){
+            this.ShowAlert('網路异常,是否嘗試重連?', Alert_YesNo, function (Res) {
                 this.mShowReLink = false;
-                if(Res){
+                if (Res) {
                     this.ShowLoading();
                     this.m_ServerItem.CloseSocket();
                     this.m_ServerItem.ConnectServer(this.mGameServerItem, 0, 0);
-                }else{
+                } else {
                     this.OnGFServerClose();
                 }
             }.bind(this));
-        }else{
+        } else {
             this.ShowLoading();
             this.m_ServerItem.CloseSocket();
             this.m_ServerItem.ConnectServer(this.mGameServerItem, 0, 0);
         }
     },
-    ExitGame :function(){
-        if(this.m_TableViewFrame){
+    ExitGame: function () {
+        if (this.m_TableViewFrame) {
             //退出游戏
             this.m_TableViewFrame.ExitGame();
-        }else {
+        } else {
             gClientKernel.destory();
             ChangeScene('Lobby');
         }
     },
 
-    ExitGameLogin :function() {
+    ExitGameLogin: function () {
         //退出游戏
         this.m_TableViewFrame.ExitGame();
     },
 
 
     //网络心跳
-    NetworkHeartbeat :function(dt) {
-        if(this.m_ServerItem.mServiceStatus != ServiceStatus_ServiceIng) return
-        if (this.m_ServerItem != null && this.m_ServerItem.mInterval == null){
+    NetworkHeartbeat: function (dt) {
+        if (this.m_ServerItem.mServiceStatus != ServiceStatus_ServiceIng) return
+        if (this.m_ServerItem != null && this.m_ServerItem.mInterval == null) {
             this.m_ServerItem.mHeartStatTime = new Date().getTime();           //服务器心跳时间
             this.m_ServerItem.SendSocketClass(MDM_KN_COMMAND, SUB_KN_CLIENT_HEART);
         }
     },
-    UpdateGPS:function(para) {
-        var GameClientEngine = this['m_JsGameClientEngine_'+GameDef.KIND_ID]
-        if(GameClientEngine)GameClientEngine.UpdateGPS(para);
+    UpdateGPS: function (para) {
+        var GameClientEngine = this['m_JsGameClientEngine_' + GameDef.KIND_ID]
+        if (GameClientEngine) GameClientEngine.UpdateGPS(para);
     },
-    UpdateSet:function() {
-        var GameClientEngine = this['m_JsGameClientEngine_'+GameDef.KIND_ID]
-        if(GameClientEngine)GameClientEngine.m_GameClientView.UpdateSet();
+    UpdateSet: function () {
+        var GameClientEngine = this['m_JsGameClientEngine_' + GameDef.KIND_ID]
+        if (GameClientEngine) GameClientEngine.m_GameClientView.UpdateSet();
     },
-/////////////////////////////////////////////////////////////////////////////语音接口
-    GetVoiceCtrl:function(para) {
-        var GameClientEngine = this['m_JsGameClientEngine_'+GameDef.KIND_ID];
-        if(GameClientEngine == null) return null;
+    /////////////////////////////////////////////////////////////////////////////语音接口
+    GetVoiceCtrl: function (para) {
+        var GameClientEngine = this['m_JsGameClientEngine_' + GameDef.KIND_ID];
+        if (GameClientEngine == null) return null;
         return GameClientEngine.GetVoiceCtrl();
     },
     //上传完成
-    OnVoiceUpLoad:function(para) {
+    OnVoiceUpLoad: function (para) {
         var VoiceCtrl = this.GetVoiceCtrl();
-        if(VoiceCtrl)VoiceCtrl.OnRecordOver(para);
+        if (VoiceCtrl) VoiceCtrl.OnRecordOver(para);
     },
-    OnVoiceLoad:function(para) {
+    OnVoiceLoad: function (para) {
         var VoiceCtrl = this.GetVoiceCtrl();
-        if(VoiceCtrl)VoiceCtrl.OnLoadVoice(para);
+        if (VoiceCtrl) VoiceCtrl.OnLoadVoice(para);
     },
     //播放完成
-    OnPlayFinish:function() {
+    OnPlayFinish: function () {
         var VoiceCtrl = this.GetVoiceCtrl();
-        if(VoiceCtrl)VoiceCtrl.OnPlayFinish();
+        if (VoiceCtrl) VoiceCtrl.OnPlayFinish();
     },
-    onRecordFinish :function (str) {
+    onRecordFinish: function (str) {
         var VoiceCtrl = this.GetVoiceCtrl();
-        if(VoiceCtrl)VoiceCtrl.onRecordFinish(str);
+        if (VoiceCtrl) VoiceCtrl.onRecordFinish(str);
     },
-    OnBtClick_Invite:function(){
-        var GameClientEngine = this['m_JsGameClientEngine_'+GameDef.KIND_ID]
-        if(GameClientEngine){
-            this.ShowPrefabDLG('ClubInviteUserList',null,function(Js){
+    OnBtClick_Invite: function () {
+        var GameClientEngine = this['m_JsGameClientEngine_' + GameDef.KIND_ID]
+        if (GameClientEngine) {
+            this.ShowPrefabDLG('ClubInviteUserList', null, function (Js) {
                 Js.OnSetGameInfor(GameClientEngine);
             }.bind(this));
         }
     },
-    OnSetInviteBtShow:function(pIClientUserItem){
-        var GameClientEngine = this['m_JsGameClientEngine_'+GameDef.KIND_ID]
-        if(GameClientEngine&&GameClientEngine.m_dwClubID!=0){
-            this.$('BtInvite').active = pIClientUserItem.GetUserStatus()!= US_LOOKON;
+    OnSetInviteBtShow: function (pIClientUserItem) {
+        var GameClientEngine = this['m_JsGameClientEngine_' + GameDef.KIND_ID]
+        if (GameClientEngine && GameClientEngine.m_dwClubID != 0) {
+            this.$('BtInvite').active = pIClientUserItem.GetUserStatus() != US_LOOKON;
         }
     },
-/////////////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////////////
 });

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików