Browse Source

龙虎断线从连

master
fycode_ZF_Client 8 months ago
parent
commit
4b2817d127
  1. 8
      assets/20001/script/data/DragonTigerNet.ts
  2. 44
      assets/test/GameDebug.ts
  3. 6
      assets/test/main.scene
  4. 2
      buildZip/cache_files/20001/files.json
  5. BIN
      buildZip/game_hot/20001/1.0.0/base/assets/20001.1.zip
  6. BIN
      buildZip/game_hot/20001/1.0.0/base/assets/20001.2.zip
  7. BIN
      buildZip/game_hot/20001/1.0.0/base/assets/20001.3.zip
  8. 2
      buildZip/game_hot/20001/1.0.0/base/config.json
  9. BIN
      buildZip/game_hot/20001/1.0.0/hot/assets/20001.1.zip
  10. BIN
      buildZip/game_hot/20001/1.0.0/hot/assets/20001.2.zip
  11. BIN
      buildZip/game_hot/20001/1.0.0/hot/assets/20001.3.zip
  12. 2
      buildZip/game_hot/20001/1.0.0/hot/config.json

8
assets/20001/script/data/DragonTigerNet.ts

@ -1,6 +1,6 @@
import { Game, game } from "cc";
import { DragonTiger } from "../DragonTiger";
import { GameConst, I18Manager, Message, Network, UILayerIndex } from "../sdk/API";
import { GameConst, I18Manager, Message, Network, SocketConst, UILayerIndex } from "../sdk/API";
import { UserData } from "../sdk/GameVO";
import { BETTING_AREA } from "./DragonTigerConst";
import { DragonTigerEventType } from "./DragonTigerEventType";
@ -24,7 +24,8 @@ export class DragonTigerNet {
Network.getInstance().registhandle(NetMsgCode.SCLeave, this.onSCLeave.bind(this));
Message.add("Game_Authority_Success", this.Reconnect, this)
//切换前后台时,监听。on监听不会重复监听两次
game.on(Game.EVENT_SHOW, this.Reconnect, this);
// game.on(Game.EVENT_SHOW, this.Reconnect, this);
Message.add(SocketConst.CONNECTED,this.Reconnect, this)
}
/** 移除消息监听 */
removeListener() {
@ -40,7 +41,8 @@ export class DragonTigerNet {
Network.getInstance().removehandle(NetMsgCode.SCRepeatBet, this.onSCRepeatBet.bind(this));
Network.getInstance().removehandle(NetMsgCode.SCLeave, this.onSCLeave.bind(this));
Message.remove("Game_Authority_Success", this.Reconnect, this)
game.off(Game.EVENT_SHOW, this.Reconnect, this);
// game.off(Game.EVENT_SHOW, this.Reconnect, this);
Message.remove(SocketConst.CONNECTED,this.Reconnect, this)
}
/** 游戏准备开始 */

44
assets/test/GameDebug.ts

@ -1,6 +1,7 @@
import { _decorator, AssetManager, assetManager, Component, director, instantiate, JsonAsset, Node, Prefab, Scene, sys } from "cc";
import { _decorator, AssetManager, assetManager, Component, director, instantiate, JsonAsset, Node, Prefab, Scene } from "cc";
import { AudioManager, GameUtils, Httpwork, IsNullOrEmpty, LoaderBundle, LoaderManager, Logger, Message, Network, toLocalStorage } from "../20001/script/sdk/API";
import { LoginData, UserData } from "../20001/script/sdk/GameVO";
import { sys } from "cc";
const { ccclass, property } = _decorator;
@ccclass('GameDebug')
@ -12,15 +13,17 @@ export class GameDebug extends Component {
@property
pwd: string = "123456"
@property
agentID: string = "11"
agentID: string = "1"
@property
PKG: string = "Q637767348"
@property
bundleName: string = "20001"
private sdkPath: String = `http://35.154.10.209/rummy/web/dependent/sdk/sdk.json`
private serverInfoURL: string = `http://${this.ipAddress}:8089/server-info`
private _account: string;
private _pwd: string;
private static new_acc:string
private static new_pwd:string
paraseLocationParams() {
if (sys.isBrowser && window.location.search) {
@ -35,6 +38,8 @@ export class GameDebug extends Component {
}
protected onLoad(): void {
GameDebug.new_acc=this.account
GameDebug.new_pwd=this.pwd
localStorage.setItem("gate", `ws://${this.ipAddress}:3553`)
this.paraseLocationParams()
this.LoadSDK()
@ -43,13 +48,7 @@ export class GameDebug extends Component {
}
private initEvent() {
Message.add("connected", this.onConnectServerSucc, this)
Network.getInstance().registhandle(100, this.aaa.bind(this))
}
aaa(data: any) {
UserData.gold = data.asset;
UserData.onChanaged();
}
private init() {
Httpwork.getInstance().post(this.serverInfoURL, { Code: this.PKG }, (value) => {
if (value && value.code == 0) {
@ -60,13 +59,14 @@ export class GameDebug extends Component {
}
private onConnectServerSucc() {
//每次断线后都会重新走这里
if (localStorage.getItem(`acc`) != '') {
this.account = '91' + localStorage.getItem(`acc`)
}
if (localStorage.getItem(`pwd`) != '') {
this.pwd = localStorage.getItem(`pwd`)
}
this.accountLogin(this.account, this.pwd)
// if (localStorage.getItem(`acc`) != null) {
// this.account = '91' + localStorage.getItem(`acc`)
// }
// if (localStorage.getItem(`pwd`) != null) {
// this.pwd = localStorage.getItem(`pwd`)
// }
let acc:string="91"+GameDebug.new_acc
this.accountLogin(acc, GameDebug.new_pwd)
}
/**
@ -159,7 +159,7 @@ export class GameDebug extends Component {
loginType: 1,
account: account,
password: password,
agentId: this.agentID,//代理ID
agentId: 11,//代理ID
channelId: this.PKG,//渠道包ID
}
Network.getInstance().send(999, param, (data) => {
@ -168,6 +168,8 @@ export class GameDebug extends Component {
// Toast.getInstance().showToast(I18Manager.getInstance().getString(`net.code.status.${data.code}`)+" - > "+data.code);
Logger.warn("账号登录错误 .... ")
} else {
localStorage.setItem("acc",this.account)
localStorage.setItem("pwd",this.pwd)
const arrdata = data.data;
Object.assign(LoginData, arrdata)
this.checkToken(LoginData.token);
@ -207,11 +209,11 @@ export class GameDebug extends Component {
} else {
//可以用API里提供的 Message 做消息的传递,相当于事件
// Message.send(GameConst.GAME_SUB_MESSAGE, route, value) //GameConst 在API里 网络会传递2个参数回来路由和数据
LoaderManager.getInstance().loadBundle("20001", null, null, (loader: LoaderBundle) => {
LoaderManager.getInstance().loadBundle(this.bundleName, null, null, (loader: LoaderBundle) => {
if (loader) {
this.isenterGame = true
AudioManager.getInstance().setBundle(loader)
director.loadScene("20001", (error: null | Error, scene?: Scene) => {
director.loadScene(this.bundleName, (error: null | Error, scene?: Scene) => {
// if(!error)director.runScene(scene)
console.log("==========load scene complete=========")
})

6
assets/test/main.scene

@ -262,9 +262,9 @@
"_enabled": true,
"__prefab": null,
"ipAddress": "35.154.10.209",
"account": "911331647896",
"pwd": "123456",
"agentID": "11",
"account": "1919191919",
"pwd": "111111",
"agentID": "1",
"PKG": "Q637767348",
"_id": "82GeRl4DxN/Yx9hDGnpUxL"
},

2
buildZip/cache_files/20001/files.json

File diff suppressed because one or more lines are too long

BIN
buildZip/game_hot/20001/1.0.0/base/assets/20001.1.zip

Binary file not shown.

BIN
buildZip/game_hot/20001/1.0.0/base/assets/20001.2.zip

Binary file not shown.

BIN
buildZip/game_hot/20001/1.0.0/base/assets/20001.3.zip

Binary file not shown.

2
buildZip/game_hot/20001/1.0.0/base/config.json

@ -1 +1 @@
{"gameId": "20001", "version": "ae9e5", "list": ["20001.1", "20001.2", "20001.3"]}
{"gameId": "20001", "version": "e43e8", "list": ["20001.1", "20001.2", "20001.3"]}

BIN
buildZip/game_hot/20001/1.0.0/hot/assets/20001.1.zip

Binary file not shown.

BIN
buildZip/game_hot/20001/1.0.0/hot/assets/20001.2.zip

Binary file not shown.

BIN
buildZip/game_hot/20001/1.0.0/hot/assets/20001.3.zip

Binary file not shown.

2
buildZip/game_hot/20001/1.0.0/hot/config.json

@ -1 +1 @@
{"gameId": "20001", "version": "ae9e5", "list": ["20001.1", "20001.2", "20001.3"]}
{"gameId": "20001", "version": "e43e8", "list": ["20001.1", "20001.2", "20001.3"]}
Loading…
Cancel
Save