更新一些冲突内容

This commit is contained in:
2025-09-02 01:12:08 +08:00
parent 5365ab6441
commit f9f80aa559
6 changed files with 122 additions and 22 deletions

View File

@@ -412,18 +412,18 @@ namespace Convention
BandNegativeCheck();
}
void Update()
{
float[] spectrum = new float[256];
AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular);
for (int i = 1; i < spectrum.Length - 1; i++)
{
Debug.DrawLine(new Vector3(i - 1, spectrum[i] + 10, 0), new Vector3(i, spectrum[i + 1] + 10, 0), Color.red);
Debug.DrawLine(new Vector3(i - 1, Mathf.Log(spectrum[i - 1]) + 10, 2), new Vector3(i, Mathf.Log(spectrum[i]) + 10, 2), Color.cyan);
Debug.DrawLine(new Vector3(Mathf.Log(i - 1), spectrum[i - 1] - 10, 1), new Vector3(Mathf.Log(i), spectrum[i] - 10, 1), Color.green);
Debug.DrawLine(new Vector3(Mathf.Log(i - 1), Mathf.Log(spectrum[i - 1]), 3), new Vector3(Mathf.Log(i), Mathf.Log(spectrum[i]), 3), Color.blue);
}
}
//void Update()
//{
// float[] spectrum = new float[256];
// AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular);
// for (int i = 1; i < spectrum.Length - 1; i++)
// {
// Debug.DrawLine(new Vector3(i - 1, spectrum[i] + 10, 0), new Vector3(i, spectrum[i + 1] + 10, 0), Color.red);
// Debug.DrawLine(new Vector3(i - 1, Mathf.Log(spectrum[i - 1]) + 10, 2), new Vector3(i, Mathf.Log(spectrum[i]) + 10, 2), Color.cyan);
// Debug.DrawLine(new Vector3(Mathf.Log(i - 1), spectrum[i - 1] - 10, 1), new Vector3(Mathf.Log(i), spectrum[i] - 10, 1), Color.green);
// Debug.DrawLine(new Vector3(Mathf.Log(i - 1), Mathf.Log(spectrum[i - 1]), 3), new Vector3(Mathf.Log(i), Mathf.Log(spectrum[i]), 3), Color.blue);
// }
//}
}
}

View File

@@ -37,19 +37,35 @@ namespace Convention
private void Update()
{
Vector3 dxyz = Vector3.zero;
Vector3 rxyz = Vector3.zero;
//Vector3 rxyz = Vector3.zero;
if (Keyboard.current[Key.W].isPressed || Keyboard.current[Key.UpArrow].isPressed)
dxyz += TargetFollow.forward;
{
var temp = TargetFollow.forward;
//temp.y = 0;
dxyz += temp.normalized;
}
if (Keyboard.current[Key.A].isPressed || Keyboard.current[Key.LeftArrow].isPressed)
dxyz += -TargetFollow.right;
{
var temp = TargetFollow.right;
temp.y = 0;
dxyz -= temp.normalized;
}
if (Keyboard.current[Key.D].isPressed || Keyboard.current[Key.RightArrow].isPressed)
dxyz += TargetFollow.right;
{
var temp = TargetFollow.right;
temp.y = 0;
dxyz += temp.normalized;
}
if (Keyboard.current[Key.S].isPressed || Keyboard.current[Key.DownArrow].isPressed)
dxyz += -TargetFollow.forward;
{
var temp = TargetFollow.forward;
//temp.y = 0;
dxyz -= temp.normalized;
}
if (Keyboard.current[Key.Space].isPressed)
dxyz += TargetFollow.up;
dxyz += Vector3.up;
if (Keyboard.current[Key.LeftShift].isPressed)
dxyz += -TargetFollow.up;
dxyz -= Vector3.up;
var drotation = Vector3.zero;
if (isFocus)
@@ -60,13 +76,15 @@ namespace Convention
//
TargetFollow.Translate(dxyz * moveSpeed, Space.Self);
TargetFollow.Translate(dxyz * moveSpeed, Space.World);
TargetFollow.Rotate(drotation * rotationSpeed, Space.Self);
//
if (Keyboard.current[Key.Escape].isPressed)
isFocus = false;
if (Keyboard.current[Key.LeftCtrl].isPressed && Keyboard.current[Key.LeftShift].isPressed)
TargetFollow.localEulerAngles = new(0, TargetFollow.eulerAngles.y, 0);
}
}
}

View File

@@ -79,6 +79,13 @@ namespace Convention
}
public string GetName(bool is_ignore_extension = false)
{
if (OriginInfo != null)
{
if (OriginInfo is FileInfo finfo)
return is_ignore_extension ? Path.GetFileNameWithoutExtension(finfo.FullName) : finfo.Name;
else if (OriginInfo is DirectoryInfo dinfo)
return dinfo.Name;
}
var result = this.FullPath[..(
(this.FullPath.Contains('.') && is_ignore_extension)
? this.FullPath.LastIndexOf('.')
@@ -89,8 +96,8 @@ namespace Convention
? ^1
: ^0
)];
return result[(Mathf.Max(result.Contains('/') ? result.LastIndexOf('/') : -1,
result.Contains('\\') ? result.LastIndexOf('\\') : -1) + 1)..];
//result.LastIndexOf('\\') return -1 when '\\' was not been contained
return result[(Mathf.Max(result.LastIndexOf('/'), result.LastIndexOf('\\')) + 1)..];
}
public string GetExtension()
{