From eda22bcd9683f3a94e0744da60d23808272c627f Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 13 八月 2018 17:28:00 +0800
Subject: [PATCH] 1528 冰晶矿脉里面角色死亡复活后怪物血条位置显示异常
---
System/HttpRequest/HttpRequest.cs | 224 ++++++++++++++++++++++++++++----------------------------
1 files changed, 112 insertions(+), 112 deletions(-)
diff --git a/System/HttpRequest/HttpRequest.cs b/System/HttpRequest/HttpRequest.cs
index 7289a16..0ce6c5c 100644
--- a/System/HttpRequest/HttpRequest.cs
+++ b/System/HttpRequest/HttpRequest.cs
@@ -1,118 +1,118 @@
锘縰sing System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Text;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Text;
using UnityEngine;
-public class HttpRequest : SingletonMonobehaviour<HttpRequest>
-{
- public const string defaultHttpContentType = "application/x-www-form-urlencoded";
- public const string jsonHttpContentType = "application/json ; charset=utf-8";
-
- public void RequestWWW(string _url, int _retry = 3, Action<bool, string> _result = null)
- {
- StartCoroutine(Co_RequestWWW(_url, null, _retry, _result));
- }
-
- public void RequestWWW(string _url, IDictionary<string, string> _parameters, int _retry = 3, Action<bool, string> _result = null)
- {
- StartCoroutine(Co_RequestWWW(_url, _parameters, _retry, _result));
- }
-
- IEnumerator Co_RequestWWW(string _url, IDictionary<string, string> _parameters, int _retry = 3, Action<bool, string> _result = null)
- {
- if (_url == null || _url.Length == 0)
- {
- DesignDebug.LogError("PHPDataComm post 鍙傛暟鏈夐敊");
- if (_result != null)
- {
- _result(false, string.Empty);
- _result = null;
- }
- yield break;
- }
-
- int i = 0;
- bool isSuccess = false;
-
- byte[] data = null;
- if (_parameters != null)
- {
- data = Encoding.UTF8.GetBytes(HashtablaToString(_parameters));
- }
-
- var PostData = data == null ? new WWW(_url) : new WWW(_url, data);
-
- while (!PostData.isDone)
- {
- yield return null;
- }
-
- if (PostData.error != null)
- {
- Debug.LogErrorFormat("WWW 鏁版嵁閫氫俊,璇锋眰鏁版嵁澶辫触锛歿0},宸茬粡灏濊瘯,{1},娆�", PostData.error, i);
- }
- else
- {
- if (!string.IsNullOrEmpty(PostData.text))
- {
- DesignDebug.LogFormat("WWW 鏁版嵁閫氫俊,璇锋眰鏁版嵁鎴愬姛锛歿0}", PostData.text);
- isSuccess = true;
- if (_result != null)
- {
- _result(true, PostData.text);
- _result = null;
- }
- }
- }
-
- if (!isSuccess)
- {
- if (_result != null)
- {
- _result(false, string.Empty);
- _result = null;
- }
- }
- }
-
- public void RequestHttpPost(string _url, IDictionary<string, string> _parameters, string _contentType, int _retry = 3, Action<bool, string> _result = null)
- {
- var content = HashtablaToString(_parameters);
- HttpBehaviour.Create(_url, "POST", content, _contentType, _retry, _result);
- }
-
- public void RequestHttpPost(string _url, string _content, string _contentType, int _retry = 3, Action<bool, string> _result = null)
- {
- HttpBehaviour.Create(_url, "POST", _content, _contentType, _retry, _result);
- }
-
- public void RequestHttpGet(string _url, string _contentType, int _retry = 3, Action<bool, string> _result = null)
- {
- HttpBehaviour.Create(_url, "GET", "", _contentType, _retry, _result);
- }
-
- static StringBuilder buffer = new StringBuilder();
- public static string HashtablaToString(IDictionary<string, string> parameters)
- {
- buffer.Remove(0, buffer.Length);
- int i = 0;
- foreach (KeyValuePair<string, string> item in parameters)
- {
- if (i > 0)
- {
- buffer.AppendFormat("&{0}={1}", item.Key, item.Value);
- }
- else
- {
- buffer.AppendFormat("{0}={1}", item.Key, item.Value);
- }
- i++;
- }
- string result = buffer.ToString();
- return result;
+public class HttpRequest : SingletonMonobehaviour<HttpRequest>
+{
+ public const string defaultHttpContentType = "application/x-www-form-urlencoded";
+ public const string jsonHttpContentType = "application/json ; charset=utf-8";
+
+ public void RequestWWW(string _url, int _retry = 3, Action<bool, string> _result = null)
+ {
+ StartCoroutine(Co_RequestWWW(_url, null, _retry, _result));
+ }
+
+ public void RequestWWW(string _url, IDictionary<string, string> _parameters, int _retry = 3, Action<bool, string> _result = null)
+ {
+ StartCoroutine(Co_RequestWWW(_url, _parameters, _retry, _result));
+ }
+
+ IEnumerator Co_RequestWWW(string _url, IDictionary<string, string> _parameters, int _retry = 3, Action<bool, string> _result = null)
+ {
+ if (_url == null || _url.Length == 0)
+ {
+ DesignDebug.LogError("PHPDataComm post 鍙傛暟鏈夐敊");
+ if (_result != null)
+ {
+ _result(false, string.Empty);
+ _result = null;
+ }
+ yield break;
+ }
+
+ int i = 0;
+ bool isSuccess = false;
+
+ byte[] data = null;
+ if (_parameters != null)
+ {
+ data = Encoding.UTF8.GetBytes(HashtablaToString(_parameters));
+ }
+
+ var PostData = data == null ? new WWW(_url) : new WWW(_url, data);
+
+ while (!PostData.isDone)
+ {
+ yield return null;
+ }
+
+ if (PostData.error != null)
+ {
+ Debug.LogErrorFormat("WWW 鏁版嵁閫氫俊,璇锋眰鏁版嵁澶辫触锛歿0},宸茬粡灏濊瘯,{1},娆�", PostData.error, i);
+ }
+ else
+ {
+ if (!string.IsNullOrEmpty(PostData.text))
+ {
+ DesignDebug.LogFormat("WWW 鏁版嵁閫氫俊,璇锋眰鏁版嵁鎴愬姛锛歿0}", PostData.text);
+ isSuccess = true;
+ if (_result != null)
+ {
+ _result(true, PostData.text);
+ _result = null;
+ }
+ }
+ }
+
+ if (!isSuccess)
+ {
+ if (_result != null)
+ {
+ _result(false, string.Empty);
+ _result = null;
+ }
+ }
+ }
+
+ public void RequestHttpPost(string _url, IDictionary<string, string> _parameters, string _contentType, int _retry = 3, Action<bool, string> _result = null)
+ {
+ var content = HashtablaToString(_parameters);
+ HttpBehaviour.Create(_url, "POST", content, _contentType, _retry, _result);
+ }
+
+ public void RequestHttpPost(string _url, string _content, string _contentType, int _retry = 3, Action<bool, string> _result = null)
+ {
+ HttpBehaviour.Create(_url, "POST", _content, _contentType, _retry, _result);
+ }
+
+ public void RequestHttpGet(string _url, string _contentType, int _retry = 3, Action<bool, string> _result = null)
+ {
+ HttpBehaviour.Create(_url, "GET", "", _contentType, _retry, _result);
+ }
+
+ static StringBuilder buffer = new StringBuilder();
+ public static string HashtablaToString(IDictionary<string, string> parameters)
+ {
+ buffer.Remove(0, buffer.Length);
+ int i = 0;
+ foreach (KeyValuePair<string, string> item in parameters)
+ {
+ if (i > 0)
+ {
+ buffer.AppendFormat("&{0}={1}", item.Key, item.Value);
+ }
+ else
+ {
+ buffer.AppendFormat("{0}={1}", item.Key, item.Value);
+ }
+ i++;
+ }
+ string result = buffer.ToString();
+ return result;
}
}
\ No newline at end of file
--
Gitblit v1.8.0