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); } }
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); } }
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)); }); } }
private static bool TryGameRunner(int gameId, out GameRunner gameRunner) { return(CTLTools.TryGameRunner(gameId, out gameRunner)); }