1
This commit is contained in:
@@ -770,7 +770,8 @@ public class UIHome_BY_ItemListPanels : SubUIBase
|
||||
return;
|
||||
}
|
||||
|
||||
APIRequestList.ChangeGodWar(new ChangeGodWarParam { number = "0" }, res =>
|
||||
// ⭐ 卸下接口需要传当前装备的战神编号(不是"0")
|
||||
APIRequestList.UnloadGodWar(new UnloadGodWarParam { number = equipped.number }, res =>
|
||||
{
|
||||
Debug.Log("[UIHome_BY_ItemListPanels] 卸下战神成功");
|
||||
|
||||
@@ -803,8 +804,8 @@ public class UIHome_BY_ItemListPanels : SubUIBase
|
||||
// ==================== 翅膀卸下按钮 ====================
|
||||
|
||||
/// <summary>
|
||||
/// 卸下翅膀按钮:卸下当前装备的翅膀(ChangeWing number="0",与战神卸下同一约定)。
|
||||
/// 成功后刷新用户数据;游戏内打开时同步清本地座位翅膀并广播给其他客户端(turretIndex=0=卸下)。
|
||||
/// 卸下翅膀按钮:卸下当前装备的翅膀(GET /api/Hall/UnloadWing?number=当前装备编号)。
|
||||
/// 成功后 GetUser 刷新用户数据;游戏内打开时同步清本地座位翅膀并广播给其他客户端(帧同步 turretIndex=0=卸下)。
|
||||
/// </summary>
|
||||
private void OnClickXieXia_Wing()
|
||||
{
|
||||
@@ -815,7 +816,8 @@ public class UIHome_BY_ItemListPanels : SubUIBase
|
||||
return;
|
||||
}
|
||||
|
||||
APIRequestList.ChangeWing(new ChangeWingParam { number = "0" }, res =>
|
||||
// ⭐ 卸下接口需要传当前装备的翅膀编号(不是"0")
|
||||
APIRequestList.UnloadWing(new UnloadWingParam { number = equipped.number }, res =>
|
||||
{
|
||||
Debug.Log("[UIHome_BY_ItemListPanels] 卸下翅膀成功");
|
||||
|
||||
|
||||
@@ -11,16 +11,10 @@ using UnityEngine.UI;
|
||||
public class UIHome_BY_UISignViewPanel : SubUIBase
|
||||
{
|
||||
//text_CoinNums是转盘各个位置的详细值 他从GameManager的activityConfig里面读取signConfigs后端配置的个数和text_CoinNums的个数是对应的 这里赋值的时候需要加上其他的数据公式是 值+值*GameManager的gameConfig的vip的signInAdd签到加成
|
||||
/* /// <summary>
|
||||
/// 签到(GET)
|
||||
/// 参数:用户ID
|
||||
/// 返回:SignInfo(签到结果)
|
||||
/// </summary>
|
||||
public static void SignIn(Action<SignInfo> callback)
|
||||
{
|
||||
APIManager.Response<SignInfo>(APIType.Hall_SignIn, callback);
|
||||
}
|
||||
*///这个是签到的api封装的方法SLZPDieEvent这个脚本有之前写好的多层转盘的逻辑 签到这里只有单层 你可以直接看一下里面正确的
|
||||
/*签到API已封装在APIRequestList.SignIn(GET)
|
||||
实测后端返回 {"data":440,"code":0,"info":null}——data直接是本次奖励的金币数字(不是SignInfo对象)
|
||||
转盘停靠位置用奖励金额反查signConfigs得到(见FindSlotByReward)*/
|
||||
//SLZPDieEvent这个脚本有之前写好的多层转盘的逻辑 签到这里只有单层 你可以直接看一下里面正确的
|
||||
public List<Text> text_CoinNums;
|
||||
public Button btn_ChouJiang;
|
||||
public GameObject zhuanPan;
|
||||
@@ -111,27 +105,55 @@ public class UIHome_BY_UISignViewPanel : SubUIBase
|
||||
if (isSpinning) return;
|
||||
btn_ChouJiang.interactable = false;
|
||||
|
||||
APIRequestList.SignIn(res =>
|
||||
// 后端SignIn的data直接返回本次奖励的金币数(数字)
|
||||
APIRequestList.SignIn(reward =>
|
||||
{
|
||||
// day是第几天签到(1开始),对应转盘格子 = day-1
|
||||
int count = text_CoinNums.Count > 0 ? text_CoinNums.Count : 1;
|
||||
int slot = res.day > 0 ? (res.day - 1) % count : 0;
|
||||
RotateToSlot(slot, () =>
|
||||
int slot = FindSlotByReward(reward);
|
||||
if (slot < 0)
|
||||
{
|
||||
string msg = "签到成功";
|
||||
if (res.rewardGold > 0) msg += $",获得{FormatGold(res.rewardGold)}金币";
|
||||
if (res.rewardDiamond > 0) msg += $",{FormatGold(res.rewardDiamond)}钻石";
|
||||
UIManager.Instance.ShowBoardError(msg);
|
||||
|
||||
APIRequestList.GetUser(user =>
|
||||
{
|
||||
GameManager.Instance.UpdataUserData(user);
|
||||
UpdateBtnState();
|
||||
});
|
||||
});
|
||||
// 奖励金额匹配不到任何格子:不转转盘直接提示,避免停错位置
|
||||
Debug.LogWarning($"[签到] 奖励{reward}在signConfigs里匹配不到对应格子");
|
||||
OnSignInDone(reward);
|
||||
return;
|
||||
}
|
||||
Debug.Log($"[签到] 奖励{reward} → 转盘格子{slot}");
|
||||
RotateToSlot(slot, () => OnSignInDone(reward));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>签到完成:提示奖励并刷新用户数据</summary>
|
||||
private void OnSignInDone(long reward)
|
||||
{
|
||||
UIManager.Instance.ShowBoardError($"签到成功,获得{FormatGold(reward)}金币");
|
||||
|
||||
APIRequestList.GetUser(user =>
|
||||
{
|
||||
GameManager.Instance.UpdataUserData(user);
|
||||
UpdateBtnState();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>按奖励金额反查转盘格子:优先匹配加了VIP加成后的值,其次匹配原始配置值;匹配不到返回-1</summary>
|
||||
private int FindSlotByReward(long reward)
|
||||
{
|
||||
if (order_singConfig == null || order_singConfig.Count == 0 || text_CoinNums == null || text_CoinNums.Count == 0) return -1;
|
||||
|
||||
var list = new List<SignConfig>(order_singConfig.Values);
|
||||
list.Sort((a, b) => a.order - b.order);
|
||||
|
||||
double add = GetSignInAdd();
|
||||
int count = Mathf.Min(list.Count, text_CoinNums.Count);
|
||||
int fallback = -1;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
long gold = list[i].gold;
|
||||
long withAdd = gold + (long)Math.Round(gold * add);
|
||||
if (withAdd == reward) return i;
|
||||
if (fallback < 0 && gold == reward) fallback = i;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/// <summary>单层转盘旋转停靠(参照SLZPDieEvent:LocalAxisAdd增量旋转+OutCubic缓动+完成强制校正)</summary>
|
||||
private void RotateToSlot(int slot, Action onComplete)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,11 @@ PrefabInstance:
|
||||
|
||||
'
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114941304181978548, guid: 2e30023d05e54a540a373fe965310b32,
|
||||
type: 3}
|
||||
propertyPath: m_Text
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 199041320612064254, guid: 2e30023d05e54a540a373fe965310b32,
|
||||
type: 3}
|
||||
propertyPath: m_SortingLayer
|
||||
@@ -433,6 +438,9 @@ MonoBehaviour:
|
||||
- {fileID: 1005172503326857829}
|
||||
btn_ChouJiang: {fileID: 1008166634067188910}
|
||||
zhuanPan: {fileID: 894100053140691675}
|
||||
spinRounds: 5
|
||||
rotateDuration: 2
|
||||
dir: -1
|
||||
--- !u!114 &1005167189539589558 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 114998874197659892, guid: 2e30023d05e54a540a373fe965310b32,
|
||||
|
||||
Reference in New Issue
Block a user