This commit is contained in:
2026-07-10 01:41:46 +08:00
parent 1ee3f41270
commit a6b9c8bbf8
8 changed files with 234 additions and 1321 deletions
File diff suppressed because it is too large Load Diff
+1
View File
@@ -68,6 +68,7 @@ namespace Assets.MyGame.Scripts.Net
dic_API[APIType.Hall_GetMonthCardGift] = "/api/Hall/GetMonthCardGift"; dic_API[APIType.Hall_GetMonthCardGift] = "/api/Hall/GetMonthCardGift";
dic_API[APIType.Hall_GetUserTaskList] = "/api/Hall/GetUserTaskList"; dic_API[APIType.Hall_GetUserTaskList] = "/api/Hall/GetUserTaskList";
dic_API[APIType.Hall_DistributeRewards] = "/api/Hall/DistributeRewards"; dic_API[APIType.Hall_DistributeRewards] = "/api/Hall/DistributeRewards";
dic_API[APIType.Hall_ReceiveAllTaskRewards] = "/api/Hall/ReceiveAllTaskRewards";
// ---------------- BattleOrder ---------------- // ---------------- BattleOrder ----------------
dic_API[APIType.Hall_GetBattleOrder] = "/api/Hall/GetBattleOrder"; dic_API[APIType.Hall_GetBattleOrder] = "/api/Hall/GetBattleOrder";
@@ -163,7 +163,7 @@ namespace Assets.MyGame.Scripts.Net.APIRequest.Params
[Serializable] [Serializable]
public class DistributeRewardsParam : RequestParamBase public class DistributeRewardsParam : RequestParamBase
{ {
public int rewardId; // 奖励ID public string id; // 奖励/任务 ID
} }
+3
View File
@@ -108,6 +108,9 @@ namespace Assets.MyGame.Scripts.Net
/// <summary>发放奖励(GET)</summary> /// <summary>发放奖励(GET)</summary>
Hall_DistributeRewards, Hall_DistributeRewards,
/// <summary>一键领取所有任务奖励(GET)</summary>
Hall_ReceiveAllTaskRewards,
/// <summary>获取用户战令信息(GET)</summary> /// <summary>获取用户战令信息(GET)</summary>
Hall_GetBattleOrder, Hall_GetBattleOrder,
@@ -1,4 +1,4 @@
using Assets.MyGame.Scripts.Net.WebResponses.ChineseChess; using Assets.MyGame.Scripts.Net.WebResponses.ChineseChess;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using TMPro; using TMPro;
@@ -59,7 +59,13 @@ public class UIChineseChessCreateRoom : SubUIBase
btn_CreateRoom.onClick.AddListener(() => btn_CreateRoom.onClick.AddListener(() =>
{ {
if (tMPInput_Password.text.Length==6) if (tMPInput_Password.text.Length != 6)
{
UIManager.Instance.ShowBoardError("密码格式不正确");
return;
}
UIManager.Instance.ShowTiShi($"确定要创建房间吗?\n阵营:{(gameType == 2 ? "红方" : "黑方")}", () =>
{ {
WebSocketSendList.CreateRoomChineseChess(new Assets.MyGame.Scripts.Net.WebResponses.ChineseChess.ChineseChessGameClassList.CreateRoomParam WebSocketSendList.CreateRoomChineseChess(new Assets.MyGame.Scripts.Net.WebResponses.ChineseChess.ChineseChessGameClassList.CreateRoomParam
{ {
@@ -69,12 +75,7 @@ public class UIChineseChessCreateRoom : SubUIBase
roomId = v.roomId, roomId = v.roomId,
userId = GameManager.Instance.user.BaseInfo.number userId = GameManager.Instance.user.BaseInfo.number
}); });
} });
else
{
UIManager.Instance.ShowBoardError("密码格式不正确");
}
}); });
} }
@@ -1,27 +1,57 @@
using System.Collections; using Assets.MyGame.Scripts.Net;
using System.Collections.Generic; using Assets.MyGame.Scripts.Net.APIRequest.Params;
using System;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
public class RenWuItem : MonoBehaviour public class RenWuItem : MonoBehaviour
{ {
public TextMeshProUGUI tmp_ExpCount;//<color=green>20</color> /20 public TextMeshProUGUI tmp_ExpCount;
public TextMeshProUGUI tmp_ExpJinDu;//<color=green>20</color> /20 public TextMeshProUGUI tmp_ExpJinDu;
public TextMeshProUGUI tmp_RenWoLabel; public TextMeshProUGUI tmp_RenWoLabel;
public Slider jinDu; public Slider jinDu;
public Button lingQu; public Button lingQu; // 领取
public Button qianWang; public Button qianWang; // 前往
public void Init(int expCount, int currJinDu,int maxJinDu, string renWoLabel,float jinDuValue,UIPanel uIPanel,SubUIManager subUIManager)
public void Init(int expCount, int currJinDu, int maxJinDu, string renWoLabel,
float jinDuValue, string taskId, bool isFinish, bool isGet,
UIPanel uIPanel, SubUIManager subUIManager, Action onClaimed = null)
{ {
tmp_ExpJinDu.text = $"<color=green>{expCount}</color> /{maxJinDu}"; tmp_ExpJinDu.text = $"<color=green>{expCount}</color> /{maxJinDu}";
tmp_ExpCount.text = expCount.ToString(); tmp_ExpCount.text = expCount.ToString();
tmp_RenWoLabel.text = renWoLabel; tmp_RenWoLabel.text = renWoLabel;
jinDu.value = jinDuValue; jinDu.value = jinDuValue;
// 前往按钮 → 跳转页面
qianWang.onClick.RemoveAllListeners();
qianWang.onClick.AddListener(() => subUIManager.ShowAsync(uIPanel));
// 领取按钮 → 调 API 领取
lingQu.onClick.RemoveAllListeners(); lingQu.onClick.RemoveAllListeners();
lingQu.onClick.AddListener(() => lingQu.onClick.AddListener(() =>
{ {
subUIManager.ShowAsync(uIPanel); APIRequestList.DistributeRewards(new DistributeRewardsParam { id = taskId }, res =>
{
onClaimed?.Invoke();
});
}); });
// 按钮显隐:未完成→前往,已完成未领→领取,已领→都不显示
if (isGet)
{
lingQu.gameObject.SetActive(false);
qianWang.gameObject.SetActive(false);
}
else if (isFinish)
{
lingQu.gameObject.SetActive(true);
qianWang.gameObject.SetActive(false);
}
else
{
lingQu.gameObject.SetActive(false);
qianWang.gameObject.SetActive(true);
}
} }
} }
@@ -233,17 +233,20 @@ public class ZhanLing_Panel : SubUIBase
{ {
int curr = (int)t.count; int curr = (int)t.count;
float progress = t.taskCount > 0 ? (float)t.count / t.taskCount : 0f; float progress = t.taskCount > 0 ? (float)t.count / t.taskCount : 0f;
CreateTaskItem(t.exp, curr, t.taskCount, t.remark, progress, UIPanel.None); CreateTaskItem(t.exp, curr, t.taskCount, t.remark, progress,
t.id, t.isFinish, t.isGet, UIPanel.None);
} }
}); });
} }
private void CreateTaskItem(int expCount, int currJinDu, int maxJinDu, string label, float progress, UIPanel targetPanel) private void CreateTaskItem(int expCount, int currJinDu, int maxJinDu, string label,
float progress, string taskId, bool isFinish, bool isGet, UIPanel targetPanel)
{ {
var item = Instantiate(renWuItemPrefab, renWuItemParent); var item = Instantiate(renWuItemPrefab, renWuItemParent);
item.gameObject.SetActive(true); item.gameObject.SetActive(true);
item.Init(expCount, currJinDu, maxJinDu, label, progress, targetPanel, uIManager); item.Init(expCount, currJinDu, maxJinDu, label, progress,
taskId, isFinish, isGet, targetPanel, uIManager, RefreshAll);
} }
// ==================== 购买等级页面 ==================== // ==================== 购买等级页面 ====================
File diff suppressed because one or more lines are too long