public static void SendToSocketServer(int index, System.Object msg) { if (clients == null) { return; } if (index < 0 || index >= clients.Length) { Debugger.LogError("send client index is invalid->" + index + "^" + clients.Length); return; } NetClient netClient = clients[index]; if (netClient != null && netClient.IsSocketOK()) { netClient.SendToSocketServer(msg); } else { Debugger.LogError("net client is not available->" + index); } }
public static void ScriptSendToSocketServer(int index, int tid, int gid, int uid, byte[] body) { if (clients == null) { return; } if (index < 0 || index >= clients.Length) { Debugger.LogError("script send client index is invalid->" + index + clients.Length); return; } NetClient netClient = clients[index]; if (netClient != null && netClient.IsSocketOK()) { netClient.SendToSocketServer((byte)tid, (byte)gid, (byte)uid, body); } else { Debugger.LogError("net client is not available->" + index); } }
public static void ConnectSocketClient(int index) { if (clients == null) { return; } if (index < 0 || index >= clients.Length) { Debugger.LogError("connect index is invalid->" + index + "^" + clients.Length); return; } else { NetClient netClient = clients[index]; if (netClient != null && !netClient.IsSocketOK()) { netClient.Connect(); } else { Debugger.LogError("need to register socket client first"); } } }