This commit is contained in:
2025-10-18 15:58:55 +08:00
parent 1c78e7328c
commit 3361e276e5
6 changed files with 104191 additions and 11209 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse;
@@ -597,9 +598,19 @@ namespace Ichni.Editor
}
public static void AdjustPathnodeZ(float OriginZpoint, float scale)
{
if (inspector.connectedGameElement == null || inspector.connectedGameElement.GetType() != typeof(Track))
if (inspector.connectedGameElement == null)
{
LogWindow.Log("Please select a Track first!");
LogWindow.Log($"please select a element (folder or track)", Color.red);
return;
}
if (inspector.connectedGameElement.GetType() != typeof(Track))
{
foreach (var i in inspector.connectedGameElement.childElementList.OfType<Track>())
{
inspector.connectedGameElement = i;
AdjustPathnodeZ(OriginZpoint, scale);
}
return;
}
Track track = (Track)inspector.connectedGameElement;
@@ -618,6 +629,11 @@ namespace Ichni.Editor
pathnode.transformSubmodule.Refresh();
pathnode.Refresh();
}
foreach (var i in track.childElementList.OfType<Track>())
{
inspector.connectedGameElement = i;
AdjustPathnodeZ(OriginZpoint, scale);
}
}
public static void FloorAnim()
{
@@ -728,7 +744,7 @@ namespace Ichni.Editor
NewTrack.Refresh();
Observable.Timer(TimeSpan.FromSeconds(0.3f)).Subscribe(_ =>
{
NewTrack?.trackPathSubmodule.path.Rebuild(true);
NewTrack?.trackPathSubmodule.path.RebuildImmediate(true, true);
DTMNoteVisualHold dTMNoteVisualHold = newHold.noteVisual as DTMNoteVisualHold;
dTMNoteVisualHold.meshGenerator.Rebuild();
});
@@ -748,12 +764,14 @@ namespace Ichni.Editor
LogWindow.Log("the Hold may not be split currently", Color.yellow);
return;
}
foreach (var hold in holds)
{
inspector.connectedGameElement = hold;
SplitHoldToTrack(PathnodesCount);
}
}
public static void Rebuild()
{
foreach (GameElement element in EditorManager.instance.beatmapContainer.gameElementList)
@@ -764,9 +782,12 @@ namespace Ichni.Editor
}
foreach (Track track in element.GetAllGameElementsFromThis().OfType<Track>())
{
track?.trackPathSubmodule.path.Rebuild(true);
track?.trackPathSubmodule.path.RebuildImmediate(true, true);
}
}
#if UNITY_EDITOR
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
#endif
}
}
}

View File

