/// <summary> /// parse input data /// </summary> /// <param name="url"></param> /// <param name="callback"></param> /// <param name="ud"></param> public void SocketRequest(int actionId, INetCallback callback, object userData, bool bShowLoading) { if (mSocket == null) { string strUrl = NetWriter.GetUrl(); Debug.Log("url" + strUrl); string[] arr = strUrl.Split(new char[] { ':' }); int nPort = int.Parse(arr[1]); mSocket = new SocketConnect(arr[0], nPort); } NetWriter writer = NetWriter.Instance; writer.writeInt32("actionId", actionId); byte[] data = NetWriter.Instance.PostData(); SocketPackage package = new SocketPackage(); package.FuncCallback = callback; package.UserData = userData; package.MsgId = NetWriter.MsgId - 1; package.ActionId = actionId; package.HasLoading = bShowLoading; package.SendTime = DateTime.Now; NetWriter.resetData(); if (bShowLoading) { RequestDelegate(Status.eStartRequest); } mSocket.Request(data, package); }