_xiaofang/xiaofang/Assets/Script/login/MyGlobal.cs
2024-12-11 11:01:36 +08:00

182 lines
5.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyGlobal : Global
{
public static MyGlobal global;
public loginResponse loginResponse;
private void Start()
{
global = this;
}
// 创建请求头,使用最新的 token
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.data.access_token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization", MyGlobal.global.loginResponse.data.access_token }
};
}
//// 创建请求头,使用最新的 token
//public Dictionary<string, string> CreateHeaders()
//{
// if (string.IsNullOrEmpty(response.data.access_token))
// {
// Debug.LogWarning("尝试创建请求头时token 未设置。");
// return new Dictionary<string, string>();
// }
// return new Dictionary<string, string>
// {
// { "Authorization", response.data.access_token }
// };
//}
}
public class loginResponse : Response
{
public loginData data;
//public string access_token;
}
public class Response
{
public int code;
public string msg;
}
public class loginData
{
public string access_token;
public string companyId;
public string companyName;
public string client_id;
public int expire_in;//toling剩余时间
public string isCreater;//是否是模板创建者Y是则跳蓝湖预定演练01页面开始创建模板N否则跳蓝狐回放1页面
}
public static class GlobalData
{
// 静态变量用于存储登录响应数据
public static loginResponse ServerData;
}
//====================================================
//public class TemplateListData: Response
//{
// public string[] data;
//}
//public class newTemplateData: Response
//{
// public string data;
//}
//=================================================================
// 根数据类
//public class QuerySceneData
//{
// public int code { get; set; }
// public string msg { get; set; }
// public List<Scene> data { get; set; }
//}
//// 场景信息类
//public class Scene
//{
// public string id { get; set; }
// public string name { get; set; }
// public string type { get; set; }
// public string description { get; set; }
// public int suitIndustry { get; set; }
// public string price { get; set; }
// public int companyId { get; set; }
// public string status { get; set; }
// public string delFlag { get; set; }
// public string remark { get; set; }
// public string gameName { get; set; }
// public string gameType { get; set; }
// public string ossId { get; set; }
// public List<File> fileList { get; set; }
// public string gameStoreroom { get; set; }
// public string industryName { get; set; }
// public string companyName { get; set; }
//}
//// 文件信息类
//public class File
//{
// public string ossId { get; set; }
// public string name { get; set; }
// public string url { get; set; }
// public string originalName { get; set; }
// public string fileSuffix { get; set; }
//}
//=================================================================
//public class DrillSubject : Response
//{
// [JsonProperty("data")]
// public List<QueryDrillSubjectData> data; // 确保字段名与 JSON 中的匹配
//}
//public class QueryDrillSubjectData
//{
// public string id;
// public string[] sceneIds;
// public string sceneNames;
// public string name;
// public string suitVersion;
// public string type;
// public string description;
// public string price;
// public string companyId;
// public string status;
// public string delFlag;
// public string remark;
// public string gameName;
// public string ossId;
// public string fileList;
//}
//===============================================================
//public class RoleList
//{
// public int code; // 与 JSON 中的 "code" 字段对应
// public string msg; // 与 JSON 中的 "msg" 字段对应
// public List<RoleData> data; // 与 JSON 中的 "data" 字段对应,包含角色的列表
//}
//public class RoleData
//{
// public string id; // 与 JSON 中的 "id" 字段对应
// public string roleName; // 与 JSON 中的 "roleName" 字段对应
// public string sceneId; // 与 JSON 中的 "sceneId" 字段对应
// public int gameName; // 与 JSON 中的 "gameName" 字段对应,注意这里是 int 类型
// public string roleAttributions; // 与 JSON 中的 "roleAttributions" 字段对应
//}
//===================================================================
//public class BindPlayer:Response
//{
// public string data;
//}
//=============================================================
//public class BindNPC : Response
//{
// public string data;//++++++++++++++++++++++++++++++++++++
//}
//====================================================
//public class BindMaterial : Response
//{
// public string data;//++++++++++++++++++++++++++++++++++++
//}
//===================================================
//public class SubmitTemplate : Response
//{
// public string data;//++++++++++++++++++++++++++++++++++++
//}