1
This commit is contained in:
+129
-1277
File diff suppressed because it is too large
Load Diff
@@ -68,6 +68,7 @@ namespace Assets.MyGame.Scripts.Net
|
||||
dic_API[APIType.Hall_GetMonthCardGift] = "/api/Hall/GetMonthCardGift";
|
||||
dic_API[APIType.Hall_GetUserTaskList] = "/api/Hall/GetUserTaskList";
|
||||
dic_API[APIType.Hall_DistributeRewards] = "/api/Hall/DistributeRewards";
|
||||
dic_API[APIType.Hall_ReceiveAllTaskRewards] = "/api/Hall/ReceiveAllTaskRewards";
|
||||
|
||||
// ---------------- BattleOrder ----------------
|
||||
dic_API[APIType.Hall_GetBattleOrder] = "/api/Hall/GetBattleOrder";
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Assets.MyGame.Scripts.Net.APIRequest.Params
|
||||
[Serializable]
|
||||
public class DistributeRewardsParam : RequestParamBase
|
||||
{
|
||||
public int rewardId; // 奖励ID
|
||||
public string id; // 奖励/任务 ID
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,9 @@ namespace Assets.MyGame.Scripts.Net
|
||||
/// <summary>发放奖励(GET)</summary>
|
||||
Hall_DistributeRewards,
|
||||
|
||||
/// <summary>一键领取所有任务奖励(GET)</summary>
|
||||
Hall_ReceiveAllTaskRewards,
|
||||
|
||||
/// <summary>获取用户战令信息(GET)</summary>
|
||||
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.Generic;
|
||||
using TMPro;
|
||||
@@ -59,7 +59,13 @@ public class UIChineseChessCreateRoom : SubUIBase
|
||||
|
||||
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
|
||||
{
|
||||
@@ -69,12 +75,7 @@ public class UIChineseChessCreateRoom : SubUIBase
|
||||
roomId = v.roomId,
|
||||
userId = GameManager.Instance.user.BaseInfo.number
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Instance.ShowBoardError("密码格式不正确");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net.APIRequest.Params;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RenWuItem : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI tmp_ExpCount;//<color=green>20</color> /20
|
||||
public TextMeshProUGUI tmp_ExpJinDu;//<color=green>20</color> /20
|
||||
public TextMeshProUGUI tmp_ExpCount;
|
||||
public TextMeshProUGUI tmp_ExpJinDu;
|
||||
public TextMeshProUGUI tmp_RenWoLabel;
|
||||
public Slider jinDu;
|
||||
public Button lingQu;
|
||||
public Button qianWang;
|
||||
public void Init(int expCount, int currJinDu,int maxJinDu, string renWoLabel,float jinDuValue,UIPanel uIPanel,SubUIManager subUIManager)
|
||||
public Button lingQu; // 领取
|
||||
public Button qianWang; // 前往
|
||||
|
||||
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_ExpCount.text = expCount.ToString();
|
||||
tmp_RenWoLabel.text = renWoLabel;
|
||||
jinDu.value = jinDuValue;
|
||||
|
||||
// 前往按钮 → 跳转页面
|
||||
qianWang.onClick.RemoveAllListeners();
|
||||
qianWang.onClick.AddListener(() => subUIManager.ShowAsync(uIPanel));
|
||||
|
||||
// 领取按钮 → 调 API 领取
|
||||
lingQu.onClick.RemoveAllListeners();
|
||||
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;
|
||||
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);
|
||||
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
Reference in New Issue
Block a user