using System.Collections; using System.Collections.Generic; using UnityEngine; public class MyGlobal : Global { public static MyGlobal global; public loginResponse loginResponse; //public ScheduledDrillResponse scheduledDrillResponse; private void Start() { global = this; } // 创建请求头,使用最新的 token public Dictionary CreateHeaders() { if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.data.access_token)) { Debug.LogWarning("尝试创建请求头时,token 未设置。"); return new Dictionary(); } return new Dictionary { { "Authorization", MyGlobal.global.loginResponse.data.access_token } }; } //// 创建请求头,使用最新的 token //public Dictionary CreateHeaders() //{ // if (string.IsNullOrEmpty(response.data.access_token)) // { // Debug.LogWarning("尝试创建请求头时,token 未设置。"); // return new Dictionary(); // } // return new Dictionary // { // { "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 userId; // 用户ID,标识用户的唯一身份。 public string scope; // 权限范围,描述当前用户的访问权限范围或操作权限。可能是某些资源的访问权限。 public string openId; // 用户的唯一标识,用于识别用户。通常用于开放平台授权登录的场景。 public string companyId; // 公司ID,标识所属公司的唯一ID。 public string companyName; // 公司名称,标识用户所属公司或组织的名称。 public string isCreater; // 是否为模板创建者,"Y"表示是模板创建者,"N"表示不是。影响用户跳转的页面逻辑。 public string access_token; // Access Token,用于认证用户身份,通常在OAuth 2.0中用于授权用户访问资源。 public string refresh_token; // Refresh Token,通常用于刷新Access Token,延长用户会话的有效期。 public int expire_in; // Access Token的过期时间(单位:秒)。表示token有效期时长。 public string refresh_expire_in; // Refresh Token的过期时间(单位:秒),表示Refresh Token的有效期时长。 public string client_id; // 客户端ID,用于标识请求的应用或服务。 } public static class GlobalData { // 静态变量用于存储登录响应数据 public static loginResponse ServerData; public static ScheduledDrillResponse scheduledDrillResponse; } //==================================================== //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 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 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 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 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;//++++++++++++++++++++++++++++++++++++ //}