void OnDestroy() { Debug.Log("UIChallengeLoading.OnDestroy"); NetworkManager conn = GameSystem.Instance.mNetworkManager; if (conn == null) { return; } conn.m_gameMsgHandler.UnregisterHandler(MsgID.PVPLoadCompleteRespID, HandleLoadComplete); conn.m_gameMsgHandler.UnregisterHandler(MsgID.PVPLoadProgressBroadcastID, HandleLoadProgress); NetworkConn platConn = GameSystem.Instance.mNetworkManager.m_platConn; if (platConn != null) { platConn.EnableTimeout(true); } NetworkConn gameConn = GameSystem.Instance.mNetworkManager.m_gameConn; if (gameConn != null) { gameConn.EnableTimeout(true); } GameSystem.Instance.mClient.mUIManager.isInMatchLoading = false; GameSystem.Instance.mClient.mUIManager.ShowMask(false); }
public bool CanAutoReconn() { GameMatch match = GameSystem.Instance.mClient.mCurMatch; if (!autoReconnInMatch && match != null && match.leagueType != GameMatch.LeagueType.eRegular1V1 && match.leagueType != GameMatch.LeagueType.eQualifyingNew && match.leagueType != GameMatch.LeagueType.ePVP && match.leagueType != GameMatch.LeagueType.ePractise && match.leagueType != GameMatch.LeagueType.ePractise1vs1 && match.m_stateMachine.m_curState != null && match.m_stateMachine.m_curState.m_eState != MatchState.State.eOver) { return(false); } NetworkConn game = GameSystem.Instance.mNetworkManager.m_gameConn; if (game != null && game.m_type == NetworkConn.Type.eVirtualServer && match != null && match.m_stateMachine.m_curState != null && match.m_stateMachine.m_curState.m_eState != MatchState.State.eOver ) { return(false); } Debug.Log("CanAutoReconn, " + isPushedOut + isWaittingReLogin + isKickOut); return(!isPushedOut && !isWaittingReLogin && !isKickOut); }
public static void SendGameShortMsg(Player player, uint id, uint broadcastType) { NetworkConn conn = GameSystem.Instance.mNetworkManager.m_gameConn; if (conn == null) { return; } if (_FilterOutMsgByMatchState()) { return; } InstructionReq instReq = new InstructionReq(); instReq.id = id; instReq.obj = broadcastType; instReq.char_id = player.m_roomPosId; NetworkConn server = GameSystem.Instance.mNetworkManager.m_gameConn; if (server != null) { server.SendPack <InstructionReq>(0, instReq, MsgID.InstructionReqID); } }
void OnDisconnected(NetworkConn conn) { if (CanAutoReconn()) { Reconnect(); } }
// Use this for initialization void Start() { this.serialConn = new SerialConn(); this.networkConn = (NetworkConn)GameObject.Find("NetworkConnection").GetComponent <NetworkConn> (); this.clientNum = networkConn.getCleintNum(); serialConn.broadcastData(clientNum, "shipColor"); }
public void ConnectToGS(GameMatch.Type uMatchType, string ip, int port) { if (m_gameConn != null) { CloseGameServerConn(); } if (uMatchType == GameMatch.Type.ePVP_1PLUS || uMatchType == GameMatch.Type.ePVP_3On3) { if (m_gameConn == null) { /* #if UNITY_EDITOR * int timeout = 0; #else * int timeout = 5000; #endif */ int timeout = 6; m_gameConn = new NetworkConn(m_gameMsgHandler, "Game", NetworkConn.Type.eGameServer, timeout); m_gameConn.AddEventListener(this); } } else { m_gameConn = new VirtualNetworkConnSimple(m_gameMsgHandler); m_gameConn.AddEventListener(this); VirtualGameServer.Instance = new VirtualGameServer(); } m_gameConn.Connect(ip, port); }
static int Close(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); obj.Close(); return(0); }
static int EnableTimeout(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); bool arg0 = LuaScriptMgr.GetBoolean(L, 2); obj.EnableTimeout(arg0); return(0); }
public void CloseGameServerConn() { if (m_gameConn != null) { m_gameConn.Close(); } m_gameConn = null; }
public void ClosePlatConn() { if (m_platConn != null) { m_platConn.Close(); } m_platConn = null; }
static int IsConnected(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); bool o = obj.IsConnected(); LuaScriptMgr.Push(L, o); return(1); }
static int Update(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); float arg0 = (float)LuaScriptMgr.GetNumber(L, 2); obj.Update(arg0); return(0); }
static int RemoveEventListener(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); NetworkConn.Listener arg0 = (NetworkConn.Listener)LuaScriptMgr.GetNetObject(L, 2, typeof(NetworkConn.Listener)); obj.RemoveEventListener(arg0); return(0); }
static int NotifyAllListener(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); NetworkConn.NetworkEvent arg0 = (NetworkConn.NetworkEvent)LuaScriptMgr.GetNetObject(L, 2, typeof(NetworkConn.NetworkEvent)); obj.NotifyAllListener(arg0); return(0); }
static int decrypt(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); Pack arg0 = (Pack)LuaScriptMgr.GetNetObject(L, 2, typeof(Pack)); obj.decrypt(arg0); return(0); }
public void EndWatch() { if (mNetworkConn != null) { mNetworkConn = null; } m_toWatch = false; m_beginWatch = false; }
void Awake() { updatePreclist = new List <UpdatePrec>(); m_bInitHandler = false; GameMatch curMatch = GameSystem.Instance.mClient.mCurMatch; if (curMatch != null && curMatch.leagueType != GameMatch.LeagueType.ePVP && (curMatch.leagueType != GameMatch.LeagueType.eRegular1V1 || curMatch.GetMatchType() == GameMatch.Type.eCareer3On3) && (curMatch.leagueType != GameMatch.LeagueType.eQualifyingNew || curMatch.GetMatchType() == GameMatch.Type.eCareer3On3)) { PlayerManager pm = GameSystem.Instance.mClient.mPlayerManager; single = pm.m_Players.Count <= 2; } Tip = transform.FindChild("Window/Bottom/Tip").GetComponent <UILabel>(); TipSimple = transform.FindChild("Window/Bottom/Tip_Simple").GetComponent <UILabel>(); Title = transform.FindChild("Window/Top/TopBG/Icon").GetComponent <UISprite>(); MyTeamName = transform.FindChild("Window/Top/WeName").GetComponent <UILabel>(); RivalTeamName = transform.FindChild("Window/Top/TheyName").GetComponent <UILabel>(); //MyTeamRoles = transform.FindChild("Window/Middle/Left/Grid").GetComponent<UIGrid>(); //RivalTeamRoles = transform.FindChild("Window/Middle/Right/Grid").GetComponent<UIGrid>(); SingleBaseBg = transform.FindChild("Window/Middle/NarrowBase").gameObject; MultiBaseBg = transform.FindChild("Window/Middle/WideBase").gameObject; LblNarrowTip = SingleBaseBg.transform.FindChild("Tip").GetComponent <UILabel> (); LblMultiBaseTip = MultiBaseBg.transform.FindChild("Tip").GetComponent <UILabel> (); Window = transform.FindChild("Window").gameObject; BG = transform.FindChild("Window/Bg").gameObject.GetComponent <UITexture>(); BGSimple = transform.FindChild("Window/Bg_Simple").gameObject.GetComponent <UITexture>(); foreach (KeyValuePair <uint, List <LuaComponent> > items in mapPlayerIdLoadingState) { items.Value.Clear(); } mapPlayerIdLoadingState.Clear(); NetworkConn conn = GameSystem.Instance.mNetworkManager.m_platConn; if (conn != null) { conn.EnableTimeout(false); } conn = GameSystem.Instance.mNetworkManager.m_gameConn; if (conn != null) { conn.EnableTimeout(false); } GameSystem.Instance.mClient.mUIManager.isInMatchLoading = true; m_curLoadingStep = LoadingStep.eInit; }
public static void SendTurnCheckData(CheckFrame checkData) { NetworkConn conn = GameSystem.Instance.mNetworkManager.m_gameConn; if (conn == null) { return; } conn.SendPack(0, checkData, MsgID.CheckFrameID); }
public static void SendTeamMatchData(TeamMatchData teamData) { NetworkConn conn = GameSystem.Instance.mNetworkManager.m_gameConn; if (conn == null) { return; } conn.SendPack(0, teamData, MsgID.TeamMatchDataID); }
static int SendMsgFromLua(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); LuaStringBuffer arg1 = LuaScriptMgr.GetStringBuffer(L, 3); obj.SendMsgFromLua(arg0, arg1); return(0); }
public void CloseLoginConn() { Debug.Log("Close login conn."); if (m_loginConn != null) { m_loginConn.Close(); } m_loginConn = null; }
static int Connect(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); string arg0 = LuaScriptMgr.GetLuaString(L, 2); int arg1 = (int)LuaScriptMgr.GetNumber(L, 3); obj.Connect(arg0, arg1); return(0); }
public void Getloginconn(string ip, int port) { if (m_loginConn == null) { Debug.Log("Get login conn."); m_loginConn = new NetworkConn(m_loginMsgHandler, "Login", NetworkConn.Type.eLoginServer, 5); m_loginConn.AddEventListener(this); LoginNetwork.Instance.ConnectToLS(); } }
private void EstNetworkConn() { // We use the connection manager on PPCs and Smartphones. if (App.DevCap.Lvl >= DevCapLvl.Desktop) { return; } networkConn = new NetworkConn("http://" + opts.Host + "/"); networkConn.Est(); }
static int IsSocketConnected(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); System.Net.Sockets.Socket arg0 = (System.Net.Sockets.Socket)LuaScriptMgr.GetNetObject(L, 2, typeof(System.Net.Sockets.Socket)); bool o = obj.IsSocketConnected(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int OnEvent(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); NetworkManager obj = (NetworkManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkManager"); NetworkConn.NetworkEvent arg0 = (NetworkConn.NetworkEvent)LuaScriptMgr.GetNetObject(L, 2, typeof(NetworkConn.NetworkEvent)); NetworkConn arg1 = (NetworkConn)LuaScriptMgr.GetNetObject(L, 3, typeof(NetworkConn)); obj.OnEvent(arg0, arg1); return(0); }
static int enDecrypt(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); NetworkConn obj = (NetworkConn)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkConn"); byte[] objs0 = LuaScriptMgr.GetArrayNumber <byte>(L, 2); uint arg1 = (uint)LuaScriptMgr.GetNumber(L, 3); bool o = obj.enDecrypt(objs0, arg1); LuaScriptMgr.Push(L, o); return(1); }
public static void SendTimeTracer(uint msgId, double dCurTime, NetworkConn server) { if (server == null || !server.IsConnected()) { return; } TimeTracer tracer = new TimeTracer(); tracer.sendTimeStamp = dCurTime; tracer.id = msgId; server.SendPack <TimeTracer>(0, tracer, MsgID.TimeTracerID); }
private void RelNetworkConn() { // We use the connection manager on PPCs and Smartphones. if (App.DevCap.Lvl >= DevCapLvl.Desktop) { return; } if (networkConn != null) { networkConn.Rel(); networkConn = null; } }
public bool BeginWatch(NetworkConn networkConn, double fServerTime) { if (!m_toWatch) { return(false); } if (mNetworkConn == null || mNetworkConn != networkConn) { return(false); } m_beginWatch = true; m_clientTime = fServerTime; return(true); }