@@ -33,6 +33,8 @@ namespace Ichni.Editor
public RectTransform GetinputArea;
private string BeatText;
private string TimeText;
public void Update()
{
if (EditorManager.instance.musicPlayer.isPlaying) UpdateTime();
@@ -43,7 +45,14 @@ namespace Ichni.Editor
DetectSetRange();
DetectPointer();
}
if (BeatField.text != BeatText)
{
BeatField.text = BeatText;
}
if (TimeField.text != TimeText)
{
TimeField.text = TimeText;
}
}
@@ -154,8 +163,8 @@ namespace Ichni.Editor
}
private void UpdateTime()
{
TimeField.text = songTime.ToString("F2");
BeatField.text = songBeat.ToString("F2");
TimeText = songTime.ToString("F2");
BeatText = songBeat.ToString("F2");
}
private Tweener _activeTweener = null; // 保存当前动画的引用

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -178,7 +178,7 @@ MonoBehaviour:
_offset: {x: 0, y: 0, z: 0}
_normalMethod: 1
_calculateTangents: 1
_useSplineSize: 1
_useSplineSize: 0
_useSplineColor: 0
_rotation: 0
_flipFaces: 0
@@ -478,8 +478,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedBytes:
SerializedFormat: 0
SerializedBytes: 29010b00000065006c0065006d0065006e00740047007500690064000000000000000000000000000000000001010d0000007300750062006d006f00640075006c0065004c006900730074002f00000000015e000000530079007300740065006d002e0043006f006c006c0065006300740069006f006e0073002e00470065006e0065007200690063002e004c00690073007400600031005b005b004900630068006e0069002e00520068007900740068006d00470061006d0065002e005300750062006d006f00640075006c00650042006100730065002c00200041007300730065006d0062006c0079002d004300530068006100720070005d005d002c0020006d00730063006f0072006c00690062000000000006000000000000000007052d010b00000065006e00610062006c006500540079007000650073000101120000006e006f0072006d0061006c004d006100740065007200690061006c004c006900730074002f01000000018a000000530079007300740065006d002e0043006f006c006c0065006300740069006f006e0073002e00470065006e0065007200690063002e004c00690073007400600031005b005b00530079007300740065006d002e0043006f006c006c0065006300740069006f006e0073002e00470065006e0065007200690063002e004c00690073007400600031005b005b0055006e0069007400790045006e00670069006e0065002e004d006100740065007200690061006c002c00200055006e0069007400790045006e00670069006e0065002e0043006f00720065004d006f00640075006c0065005d005d002c0020006d00730063006f0072006c00690062005d005d002c0020006d00730063006f0072006c006900620001000000060100000000000000022f02000000015b000000530079007300740065006d002e0043006f006c006c0065006300740069006f006e0073002e00470065006e0065007200690063002e004c00690073007400600031005b005b0055006e0069007400790045006e00670069006e0065002e004d006100740065007200690061006c002c00200055006e0069007400790045006e00670069006e0065002e0043006f00720065004d006f00640075006c0065005d005d002c0020006d00730063006f0072006c0069006200020000000602000000000000000c000000000c010000000705070501011500000068006900670068006c0069006700680074004d006100740065007200690061006c004c00690073007400300100000003000000060100000000000000023002000000040000000602000000000000000c000000000c0100000007050705
ReferencedUnityObjects:
- {fileID: 2100000, guid: 70eba7194a9d81d40a263caa11f23d33, type: 2}
- {fileID: 2100000, guid: 0db768b5d1363e64a9994db21d7695b3, type: 2}
@@ -487,90 +487,7 @@ MonoBehaviour:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: elementGuid
Entry: 2
Data: 00000000000000000000000000000000
- Name: submoduleList
Entry: 7
Data: 0|System.Collections.Generic.List`1[[Ichni.RhythmGame.SubmoduleBase,
Assembly-CSharp]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name: enableTypes
Entry: 6
Data:
- Name: normalMaterialList
Entry: 7
Data: 1|System.Collections.Generic.List`1[[System.Collections.Generic.List`1[[UnityEngine.Material,
UnityEngine.CoreModule]], mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 2|System.Collections.Generic.List`1[[UnityEngine.Material, UnityEngine.CoreModule]],
mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 10
Data: 0
- Name:
Entry: 10
Data: 1
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name: highlightMaterialList
Entry: 7
Data: 3|System.Collections.Generic.List`1[[System.Collections.Generic.List`1[[UnityEngine.Material,
UnityEngine.CoreModule]], mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 4|System.Collections.Generic.List`1[[UnityEngine.Material, UnityEngine.CoreModule]],
mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 10
Data: 0
- Name:
Entry: 10
Data: 1
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
SerializationNodes: []
elementName:
tags: []
parentElement: {fileID: 0}

View File

@@ -1,128 +1,294 @@
# 更新版 Console 文档
# Editor Console 方法文档
## Console概要
## 概述
Editor Console 是游戏编辑器中的命令行系统,用于执行各种便捷操作。按 **`~`** 键Esc下方打开控制台支持历史记录和参数自动补全。
Editor内有console系统用于执行某些方便的操作。
## 基础操作
在编辑界面内按 **`** 键Esc键下方可以唤出console输入框输入完成后按Enter键执行指令。
### `tp(Vector3 pos)`
将场景相机移动到指定坐标
输入框支持上下文历史记录,按上下箭头可浏览历史指令。
输入格式:
- **func "abc123" 1 2 [0,1,2]**
- 或 **func(1,2,3,"a",[1,2,3])**
- 字符串需双引号包裹(`"abc123"`
- 向量需中括号包裹(`[0,0,1]`
执行失败时会在Log Window显示错误信息。部分指令依赖Inspector窗口当前选中对象请提前选择目标对象。
---
## 命令列表
### 基础操作
**示例**:
```csharp
tp(Vector3 pos)
tp [10,5,0] // 移动到坐标(10,5,0)
tp [0,2,-3] // 移动到坐标(0,2,-3)
tp(0, 0, 15) // 使用括号格式
```
- 将场景相机移动到指定坐标
- 示例:`tp [10,5,0]`
### `tp()`
将场景相机移动到当前选中对象的位置
**示例**:
```csharp
tp()
tp // 直接传送到选中对象位置
```
- 将场景相机移动到当前选中对象的位置
- 需在Inspector中选中对象
> **要求**: Inspector中必须选中对象
### `ReName(string message)`
重命名当前选中对象
**示例**:
```csharp
ReName(string message)
ReName "NewTrackName"
ReName "PlayerSpawnPoint"
ReName("EnemyPath_01") // 括号格式
```
- 重命名当前选中对象
- 示例:`ReName "NewTrackName"`
### 路径生成
## 路径生成
### `Lgp(int loop, Vector3 start, Vector3 end, bool Clear = false, bool offsetOrigin = false)`
在选中的Track上生成线性路径节点
**参数**:
- `loop`: 节点数量必须大于1
- `start`: 起始坐标
- `end`: 结束坐标
- `Clear`: 是否清除现有节点
- `offsetOrigin`: 是否基于原节点变换偏移
**示例**:
```csharp
Lgp(int loop, Vector3 start, Vector3 end)
Lgp 10 [0,0,0] [5,0,5] // 生成10个节点的直线
Lgp 5 [1,2,3] [10,2,3] true // 清除旧节点后生成新路径
Lgp 8 [0,0,0] [0,10,0] false true // 保留并偏移原有节点
```
- 在选中的Track上生成线性路径节点
- 参数:
- `loop`:生成节点数量
- `start`:起始坐标
- `end`:结束坐标
- 示例:`Lgp 10 [0,0,0] [5,0,5]`
### `Spiral` 螺旋路径生成
#### 主轴方向螺旋
```csharp
Spiral(int loop, Vector3 center, float r, float h, int pointsPerTurn, string axis = "y")
```
#### 自定义方向螺旋
```csharp
Spiral(int loop, Vector3 center, float r, float h, int pointsPerTurn, Vector3 dir)
```
- 在选中的Track上生成螺旋路径节点
- 参数:
- `loop`:总节点数
- `center`:螺旋中心点
- `r`:螺旋半径
- `h`:螺旋高度
- `pointsPerTurn`:每圈节点数
- `axis`:主轴方向("x"/"y"/"z"
- `dir`:自定义方向向量
- 示例:`Spiral 20 [0,0,0] 3 10 8 "z"`
### 数据处理
**示例**:
```csharp
SamplerImport(string inputData)
```
- 导入采样器格式的音符数据
- 数据格式:`(动作类型, 轨道ID, 时间戳, X值, [Hold持续时间])`
- 支持动作类型Tap, Stay, Hold, Flick
- 示例:`SamplerImport "(Tap, Track1, 12.5, 3.2)"`
// Y轴螺旋默认
Spiral 20 [0,0,0] 3 10 8
### 音符操作
// Z轴螺旋
Spiral 20 [0,0,0] 3 10 8 "z"
// 自定义方向螺旋
Spiral 15 [1,2,3] 2 5 6 [1,1,0]
// 复杂螺旋路径
Spiral(30, [5,0,5], 4.0, 15.0, 10, [0,1,1])
```
## 数据处理
### `SamplerImport(string inputData)`
导入采样器格式的音符数据
**数据格式**: `(动作类型, 轨道ID, 时间戳, X值, [Hold持续时间])`
**支持的动作类型**:
- `Tap`: 点击音符
- `Stay`: 停留音符
- `Hold`: 长按音符(需要持续时间)
- `Flick`: 滑动音符
**示例**:
```csharp
SetNoteHLInGame(bool forceSetOff = false, bool SameTheme = false)
```
- 全局高亮重复时间点的音符
- 参数:
- `forceSetOff`:是否先关闭所有高亮
- `SameTheme`:是否要求音符类型相同
// 单个音符导入
SamplerImport "(Tap, Track1, 12.5, 3.2)"
// 多个音符批量导入
SamplerImport "(Tap, MainTrack, 10.0, 1.5)\n(Hold, SideTrack, 15.0, -2.1, 3.5)"
// 复杂序列
SamplerImport "
(Tap, RedTrack, 5.2, 0.0)
(Stay, BlueTrack, 7.8, 2.5)
(Hold, GreenTrack, 12.3, -1.0, 4.2)
(Flick, YellowTrack, 18.6, 3.0)
"
```
### `ExportNotesFromTrack()`
导出当前Track下所有音符为正则格式文本
**示例**:
```csharp
SetNoteHLInElement(bool forceSetOff = false, bool SameTheme = false)
ExportNotesFromTrack // 自动复制到剪贴板
```
- 在当前元素内高亮重复时间点的音符
- 参数同上
> **输出示例**:
> ```
> (Tap, MainTrack, 5.200, 0.000)
> (Stay, MainTrack, 7.800, 2.500)
> (Hold, MainTrack, 12.300, -1.000, 4.200)
> ```
## 音符操作
### `SetNoteHLInGame(bool forceSetOff = false, bool SameTheme = false)`
全局高亮重复时间点的音符
**示例**:
```csharp
AttachNoteInNearestTrail()
SetNoteHLInGame // 高亮所有重复时间点音符
SetNoteHLInGame true // 先关闭所有高亮再重新高亮
SetNoteHLInGame false true // 只高亮同类型重复音符
```
- 将轨道上的音符吸附到最近的轨迹线
- 需选中Track对象
### 动画操作
### `SetNoteHLInElement(bool forceSetOff = false, bool SameTheme = false)`
在当前元素内高亮重复时间点的音符
**示例**:
```csharp
swapDisplacement()
SetNoteHLInElement // 在当前选中的Track内高亮
SetNoteHLInElement true // 重置后高亮
```
- 反转位移动画方向(正负值互换)
- 需选中Displacement元素
### `AttachNoteInNearestTrail()`
将轨道上的音符吸附到最近的轨迹线
**示例**:
```csharp
swapSwirl()
AttachNoteInNearestTrail // 自动吸附所有音符到最近轨迹
```
- 反转旋转动画方向
- 需选中Swirl元素
> **要求**: 必须选中Track对象
## 动画操作
### `swapDisplacement()`
反转位移动画方向(正负值互换)
**示例**:
```csharp
swapScale()
swapDisplacement // 将选中的位移动画反向
```
- 反转缩放动画方向
- 需选中Scale元素
> **要求**: 选中Displacement元素
### 对象管理
### `swapSwirl()`
反转旋转动画方向
**示例**:
```csharp
DelSameInParent()
swapSwirl // 反转旋转动画
```
- 删除父对象中所有同类型的兄弟元素(包括自身)
- 示例:删除当前选中类型的所有同级对象
> **要求**: 选中Swirl元素
---
### `swapScale()`
反转缩放动画方向
## 其他
**示例**:
```csharp
swapScale // 反转缩放动画
```
> **要求**: 选中Scale元素
更多功能持续开发中。使用console时可参考编辑器内的自动补全提示和参数类型检查功能。
### `FloorAnim()`
为动画属性添加0时刻关键帧
**示例**:
```csharp
FloorAnim // 确保所有动画从时间0开始
```
## 对象管理
### `DelSameInParent()`
删除父对象中所有同类型的兄弟元素(包括自身)
**示例**:
```csharp
DelSameInParent // 删除当前选中类型的所有同级对象
```
### `AdjustPathnodeZ(float OriginZpoint, float scale)`
调整PathNode的Z坐标缩放
**示例**:
```csharp
AdjustPathnodeZ 0 2.0 // 以Z=0为原点2倍缩放
AdjustPathnodeZ 5 0.5 // 以Z=5为原点缩小一半
```
## 高级功能
### `SplitHoldToTrack(int PathnodesCount)`
将选中的Hold音符分割为带路径的新Track
**示例**:
```csharp
SplitHoldToTrack 5 // 分割为5个路径节点的Track
SplitHoldToTrack 10 // 更精细的分割
```
> **要求**: 选中Hold对象父Track为Movable类型
### `SplitAllHoldToTrack(int PathnodesCount)`
将Track下所有Hold音符分割
**示例**:
```csharp
SplitAllHoldToTrack 5 // 分割当前Track下所有Hold音符
```
> **要求**: 选中Track对象
### `Rebuild()`
强制刷新所有游戏元素和轨道路径
**示例**:
```csharp
Rebuild // 完全重建场景,解决显示问题
```
## 使用技巧
### 参数格式
```csharp
// 空格分隔格式
func "abc" 1 2 [0,1,2]
// 括号分隔格式
func("abc", 1, 2, [0,1,2])
// 混合使用
Lgp 10 [0,0,0] [5,5,5] true
```
### 常用工作流示例
**快速创建路径**:
```csharp
// 1. 选择Track
// 2. 生成直线路径
Lgp 8 [0,0,0] [10,0,5]
// 3. 生成螺旋补充
Spiral 12 [5,2,2] 2 6 4
```
**批量处理音符**:
```csharp
// 1. 导入数据
SamplerImport "(Tap, Track1, 5.0, 1.0)"
// 2. 检查重复音符
SetNoteHLInGame
// 3. 吸附到轨迹
AttachNoteInNearestTrail
// 4. 导出验证
ExportNotesFromTrack
```
## 故障排除
- **对象未选中**: "Please select a Track first!"
- **参数错误**: "Loop must be greater than 1!"
- **类型不匹配**: "Please select a Displacement first!"
- **功能未启用**: "Please enable 'Note Prefab' in EditorManager"
使用前请确认:
1. 正确选中目标对象
2. 参数类型和数量匹配
3. 相关功能已启用如Note Prefab
4. 操作前建议保存工程