This commit is contained in:
2026-03-27 15:18:35 +08:00
parent a6a1847d8b
commit 2396a75504
1227 changed files with 79169 additions and 170265 deletions
+16 -16
View File
@@ -16,9 +16,9 @@ namespace Assets.MyGame.Scripts.Net
{
public static Dictionary<APIType, string> dic_API = new Dictionary<APIType, string>();
//public const string baseURL = "http://game5241.wzaxr.top";
public const string baseURL = "http://172.20.10.12";
public const string baseURL = "http://8.137.163.153";
static string token;
static APIManager()
{
// ---------------- GameConfig ----------------
@@ -151,7 +151,7 @@ namespace Assets.MyGame.Scripts.Net
}
Log(json + "\n------Get");
if (res.code==0)
if (res.code == 0)
{
action?.Invoke(res.data);
}
@@ -159,8 +159,8 @@ namespace Assets.MyGame.Scripts.Net
{
ErrorHandle(res.code, res.info);
}
}
else
{
@@ -195,7 +195,7 @@ namespace Assets.MyGame.Scripts.Net
{
var json = req.downloadHandler.text;
var res = JsonConvert.DeserializeObject<APIResponse<T>>(json);
Log(json+"\n------Post");
Log(json + "\n------Post");
if (res.code == 0)
{
action?.Invoke(res.data);
@@ -204,7 +204,7 @@ namespace Assets.MyGame.Scripts.Net
{
ErrorHandle(res.code, res.info);
}
}
else
{
@@ -237,23 +237,23 @@ namespace Assets.MyGame.Scripts.Net
/// <typeparam name="T"></typeparam>
/// <param name="apiType"></param>
/// <param name="action"></param>
public static void Response<T>(APIType apiType,Action<T> action = null)
public static void Response<T>(APIType apiType, Action<T> action = null)
{
string url = baseURL + dic_API[apiType];
GetSend<T>(url, null, action);
GetSend<T>(url, null, action);
}
public static void Log(string json)
{
Debug.Log(json);
}
public static void ErrorHandle(int code,string message)
public static void ErrorHandle(int code, string message)
{
Debug.LogError("错误代码:"+code+"错误信息:"+message);
//这里之后补弹窗
Debug.LogError("错误代码:" + code + "错误信息:" + message);
//这里之后补弹窗
}
}
}