Cute_demon_attacks/meng_yao/Assets/script/serveTestScript/MyGlobal.cs

74 lines
1.7 KiB
C#

using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyGlobal : MonoBehaviour
{
public static MyGlobal global;
public loginResponse loginResponse =new loginResponse();
private void Awake()
{
if (global != null)
{
return;
}
global = this;
DontDestroyOnLoad(gameObject);
}
// 创建请求头,使用最新的 token
public Dictionary<string, string> CreateHeaders()
{
return new Dictionary<string, string>
{
{"platform","ios" },
{"phone_product","apple" },{"phone_model","iPhone_8" },{"system_version","12.0" },
{ "screen_size","750*1334" },
{"device_no","e3e277810fff9d955ebdd7037eff51a8" },
{"version","1.0.0"}
};
}
}
//===========================================================================================================
public class myResponse//=========总============
{
public int code;
public string message;
}
//===========================================================
public class loginResponse : myResponse//登录返回值
{
public data Data =new data();
}
public class data
{
public string access_token;
public string token_type;
public int expires_in;
public string scope;
}
public class RegisterResponse: myResponse//注册返回值
{
public registerData data;
}
public class registerData
{
public int auto_login;
public registerToken token;
}
public class registerToken
{
public string access_token;
public string token_type;
public int expires_in;
public string scope;
}
//============================================================