_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Login/Global.cs

98 lines
2.5 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;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Global : MonoBehaviour
{
public logoPanel.ServerResponse serverResponse;
public Response response;
public static Global global ;
// Start is called before the first frame update
void Start()
{
global = this;
DontDestroyOnLoad(this);
}
// 创建请求头,使用最新的 token
public Dictionary<string, string> CreateHeaders()
{
if (string.IsNullOrEmpty(Global.global.serverResponse.data.token))
{
Debug.LogWarning("尝试创建请求头时token 未设置。");
return new Dictionary<string, string>();
}
return new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
}
}
[Serializable]
public class GameEscapeRoomResponseVo
{
public int escapeId; // 游戏的ID
public int roomNo; // 房间编号
public float roomBeansCoin; // 房间下注欢乐豆
}
[Serializable]
public class userIDgameId
{
public int userId; // 用户id
public int escapeId; // 游戏id
}
[Serializable]
public class Data
{
public int carrySeconds; // 携带时间秒数
public List<GameEscapeRoomResponseVo> gameEscapeRoomResponseVoList; // 房间列表
public GameEscapeModel gameEscapeModel; // 游戏逃亡模型 (目前未处理)
public object gameEscapeUserModel; // 游戏逃亡用户模型 (目前未处理)
}
[Serializable]
public class ServerResponse
{
public int code; // 响应状态码
public string message; // 提示语
public Data data; // 数据对象
}
// 数据类
[Serializable]
public class GameEscapeModel
{
public int id; // 游戏 ID
public string gameNo; // 游戏编号
public int demonMode; // 恶魔模式
public string startTime; // 开始时间
public string betTime; // 下注时间
public string countTime; // 结算时间
public string settleTime; // 最终结算时间
public int status; // 游戏状态
public string roomNoKill; // 无杀房间号
public string roomNoRemain; // 剩余房间号
public float beansCoinAll; // 总豆币数
public float beansCoinKill; // 击杀豆币数
public float beansCoinRemain; // 剩余豆币数
public float beansCoinFee; // 手续费
public float beansCoinRank; // 排名奖励豆币
public float beansCoinDivide; // 分成豆币
}
[Serializable]
public class Response
{
public int code; // 状态码
public string message; // 返回信息
public Data data; // 数据对象
}