void Awake() { mTestPackage = new RequestStringPackage(udpboxContainer == null ? udpBoxPureContainer.UDPBox.PackageHeadBytes : udpboxContainer.PackageHeadBytes); requestString.OnProcessRequest = (str) => { if (str == "hahaha") { return("hehehe"); } else { return("404"); } }; requestString.OnProcessResponse = (req_cache, resp) => { Debug.Log("req_cache: " + req_cache + " resp: " + resp); }; }
public RequestStringHandler(byte[] packageHeadBytes, Func <string, string> onProcessRequest, Action <string, string> onProcessResponse) { mOnProcessRequest = onProcessRequest; mOnProcessResponse = onProcessResponse; mTemplate = new RequestStringPackage(packageHeadBytes); }