diff --git a/Assets/AddressableAssetsData/AssetGroups/HomeUIRes.asset b/Assets/AddressableAssetsData/AssetGroups/HomeUIRes.asset index 7d32e432a..6030769d6 100644 --- a/Assets/AddressableAssetsData/AssetGroups/HomeUIRes.asset +++ b/Assets/AddressableAssetsData/AssetGroups/HomeUIRes.asset @@ -71,6 +71,12 @@ MonoBehaviour: m_SerializedLabels: - MainUI FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 8db6a4b5bc6399b47a4290a85773078c + m_Address: Assets/MyGame/aa/UI/Home/Sub/UISignView.prefab + m_ReadOnly: 0 + m_SerializedLabels: + - MainUI + FlaggedDuringContentUpdateRestriction: 0 - m_GUID: 9351da778e1c18c4f9243b73d7569c66 m_Address: Assets/MyGame/aa/UI/Home/Sub/MYSelectSit.prefab m_ReadOnly: 0 diff --git a/Assets/Framework/Tool/UITool/UIManager.cs b/Assets/Framework/Tool/UITool/UIManager.cs index 772a8f513..56349d222 100644 --- a/Assets/Framework/Tool/UITool/UIManager.cs +++ b/Assets/Framework/Tool/UITool/UIManager.cs @@ -42,6 +42,7 @@ public enum UIPanel JJJPenel = 152, ActivityPenel = 153, JiGuHuiLi=154, + QianDaoPanel = 155, MonthCardPanel = 161, BackPackPanel = 162, @@ -58,6 +59,7 @@ public enum UIPanel SettingPanel = 199, #endregion + #region 200-299 Game界面 diff --git a/Assets/MyGame/Scenes/UIScene.unity b/Assets/MyGame/Scenes/UIScene.unity index bffc618bb..e2645ff80 100644 --- a/Assets/MyGame/Scenes/UIScene.unity +++ b/Assets/MyGame/Scenes/UIScene.unity @@ -1029,7 +1029,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 22400762, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchoredPosition.y - value: -0.0000076293945 + value: -0.000011444092 objectReference: {fileID: 0} - target: {fileID: 22426080, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3} propertyPath: m_AnchorMax.x diff --git a/Assets/MyGame/Scripts/Net/APIManager.cs b/Assets/MyGame/Scripts/Net/APIManager.cs index 8a44d0dc7..bf3261be5 100644 --- a/Assets/MyGame/Scripts/Net/APIManager.cs +++ b/Assets/MyGame/Scripts/Net/APIManager.cs @@ -243,6 +243,7 @@ namespace Assets.MyGame.Scripts.Net if (req.result == UnityWebRequest.Result.Success) { var json = req.downloadHandler.text; + Debug.Log("url----" + url + "--" + "Json-" + json ); var res = JsonConvert.DeserializeObject>(json); #if UNITY_EDITOR Debug.Log("url----" + url + "--" + "Json-" + json + "res--" + JsonConvert.SerializeObject(res)); diff --git a/Assets/MyGame/Scripts/Turret/SitPosData.cs b/Assets/MyGame/Scripts/Turret/SitPosData.cs index 6d1031c1b..6c0f95086 100644 --- a/Assets/MyGame/Scripts/Turret/SitPosData.cs +++ b/Assets/MyGame/Scripts/Turret/SitPosData.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using TMPro; @@ -208,6 +209,11 @@ public class SitPosData : MonoBehaviour, IPointerDownHandler, IPointerUpHandler if (toggle_AutoAttack != null) toggle_AutoAttack.onValueChanged.AddListener(OnAutoAttackToggleChanged); + // ⭐ 炮倍选择面板:按钮开/关;Awake 记录面板原始高度(动画还原目标值,之后会被压到 0) + if (btn_SelectPaoBei != null) + btn_SelectPaoBei.onClick.AddListener(OnClickSelectPaoBei); + EnsurePaoBeiPanelHeight(); + // ⭐ 散射起点球父对象兜底:预制体没拖引用就自动创建(挂 beij 下,炮台两侧), // 保证 UpdateJGFXParentsActive 永远有对象可激活,不依赖 Inspector 配置。 // XJMH(星际迷航)没有战神/激光概念,跳过不给它加节点。 @@ -1358,6 +1364,154 @@ public class SitPosData : MonoBehaviour, IPointerDownHandler, IPointerUpHandler WebSocketSendList.ChangeGunMultiple(roomId, user, newConsume); } + // ==================== 炮倍选择面板 ==================== + + private Coroutine _paoBeiPanelAnim; + /// 炮倍面板展开时的原始高度(Awake 记录,动画在 0 ↔ 该值之间滑动) + private float _paoBeiPanelOpenHeight = -1f; + + /// 记录炮倍面板的原始高度(Awake 时面板还没被动画改过,rect.height 即还原态高度) + private void EnsurePaoBeiPanelHeight() + { + if (_paoBeiPanelOpenHeight >= 0f || selectPaoBeiPanel == null) return; + var rt = selectPaoBeiPanel.GetComponent(); + if (rt == null) return; + + _paoBeiPanelOpenHeight = rt.rect.height; + if (_paoBeiPanelOpenHeight <= 0f) + Debug.LogWarning("[SitPosData] 炮倍面板初始高度为 0,无法记录展开高度,检查 selectPaoBeiPanel 的 RectTransform 配置"); + } + + /// + /// 点击炮倍按钮:开关选择面板。 + /// ⭐ 只有本地玩家座位可以打开(远程/bot 座位点了没反应,不能替别人换炮倍)。 + /// + private void OnClickSelectPaoBei() + { + if (this != localPlayerSit) return; + if (selectPaoBeiPanel == null) return; + + bool opening = !selectPaoBeiPanel.activeSelf; + if (opening) RefreshPaoBeiItems(); + SetPaoBeiPanelOpen(opening); + } + + /// + /// 开/关炮倍面板:height 在 0 ↔ 原始高度之间动画 0.5s。 + /// ⭐ 不改面板 pivot/anchoredPosition,滑动方向完全由预制体里配好的 RectTransform 决定。 + /// + private void SetPaoBeiPanelOpen(bool open) + { + var rt = selectPaoBeiPanel.GetComponent(); + if (rt == null) + { + selectPaoBeiPanel.SetActive(open); + return; + } + + if (_paoBeiPanelAnim != null) + { + StopCoroutine(_paoBeiPanelAnim); + _paoBeiPanelAnim = null; + } + + if (open) + { + selectPaoBeiPanel.SetActive(true); + _paoBeiPanelAnim = StartCoroutine(AnimPaoBeiHeight(rt, rt.rect.height, _paoBeiPanelOpenHeight)); + } + else + { + _paoBeiPanelAnim = StartCoroutine(AnimPaoBeiHeight(rt, rt.rect.height, 0f, + () => selectPaoBeiPanel.SetActive(false))); + } + } + + /// height 动画(0.5s);动画结束回调在收起时用于隐藏面板 + private IEnumerator AnimPaoBeiHeight(RectTransform rt, float from, float to, Action onComplete = null) + { + const float duration = 0.1f; + float t = 0f; + while (t < duration) + { + t += Time.deltaTime; + rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, Mathf.Lerp(from, to, Mathf.Clamp01(t / duration))); + yield return null; + } + rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, to); + onComplete?.Invoke(); + _paoBeiPanelAnim = null; + } + + /// + /// 按配置 paoBeiList 生成炮倍档位 item: + /// child0 的 TextMeshProUGUI 显示炮倍值;背景按值上色(<5000 蓝 / 5000~10000 紫 / >=10000 红),当前档位黄色。 + /// 点击 item:换到该档位(走 ChangeGunMultiple 服务端确认协议)并直接关闭面板。 + /// + private void RefreshPaoBeiItems() + { + if (paobeiItemPrefab == null || paobeiItemParent == null) return; + var list = CreateFishManager.Instance?.currGameType?.paoBeiList; + if (list == null || list.Count == 0) + { + Debug.LogWarning("[SitPosData] paoBeiList 为空,炮倍面板没有可选项"); + return; + } + + for (int i = paobeiItemParent.childCount - 1; i >= 0; i--) + Destroy(paobeiItemParent.GetChild(i).gameObject); + + for (int i = 0; i < list.Count; i++) + { + int index = i; + GameObject item = Instantiate(paobeiItemPrefab, paobeiItemParent, false); + item.SetActive(true); + + var tmp = item.transform.childCount > 0 ? item.transform.GetChild(0).GetComponent() : null; + if (tmp != null) + tmp.text = list[i].ToString(); + + var img = item.GetComponent(); + if (img != null) + img.sprite = index == indexConsume ? yellowBG : GetPaoBeiSprite(list[i]); + + var btn = item.GetComponent