This commit is contained in:
2026-09-01 23:20:52 +08:00
parent 40e6bf26bc
commit 013784e122
7 changed files with 67 additions and 6 deletions
@@ -1870,4 +1870,4 @@ MonoBehaviour:
type: 3}
selfOffsetJGStart: {x: 0, y: 0}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -150, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
@@ -635,4 +635,4 @@ MonoBehaviour:
type: 3}
selfOffsetJGStart: {x: 0, y: 0}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -150, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
@@ -1179,4 +1179,4 @@ MonoBehaviour:
type: 3}
selfOffsetJGStart: {x: 0, y: 0}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -150, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
@@ -1554,7 +1554,7 @@ MonoBehaviour:
type: 3}
selfOffsetJGStart: {x: 0, y: 0}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -150, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
--- !u!95 &8661363738911940257 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 8284544360685858346, guid: ffe5b917cd8f21941adf54c437e9a701,
@@ -3789,7 +3789,7 @@ MonoBehaviour:
type: 3}
selfOffsetJGStart: {x: 0, y: 0}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -150, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
--- !u!95 &3827418405087986554 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 2725459927999047066, guid: 83f830ab856bfc642b235330651c6513,
@@ -965,4 +965,4 @@ MonoBehaviour:
type: 3}
selfOffsetJGStart: {x: 0, y: 0}
buttomOffsetZSRotateInit: {x: 0, y: 0, z: 0}
topOffsetZSRotateInit: {x: -150, y: 0, z: 0}
topOffsetZSRotateInit: {x: -125, y: 0, z: 0}
@@ -69,6 +69,8 @@ public class UIHome_BY_ItemListPanels : SubUIBase
public TextMeshProUGUI tmp_ZHanShenName;
public TextMeshProUGUI tmp_ZHanShenLabel;
public Button btn_XuanZe;
[Tooltip("卸下战神按钮:只在战神 Tab 且当前有装备战神时显示")]
public Button btn_XieXia;
[Header("面板")]
public GameObject obj_TurretWingPanel;
public GameObject obj_ZhanShenPanel;
@@ -128,6 +130,9 @@ public class UIHome_BY_ItemListPanels : SubUIBase
if (btn_XuanZe != null)
btn_XuanZe.onClick.AddListener(OnClickXuanZe);
if (btn_XieXia != null)
btn_XieXia.onClick.AddListener(OnClickXieXia);
if (tMP_Type != null)
tMP_Type.onValueChanged.AddListener(OnDropdownChanged);
@@ -186,10 +191,17 @@ public class UIHome_BY_ItemListPanels : SubUIBase
// 默认选中已装备的战神编号
var equipped = GetUserEquipped();
_selectedZhanShenNumber = (equipped != null && int.TryParse(equipped.number, out int n)) ? n : -1;
// ⭐ 卸下按钮:战神 Tab 且当前有装备战神才显示(显隐随选中详情 RefreshZhanShenDetail 刷新)
if (btn_XieXia != null)
btn_XieXia.gameObject.SetActive(equipped != null);
RebuildZhanShenTypeList();
return;
}
// ⭐ 非战神 Tab:卸下按钮一律隐藏
if (btn_XieXia != null)
btn_XieXia.gameObject.SetActive(false);
// 切换到炮台/翅膀时,默认选中已装备的编号;无装备则清空,列表会自动选第一个
if (itemPanel == ItemPanelSelect.Turrect || itemPanel == ItemPanelSelect.Wing)
{
@@ -696,6 +708,10 @@ public class UIHome_BY_ItemListPanels : SubUIBase
if (btn_XuanZe != null)
btn_XuanZe.interactable = isOwned;
// ---- 卸下按钮:当前有装备战神才显示(与选中的是哪个无关)----
if (btn_XieXia != null)
btn_XieXia.gameObject.SetActive(GetUserEquipped() != null);
// ---- 缩略图(和翅膀一样显示 RawImage)----
if (rawImg_DetailPreview != null)
rawImg_DetailPreview.gameObject.SetActive(true);
@@ -730,6 +746,51 @@ public class UIHome_BY_ItemListPanels : SubUIBase
}
}
// ==================== 战神卸下按钮 ====================
/// <summary>
/// 卸下按钮:卸下当前装备的战神(number="0",与帧同步 changeZhanShen 的 turretIndex<=0=卸下 同一约定)。
/// 成功后刷新用户数据;游戏内打开时同步清本地座位战神并广播给其他客户端。
/// </summary>
private void OnClickXieXia()
{
var equipped = GetUserEquipped();
if (equipped == null)
{
Debug.Log("[UIHome_BY_ItemListPanels] 当前没有装备战神,无需卸下");
return;
}
APIRequestList.ChangeGodWar(new ChangeGodWarParam { number = "0" }, res =>
{
Debug.Log("[UIHome_BY_ItemListPanels] 卸下战神成功");
var userId = GameManager.Instance?.user?.id;
if (string.IsNullOrEmpty(userId))
{
if (btn_XieXia != null) btn_XieXia.gameObject.SetActive(false);
return;
}
APIRequestList.GetUser(userId, userRes =>
{
GameManager.Instance.UpdataUserData(userRes);
// 选中编号清掉(已无装备,列表重新定位到第一个)
_selectedZhanShenNumber = -1;
// 从游戏内打开:清本地座位战神 + 广播给其他客户端(turretIndex=0=卸下)
if (_isInGame)
{
SitPosData.localPlayerSit?.ClearZhanShen();
CreateFishManager.Instance?.currGameType?.SyncChangeZhanShen(0);
}
RebuildZhanShenTypeList();
});
});
}
// ==================== GameManager 用户数据关联 ====================
/// <summary>检查玩家是否拥有指定炮台/翅膀/战神。</summary>