120 lines
3.0 KiB
C#
120 lines
3.0 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
public class Global : MonoBehaviour
|
||
{
|
||
|
||
public logoPanel.ServerResponse serverResponse;
|
||
public ServerResponse 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 Data514
|
||
{
|
||
public int 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 ServerResponse: Response
|
||
{
|
||
public Data data; // 数据对象
|
||
}
|
||
[Serializable]
|
||
public class ServerResponse514: Response
|
||
{
|
||
public Data514 data; // 数据对象
|
||
}
|
||
|
||
public class Response
|
||
{
|
||
public int code; // 响应状态码
|
||
public string message; // 提示语
|
||
}
|
||
// 数据类
|
||
[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; // 分成豆币
|
||
}
|