修了很多bug和增加功能,优化不少问题

This commit is contained in:
FloatGaming
2026-02-28 06:59:22 +08:00
parent 508a40bba0
commit e11cc1da7a
345 changed files with 173803 additions and 69332 deletions
+54 -1
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -44,6 +44,12 @@ public class controllerSettings : MonoBehaviour
private const float ContinuousRepeatRate = 0.05f;
private const float StepAmount = 0.01f;
[Header("call dt prefab")]
public GameObject delayTapper_prefab;
public GameObject dt_to_put;
public Button launch_delayTapper;
public Text currentDelayText;
void Start()
{
// initialize button labels from KeyBindingManager
@@ -106,6 +112,53 @@ public class controllerSettings : MonoBehaviour
noteSpeed_ResetButton.onClick.RemoveAllListeners();
noteSpeed_ResetButton.onClick.AddListener(() => ResetNoteSpeed());
}
// Initialize delay tapper button and display
if (launch_delayTapper != null)
{
launch_delayTapper.onClick.RemoveAllListeners();
launch_delayTapper.onClick.AddListener(OnLaunchDelayTapperClicked);
}
RefreshDelayText();
}
public void RefreshDelayText()
{
if (currentDelayText != null)
{
const string DELAY_PREFS_KEY = "UserGlobalDelaySeconds";
if (PlayerPrefs.HasKey(DELAY_PREFS_KEY))
{
float savedDelaySeconds = PlayerPrefs.GetFloat(DELAY_PREFS_KEY, 0f);
int ms = Mathf.RoundToInt(savedDelaySeconds * 1000f);
currentDelayText.text = $"当前偏移:{(ms >= 0 ? "+" : "")}{ms}ms";
}
else
{
currentDelayText.text = "未设定偏移数值";
}
}
}
public void OnLaunchDelayTapperClicked()
{
if (delayTapper_prefab != null && dt_to_put != null)
{
GameObject instantiated = Instantiate(delayTapper_prefab, dt_to_put.transform);
Debug.Log($"[controllerSettings] Instantiated delay tapper prefab under {dt_to_put.name}");
// 获取 dtp 脚本并传递当前 settings 引用,以便保存时刷新 UI
delayTapperPrefab dtp = instantiated.GetComponent<delayTapperPrefab>();
if (dtp != null)
{
dtp.mainSettings = this;
}
}
else
{
Debug.LogWarning("[controllerSettings] Prefab or target container is missing!");
}
}
void OnDestroy()