public static NetClient GetGameSocket() { if (socket == null) { NetClient.PingDelegate pingDelegate = new NetClient.PingDelegate(PingGameServer); socket = NetClient.NewInstance("_GameSocket", pingDelegate, 20000); } return(socket); }
public static NetClient GetGatewaySocket() { if (gatewaySocket == null) { NetClient.PingDelegate pingDelegate = new NetClient.PingDelegate(PingGateway); gatewaySocket = NetClient.NewInstance("_GameWaySocket", PingGateway, 20000); } return(gatewaySocket); }
public static NetClient NewInstance(string name, NetClient.PingDelegate pingDelegate, int pingTimeout) { GameObject go = new GameObject(name); go.hideFlags = HideFlags.HideAndDontSave; DontDestroyOnLoad(go); NetClient netClient = go.AddComponent<NetClient>(); netClient.m_pingDelegate = pingDelegate; netClient.m_pingTimeount = pingTimeout; return netClient; }