1
This commit is contained in:
@@ -27,7 +27,10 @@ public class GameManager : MonoSingleton<GameManager>
|
||||
/// <summary>
|
||||
/// 头像更新事件(换了头像后触发,所有头像控件统一刷新)
|
||||
/// </summary>
|
||||
/// <summary>头像更新事件</summary>
|
||||
public event Action<Sprite> OnAvatarChanged;
|
||||
/// <summary>用户数据更新事件(金币/钻石/等级等发生变化时触发)</summary>
|
||||
public event Action OnUserDataChanged;
|
||||
|
||||
/// <summary>头像字典(name → sprite),从 Resources/Avatar 加载</summary>
|
||||
private Dictionary<string, Sprite> avatarSpriteDict = new Dictionary<string, Sprite>();
|
||||
@@ -114,12 +117,7 @@ public class GameManager : MonoSingleton<GameManager>
|
||||
public void UpdataUserData(UserData user)
|
||||
{
|
||||
this.user = user;
|
||||
var a = UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel);
|
||||
if (a!=null)
|
||||
{
|
||||
a.UpdateUserData();
|
||||
}
|
||||
|
||||
OnUserDataChanged?.Invoke();
|
||||
}
|
||||
protected override void Awake()
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Assets.MyGame.Scripts.Net.APIRequest.Params
|
||||
public class SaveSafeBoxParam : RequestParamBase
|
||||
{
|
||||
|
||||
public int amount; // 存入金额
|
||||
public int gold; // 存入金额
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -18,16 +18,45 @@ namespace Assets.MyGame.Scripts.Net.APIRequest.Params
|
||||
[Serializable]
|
||||
public class SetSafeBoxPasswordParam : RequestParamBase
|
||||
{
|
||||
public string newPwd; // 新密码
|
||||
public string password; // 新密码
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置保险箱密码请求参数
|
||||
/// 重置保险箱密码请求参数(GET)
|
||||
/// Swagger: /api/Hall/ResetSafeBoxPassword?password=&code=
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ResetSafeBoxPasswordParam : RequestParamBase
|
||||
{
|
||||
public string code; // 验证码
|
||||
public string password;
|
||||
public string code;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取出保险箱请求参数(GET)
|
||||
/// Swagger: /api/Hall/GetSafeBox?gold=&password=
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class GetSafeBoxInfoParam : RequestParamBase
|
||||
{
|
||||
public long gold;
|
||||
public string password;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资产变动记录参数(GET)
|
||||
/// Swagger: /api/Hall/GetUserRewardList
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class GetUserRewardListObj : RequestObjBase
|
||||
{
|
||||
public string keyWord;
|
||||
public int pageIndex;
|
||||
public int pageSize;
|
||||
public string userId;
|
||||
public int type; // 1增加 2减少 0全部
|
||||
public int source;
|
||||
public int currencyType; // 1金币 2金币保险箱 3钻石 0全部
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Assets.MyGame.Scripts.Net.APIRequest.Objs;
|
||||
using Assets.MyGame.Scripts.Net.APIRequest.Params;
|
||||
using Assets.MyGame.Scripts.Net.APIResponses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Assets.MyGame.Scripts.Net
|
||||
{
|
||||
@@ -30,6 +31,16 @@ namespace Assets.MyGame.Scripts.Net
|
||||
APIManager.Response<SafeBoxInfo>(APIType.Hall_GetSafeBox, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取出保险箱(GET,带参数)
|
||||
/// 参数:gold(取出数量)、password(保险箱密码)
|
||||
/// 返回:SafeBoxInfo(取款后保险箱信息)
|
||||
/// </summary>
|
||||
public static void GetSafeBox(GetSafeBoxInfoParam req, Action<SafeBoxInfo> callback)
|
||||
{
|
||||
APIManager.Response<SafeBoxInfo>(APIType.Hall_GetSafeBox, req, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置保险箱密码(POST)
|
||||
/// 参数:用户ID、新密码
|
||||
@@ -220,6 +231,16 @@ namespace Assets.MyGame.Scripts.Net
|
||||
APIManager.Response<ScratchCardResult>(APIType.Hall_ScratchCardDraw, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资产变动记录(GET)
|
||||
/// 参数:keyWord/pageIndex/pageSize/userId/type/source/currencyType
|
||||
/// 返回:List<UserRewardDto>
|
||||
/// </summary>
|
||||
public static void GetUserRewardList(GetUserRewardListObj req, Action<List<UserRewardDto>> callback)
|
||||
{
|
||||
APIManager.Response<List<UserRewardDto>>(APIType.Hall_GetUserRewardList, req, callback);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace Assets.MyGame.Scripts.Net.APIResponses
|
||||
[Serializable]
|
||||
public class SafeBoxInfo
|
||||
{
|
||||
public int userId; // 用户ID
|
||||
public int balance; // 保险箱余额
|
||||
public int bagBalance; // 背包余额(如果接口返回)
|
||||
public int code;
|
||||
public string info;
|
||||
public string data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -172,4 +172,27 @@ namespace Assets.MyGame.Scripts.Net.APIResponses
|
||||
/// <summary>道具信息(prizeType=3 时有值)</summary>
|
||||
public BaseProduct baseProduct;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户资产变动DTO(接口:/api/Hall/GetUserRewardList)
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class UserRewardDto
|
||||
{
|
||||
public string id;
|
||||
public string userId;
|
||||
public int type;
|
||||
public int source;
|
||||
public int currencyType;
|
||||
public long beforeCount;
|
||||
public long changeCount;
|
||||
public long afterCount;
|
||||
public string otherId;
|
||||
public string otherUserId;
|
||||
public string remark;
|
||||
public string roomName;
|
||||
public string roomInfo;
|
||||
public int tax;
|
||||
public long createTime;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user