public static void Ping(string ip, LuaInterface.LuaFunction func, int funcID) { if (func == null) { return; } NetPing ping = GenPing(); if (ping == null) { Debug.LogError("ping num is to much"); return; } if (Config.Detail_Debug_Log()) { Debug.Log("----------net ping 0->" + ip); } CoroutineHelper.CreateCoroutineHelper(ping.PingConnect(ip, (state, delay) => { ping.index = -1; LuaManager.CallFunc_V(func, state, delay, funcID); })); }
public static void Ping(string ip, NetPingCallBack callback) { if (callback == null) { return; } NetPing ping = GenPing(); if (ping == null) { Debug.LogError("ping num is to much"); return; } CoroutineHelper.CreateCoroutineHelper(ping.PingConnect(ip, (state, delay) => { ping.index = -1; callback(state, delay); })); }
private static NetPing GenPing() { NetPing ping = null; for (int i = 0, count = pingArr.Length; i < count; i++) { ping = pingArr[i]; if (ping == null) { ping = new NetPing(); pingArr[i] = ping; } if (ping.index < 0) { ping.index = i; return(ping); } } return(null); }