| | |
| | | }
|
| | | }
|
| | |
|
| | | switch (vNetData.MapID)
|
| | | if (vNetData.socketType == GameNetSystem.SocketType.Main
|
| | | && GameNetSystem.Instance.crossServerData.crossState == GameNetSystem.CrossServerState.Yes)
|
| | | {
|
| | | case 31250:
|
| | | StageManager.Instance.Load<GuardDungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | case RuneTowerModel.RUNETOWER_MAPID:
|
| | | StageManager.Instance.Load<RuneTowerDungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | case DemonJarModel.DEMONJAR_SINGLEMAPID:
|
| | | StageManager.Instance.Load<FakeDemonJarDungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | default:
|
| | | StageManager.Instance.Load<DungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | var loginModel = ModelCenter.Instance.GetModel<LoginModel>();
|
| | | var account = loginModel.accountBuf;
|
| | | var ip = GameNetSystem.Instance.crossServerData.ip;
|
| | | var port = GameNetSystem.Instance.crossServerData.port;
|
| | | CrossServerLogin.Instance.AccountLogin(account, ip, port);
|
| | | }
|
| | | else
|
| | | {
|
| | | switch (vNetData.MapID)
|
| | | {
|
| | | case 31250:
|
| | | StageManager.Instance.Load<GuardDungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | case RuneTowerModel.RUNETOWER_MAPID:
|
| | | StageManager.Instance.Load<RuneTowerDungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | case DemonJarModel.DEMONJAR_SINGLEMAPID:
|
| | | StageManager.Instance.Load<FakeDemonJarDungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | default:
|
| | | StageManager.Instance.Load<DungeonStage>(_mapConfig.MapID);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | DTCA713_tagMCDynamicBarrierState.Clear();
|
| | | MainRedDot.Instance.Register();
|
| | |
|
| | |
| | | |
| | | H0309_tagPlayerLoginInfo vNetData = vNetPack as H0309_tagPlayerLoginInfo; |
| | | PlayerDatas.Instance.loginInfo = vNetData; |
| | | GameNetSystem.Instance.UpdateCrossServerData(vNetData.IP, vNetData.Port, vNetData.CrossState); |
| | | |
| | | if (RoleChange != null) |
| | | { |
| | |
| | |
|
| | | public bool isCrossSevering { get; set; }
|
| | |
|
| | | public CrossServerData crossServerData { get; private set; }
|
| | |
|
| | | public GameNetSystem()
|
| | | {
|
| | | var gameObject = new GameObject("NetUpdateBehaviour");
|
| | |
| | | onConnected(ok);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | public void UpdateCrossServerData(string ip, int port, byte state)
|
| | | {
|
| | | this.crossServerData = new CrossServerData(ip, port, state);
|
| | | }
|
| | |
|
| | | public void SendInfo(GameNetPackBasic protocol)
|
| | |
| | | var loginModel = ModelCenter.Instance.GetModel<LoginModel>();
|
| | | loginModel.busy = false;
|
| | | }
|
| | | }
|
| | |
|
| | | public void DisconnectCrossServer()
|
| | | {
|
| | | try
|
| | | {
|
| | | if (crossServerSocket != null)
|
| | | {
|
| | | crossServerSocket.CloseConnect();
|
| | | }
|
| | |
|
| | | crossSeverProtocolQueue.Clear();
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | Debug.Log(ex);
|
| | | }
|
| | | finally
|
| | | {
|
| | | CrossServerLogin.Instance.busy = false;
|
| | | }
|
| | | }
|
| | |
|
| | | public void Reconnect()
|
| | |
| | | CrossSever = 2,
|
| | | }
|
| | |
|
| | | public struct CrossServerData
|
| | | {
|
| | | public string ip;
|
| | | public int port;
|
| | | public CrossServerState crossState;
|
| | |
|
| | | public CrossServerData(string ip, int port, byte state)
|
| | | {
|
| | | this.ip = ip;
|
| | | this.port = port;
|
| | | this.crossState = (CrossServerState)state;
|
| | | }
|
| | | }
|
| | |
|
| | | public enum CrossServerState
|
| | | {
|
| | | No = 0,
|
| | | Yes = 1,
|
| | | Error = 2,
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
| | | public byte Country; //玩家国家 |
| | | public byte HavePswLV2; //是否有二级密码 |
| | | public byte EquipCount; |
| | | public tagLoginInfoEquip[] EquipInfo; //size = EquipCount |
| | | public tagLoginInfoEquip[] EquipInfo = null; //size = EquipCount |
| | | public uint EquipShowSwitch; //玩家装备显示开关 |
| | | public uint ExAttr15; //预留的扩展属性字段,用来存放项目特定的属性 |
| | | public uint ExAttr16; //预留的扩展属性字段,用来存放项目特定的属性 |
| | |
| | | public uint ExAttr18; //预留的扩展属性字段,用来存放项目特定的属性 |
| | | public uint ExAttr19; //预留的扩展属性字段,用来存放项目特定的属性 |
| | | public uint ExAttr20; //预留的扩展属性字段,用来存放项目特定的属性 |
| | | public byte IPLen; |
| | | public string IP; // 跨服IP |
| | | public ushort Port; // 跨服端口 |
| | | public byte CrossState; // 跨服状态0-非跨服状态,1-跨服状态,2-跨服状态异常 |
| | | |
| | | public H0309_tagPlayerLoginInfo() |
| | | { |
| | |
| | | TransBytes(out ExAttr18, vBytes, NetDataType.DWORD); |
| | | TransBytes(out ExAttr19, vBytes, NetDataType.DWORD); |
| | | TransBytes(out ExAttr20, vBytes, NetDataType.DWORD); |
| | | TransBytes(out IPLen, vBytes, NetDataType.BYTE); |
| | | TransBytes(out IP, vBytes, NetDataType.Chars, IPLen); |
| | | TransBytes(out Port, vBytes, NetDataType.WORD); |
| | | TransBytes(out CrossState, vBytes, NetDataType.BYTE); |
| | | } |
| | | |
| | | public struct tagLoginInfoEquip |
| | |
| | | { |
| | | public class CrossServerLogin : Singleton<CrossServerLogin> |
| | | { |
| | | |
| | | bool m_ReconnecBackGround = false; |
| | | public bool reconnectBackGround { |
| | | get { return m_ReconnecBackGround; } |
| | |
| | | |
| | | public bool isLogined { get; private set; } |
| | | |
| | | public void AccountLogin(string account, string ip, int port, int gamePort) |
| | | public void AccountLogin(string account, string ip, int gamePort) |
| | | { |
| | | isLogined = true; |
| | | if (Application.internetReachability == NetworkReachability.NotReachable) |
| | |
| | | reconnectBackGround = false; |
| | | accountBuf = account; |
| | | ipBuf = ip; |
| | | portBuf = port; |
| | | gamePortBuf = gamePort; |
| | | |
| | | GameNetSystem.Instance.BeginConnectCrossServer(ipBuf, gamePortBuf, OnGameServerConnected); |