public IConnection ConnectToScratch(string host, bool autoConnect) { if (string.IsNullOrEmpty(host)) { DebugUtility.LogErrorTrace(LoggerTags.Online, "The scratch host is empty."); return(null); } if (mConns.TryGetValue(host, out var conn) && conn.state != ENetState.Disconnected) { DebugUtility.LogErrorTrace(LoggerTags.Online, "Please destroy the scratch connection."); return(conn); } mConns[host] = conn = new ScratchConnection(); if (autoConnect) { conn.Connect(host); } return(conn); }
public ScratchProtocolDispatcher(ScratchConnection conn) { mScratchConn = conn; }