hold音符补丁 备份

This commit is contained in:
FloatGaming
2026-03-03 14:07:39 +08:00
parent b8704629a3
commit 9011fa022e
36 changed files with 2721 additions and 256 deletions
+60 -3
View File
@@ -1,10 +1,11 @@
using UnityEngine;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections.Generic;
using System.Collections;
using System.IO;
public class dlcButton : MonoBehaviour
public class dlcButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
[Header("Inspector")]
public Image dlc_profileImgae;
@@ -12,8 +13,10 @@ public class dlcButton : MonoBehaviour
public Text dlcID;
public Text dlcProducer;
public Text dlcPubliushDate;
public Text dlcSongsAmount;
public Image dlc_nowSelectedImageBoarder;
[Header("Inspector")]
public GameObject dlcDetailParent;
public Text dlcDescription;
[Header("Inspector")]
@@ -42,8 +45,57 @@ public class dlcButton : MonoBehaviour
private static int selectedIndex = -1;
private const string PlayerPrefsKey = "dlc_selected_index";
// instance index in registration order
private int instanceIndex = -1;
private Coroutine hoverCoroutine;
public void OnPointerEnter(PointerEventData eventData)
{
if (hoverCoroutine != null) StopCoroutine(hoverCoroutine);
hoverCoroutine = StartCoroutine(HandleHover());
}
public void OnPointerExit(PointerEventData eventData)
{
if (hoverCoroutine != null) StopCoroutine(hoverCoroutine);
if (dlcDetailParent != null) dlcDetailParent.SetActive(false);
}
private IEnumerator HandleHover()
{
yield return new WaitForSecondsRealtime(0.5f);
// 尝试从场景中查找 dlcDetailParent (如果自身引用的为空)
if (dlcDetailParent == null)
{
var details = GameObject.FindObjectsByType<dlcButton>(FindObjectsInactive.Include, FindObjectsSortMode.None);
foreach (var b in details)
{
if (b != this && b.dlcDetailParent != null)
{
dlcDetailParent = b.dlcDetailParent;
dlcDescription = b.dlcDescription;
break;
}
}
}
if (dlcDetailParent != null)
{
dlcDetailParent.SetActive(true);
// 更新简介信息
if (dlcDescription != null)
{
if (dlcDataSO != null)
{
dlcDescription.text = string.IsNullOrEmpty(dlcDataSO.dlcDescription) ? "暂无DLC简介信息。" : dlcDataSO.dlcDescription;
}
else
{
dlcDescription.text = "暂无DLC简介信息。";
}
}
}
}
void Awake()
{
@@ -374,6 +426,11 @@ public class dlcButton : MonoBehaviour
if (s != null) dlcContent.Add(s);
}
if (dlcSongsAmount != null)
{
dlcSongsAmount.text = dlcContent.Count.ToString();
}
if (dlcName != null) dlcName.text = so.dlcName ?? dlcName.text;
if (dlcProducer != null) dlcProducer.text = so.dlcProducer ?? dlcProducer.text;
if (dlcDescription != null) dlcDescription.text = so.dlcDescription ?? dlcDescription.text;