Пример #1
0
        public static void ConnectServer(int gameId, string ip, int port, Action <bool> callback)
        {
            GameRunner gameRunner;

            CTLTools.TryGameRunner(gameId, out gameRunner);
            if (gameRunner != null)
            {
                gameRunner.STContainer.SocketClientMgr.BeginConnect(ip, port, SocketClientType.Game, callback);
            }
        }
Пример #2
0
        public static void SendMsg(int gameId, int msgId, LuaByteBuffer data)
        {
            GameRunner gameRunner;

            CTLTools.TryGameRunner(gameId, out gameRunner);
            if (gameRunner != null)
            {
                gameRunner.STContainer.SocketClientMgr.SendMsg(SocketClientType.Game, (ushort)msgId, data.buffer);
            }
        }
Пример #3
0
        public static void RegisterNetMsg(int gameId, int msgId, NetMsgHander handler)
        {
            GameRunner gameRunner;

            CTLTools.TryGameRunner(gameId, out gameRunner);
            if (gameRunner != null)
            {
                gameRunner.STContainer.SocketClientMgr.RegisterListener(SocketClientType.Game, (ushort)msgId, (MsgPacket packet) => {
                    handler.Invoke((int)packet.ID, (int)packet.Status, new LuaByteBuffer(packet.Buff));
                });
            }
        }
Пример #4
0
 private static bool TryGameRunner(int gameId, out GameRunner gameRunner)
 {
     return(CTLTools.TryGameRunner(gameId, out gameRunner));
 }