Beispiel #1
0
        /// <summary>
        /// 发送给服务器的数据
        /// </summary>
        /// <param name="_scriptName">服务器端,协议类名</param>
        /// <param name="_netForm">发送给服务器的json数据</param>
        /// <param name="respondFunction">服务器返回给客户端的数据</param>
        public void RequestOfSocket(string _scriptName, DMNetForm _netForm, RespondOfHttpJD respondFunction)
        {
            string jdStr = JsonMapper.ToJson(_netForm.GetSendObj);
            string jd    = _scriptName + jdStr + "\r\n";

            Debug.LogError(jd);
            byte[] strBytes = Encoding.UTF8.GetBytes(jd);
            ReceiveMessage(strBytes, respondFunction);
        }
Beispiel #2
0
        public void RequestOfHttp(string _scriptName, DMNetForm _netForm, RespondOfHttpJD respondFunction)
        {
            string jdStr = JsonMapper.ToJson(_netForm.GetSendObj);
            string jddd  = _scriptName + jdStr + "\r\n";

            Debug.LogError(jddd);
            byte[] strBytes = Encoding.UTF8.GetBytes(jddd);
            StartCoroutine(RequestServer(strBytes, respondFunction));
        }