TimeLine大改

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-18 18:43:09 +08:00
parent fc3b4d7207
commit 1b5084626d
29 changed files with 16837 additions and 17453 deletions

View File

@@ -91,10 +91,5 @@ namespace AmplifyShaderEditor
{
AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "2992e84f91cbeb14eab234972e07ea9d" );
}
[MenuItem( "Assets/Create/Amplify Shader/Universal/Unlit 1", false, 85 )]
public static void ApplyTemplateUniversalUnlit1()
{
AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "d8d51a726274eed4988773f21b79f651" );
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -155,9 +155,9 @@ RectTransform:
- {fileID: 1701355791749099970}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 366, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4020345575828402432

View File

@@ -109,8 +109,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -14.75, y: -3.8946}
m_SizeDelta: {x: 50, y: 17.2108}
m_AnchoredPosition: {x: -14.75, y: -1.2782}
m_SizeDelta: {x: 50, y: 22.4436}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2582902444683976590
CanvasRenderer:
@@ -140,7 +140,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 2500
m_text: 2500000
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@@ -167,10 +167,10 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 15.4
m_fontSizeBase: 7
m_fontSize: 15.95
m_fontSizeBase: 15.95
m_fontWeight: 400
m_enableAutoSizing: 1
m_enableAutoSizing: 0
m_fontSizeMin: 1
m_fontSizeMax: 72
m_fontStyle: 0
@@ -183,9 +183,9 @@ MonoBehaviour:
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_overflowMode: 2
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1

View File

@@ -11,11 +11,9 @@ Material:
m_Shader: {fileID: 4800000, guid: 44e8d6dab1446644688189717537509a, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _EMISSION_ON
m_ValidKeywords: []
m_InvalidKeywords:
- _RECEIVE_SHADOWS_OFF
- _ZWRITE_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
@@ -129,7 +127,7 @@ Material:
- _DistortionStrengthScaled: 0
- _DstBlend: 0
- _DstBlendAlpha: 0
- _Emission: 1
- _Emission: 0
- _EmissionEnabled: 0
- _EnableExternalAlpha: 0
- _EnvironmentReflections: 1
@@ -163,7 +161,7 @@ Material:
- _UseRedAsAlpha: 0
- _WorkflowMode: 1
- _ZTest: 4
- _ZWrite: 1
- _ZWrite: 0
- _ZWriteControl: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 16d2a78eca81ca84ebbd7ed9cb526b3e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,424 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6819895460862130250
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4554840573411676723}
- component: {fileID: 7994738592504131340}
- component: {fileID: 3082149538595293410}
- component: {fileID: 5013297744322667706}
- component: {fileID: 5587375361200234056}
- component: {fileID: 8944372302054493042}
m_Layer: 0
m_Name: Point
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4554840573411676723
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6819895460862130250}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7994738592504131340
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6819895460862130250}
m_Mesh: {fileID: 0}
--- !u!23 &3082149538595293410
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6819895460862130250}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 465ba4a268f5c4589a58ed35a13a75c4, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &5013297744322667706
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6819895460862130250}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 598e68924c9f6324bbfd049d3bae754c, type: 3}
m_Name:
m_EditorClassIdentifier:
editorDrawPivot: 1
editorPathColor: {r: 1, g: 1, b: 1, a: 1}
editorAlwaysDraw: 0
editorDrawThickness: 0
editorBillboardThickness: 1
isNewlyCreated: 0
editorUpdateMode: 0
multithreaded: 0
updateMode: 0
triggerGroups: []
_spline:
points:
- _type: 0
position: {x: 1.2521503, y: 0, z: 2.845747}
color: {r: 1, g: 1, b: 1, a: 1}
normal: {x: 0, y: 1, z: 0}
size: 1
tangent: {x: 1.2521503, y: 0, z: 2.845747}
tangent2: {x: 1.2521503, y: 0, z: 2.845747}
- _type: 0
position: {x: -0.5621309, y: 0, z: 17.44325}
color: {r: 1, g: 1, b: 1, a: 1}
normal: {x: 0, y: 1, z: 0}
size: 1
tangent: {x: -0.5621309, y: 0, z: 17.44325}
tangent2: {x: -0.5621309, y: 0, z: 17.44325}
type: 0
linearAverageDirection: 1
customValueInterpolation:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
customNormalInterpolation:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
sampleRate: 10
closed: 0
_knotParametrization: 0
_originalSamplePercents: []
_is2D: 0
hasSamples: 1
_optimizeAngleThreshold: 0.5
_space: 1
_sampleMode: 0
_subscribers:
- {fileID: 5587375361200234056}
- {fileID: 8944372302054493042}
_rawSamples:
- position: {x: 1.2521503, y: 0, z: 2.845747}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333812, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0
- position: {x: 1.0505635, y: 0, z: 4.467692}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333812, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.1111111111111111
- position: {x: 0.84897673, y: 0, z: 6.089637}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.123338126, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.2222222222222222
- position: {x: 0.6473899, y: 0, z: 7.7115817}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333813, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.3333333333333333
- position: {x: 0.44580308, y: 0, z: 9.333527}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.123338126, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.4444444444444444
- position: {x: 0.24421617, y: 0, z: 10.955472}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333812, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.5555555555555556
- position: {x: 0.04262943, y: 0, z: 12.577417}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333813, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.6666666666666666
- position: {x: -0.15895744, y: 0, z: 14.199362}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333812, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.7777777777777778
- position: {x: -0.36054417, y: 0, z: 15.821307}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333811, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.8888888888888888
- position: {x: -0.5621309, y: 0, z: 17.44325}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333811, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 1
_nodes: []
--- !u!114 &5587375361200234056
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6819895460862130250}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bf69cfa06c48dba428c5c4d626d57ab7, type: 3}
m_Name:
m_EditorClassIdentifier:
updateMethod: 0
_spline: {fileID: 5013297744322667706}
_autoUpdate: 1
_rotationModifier:
blend: 1
useClippedPercent: 0
keys: []
_offsetModifier:
blend: 1
useClippedPercent: 0
keys:
- _featherStart: 0
_featherEnd: 1
_centerStart: 0
_centerEnd: 0.8999999761581421
interpolation:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 34
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 34
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
blend: 1
offset: {x: -4.97, y: 0}
_colorModifier:
blend: 1
useClippedPercent: 0
keys: []
_sizeModifier:
blend: 1
useClippedPercent: 0
keys: []
_clipFromSample:
position: {x: 1.2521503, y: 0, z: 2.845747}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333812, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0
_clipToSample:
position: {x: -0.5621309, y: 0, z: 17.44325}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333811, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 1
_loopSamples: 0
_clipFrom: 0
_clipTo: 1
animClipFrom: 0
animClipTo: 1
multithreaded: 0
buildOnAwake: 1
buildOnEnable: 0
_baked: 0
_markDynamic: 1
_size: 1
_color: {r: 1, g: 1, b: 1, a: 1}
_offset: {x: 0, y: 0, z: 0}
_normalMethod: 1
_calculateTangents: 1
_useSplineSize: 1
_useSplineColor: 1
_rotation: 0
_flipFaces: 0
_doubleSided: 0
_uvMode: 0
_uvScale: {x: 1, y: 1}
_uvOffset: {x: 0, y: 0}
_uvRotation: 0
_meshIndexFormat: 0
_bakedMesh: {fileID: 0}
colliderUpdateRate: 0.2
autoOrient: 1
updateFrameInterval: 0
_slices: 1
--- !u!114 &8944372302054493042
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6819895460862130250}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bf69cfa06c48dba428c5c4d626d57ab7, type: 3}
m_Name:
m_EditorClassIdentifier:
updateMethod: 0
_spline: {fileID: 5013297744322667706}
_autoUpdate: 1
_rotationModifier:
blend: 1
useClippedPercent: 0
keys: []
_offsetModifier:
blend: 1
useClippedPercent: 0
keys:
- _featherStart: 0
_featherEnd: 1
_centerStart: 0.10000000149011612
_centerEnd: 0.8999999761581421
interpolation:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 34
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 34
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
blend: 1
offset: {x: 4.68, y: 0}
_colorModifier:
blend: 1
useClippedPercent: 0
keys: []
_sizeModifier:
blend: 1
useClippedPercent: 0
keys: []
_clipFromSample:
position: {x: 1.2521503, y: 0, z: 2.845747}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333812, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0
_clipToSample:
position: {x: -0.5621309, y: 0, z: 17.44325}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.12333811, y: 0, z: 0.9923647}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 1
_loopSamples: 0
_clipFrom: 0
_clipTo: 1
animClipFrom: 0
animClipTo: 1
multithreaded: 0
buildOnAwake: 1
buildOnEnable: 0
_baked: 0
_markDynamic: 1
_size: 1
_color: {r: 1, g: 1, b: 1, a: 1}
_offset: {x: 0, y: 0, z: 0}
_normalMethod: 1
_calculateTangents: 1
_useSplineSize: 1
_useSplineColor: 1
_rotation: 0
_flipFaces: 0
_doubleSided: 0
_uvMode: 0
_uvScale: {x: 0, y: 1}
_uvOffset: {x: 0, y: 0}
_uvRotation: 0
_meshIndexFormat: 0
_bakedMesh: {fileID: 0}
colliderUpdateRate: 0.2
autoOrient: 1
updateFrameInterval: 0
_slices: 1

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: bf20d9ebf0e3c5443921fa6e995e9eca
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@@ -17,22 +17,28 @@ public class SubTab : MonoBehaviour
private TimePointerModule timePointerModule;
public TimelineTab father;
private Timeline timeline;
public float Time;
public float time;
public void Set(IBaseElement Objs, float time)
{
songInformation = EditorManager.instance.songInformation;
timePointerModule = EditorManager.instance.uiManager.timeline.timePointerModule;
timeline = EditorManager.instance.uiManager.timeline;
Time = time;
this.time = time;
connectObj.Add(Objs);
button.GetComponentInChildren<TMP_Text>().text = connectObj.Count().ToString();
transform.localPosition = new Vector3(Time / timeline.timePerBeat * timePointerModule.timePointerInterval + 15f - timePointerModule.delayDistanceOffset,
-(42.5f + (father.TabIndex * 25)), 0);
//transform.position = new Vector3(transform.position.x, father.Title.transform.position.y, 0);
transform.localPosition = new Vector3((this.time / timeline.timePerBeat * timePointerModule.timePointerInterval),
-(42.5f + ((father.TabIndex + 1) * 25)), 0);
//transform.position = new Vector3(transform.position.x, father.Title.transform.position.y + 12, 0);
}
void Update()
{
if (Time.frameCount % 3 == 0)
{
transform.localScale = new Vector3(time > songInformation.songTime ? 1f : 0f, 1f, 1f);
}
}
// public void GetClick()//?
// {
// if (connectObj[0] is GameElement)

View File

@@ -15,230 +15,73 @@ namespace Ichni.Editor
public GameObject timePointerPrefab;
public List<TimePointer> timePointerList;
private TimePointer NowPointer;
public RectTransform moveTabPoint;
public RectTransform timePointerContainer;
public RectTransform rightSide;
public float timePointerInterval = 100f;
public RectTransform timePointerArea;
public RectTransform visibleTimePointerArea;
public RectTransform moveTabPoint;//用于显示timeline上的tab
public RectTransform mainTimePointer;
public float intervalUnit;
public float timePointerInterval;
public float sizeNegative, sizePositive;
public int negativePointerAmount; // 负方向指示线的数量
public int positivePointerAmount, totalPointerAmount;
/// <summary>
/// delay时间区间中(-delay, 0)的距离偏移量
/// </summary>
public float delayDistanceOffset;
public float leftSideSongTime, rightSideSongTime, songTimeDistance;
private void Start()
public void Start()
{
Observable.NextFrame().Subscribe(_ =>
{
timePointerList = new List<TimePointer>();
Initialize(songInformation.delay, songInformation.bpm);
});
timePointerInterval = 100f;
EditorManager.instance.uiManager.timeline.timePointerModule = this;
OnceSpawn();
}
private void Update()
public void OnceSpawn()
{
if (EditorManager.instance.musicPlayer.isPlaying)
for (int i = timePointerList.Count - 1; i >= 0; i--)
{
SetRange(songInformation.songTime);
}
timePointerList.ForEach(pointer =>
{
bool isActive = pointer.time >= leftSideSongTime && pointer.time <= rightSideSongTime;
if(isActive != pointer.gameObject.activeSelf) pointer.gameObject.SetActive(isActive);
});
if (OnePointer != null) moveTabPoint.localPosition =
new Vector3(timePointerArea.localPosition.x + OnePointer.transform.localPosition.x - 30f, 0, 0);
foreach (var i in moveTabPoint.transform.GetComponentsInChildren<SubTab>())
{
i.gameObject.transform.localScale = i.Time >= timeline.songTime ? Vector3.one : Vector3.zero;
}
}
/// <summary>
/// 初始化所有Timeline指示线
/// </summary>
/// <param name="delay"></param>
/// <param name="bpm"></param>
public void Initialize(float delay, float bpm)
{
timePointerInterval = 80;
ClearPointers();
int beatDivider = 1;
intervalUnit = (60f / bpm) / beatDivider * 1000;
sizeNegative = delay * beatDivider / timeline.timePerBeat;
// 计算负方向指示线的数量
negativePointerAmount = Mathf.CeilToInt(sizeNegative);
sizePositive = songInformation.song.length * beatDivider / timeline.timePerBeat;
positivePointerAmount = Mathf.CeilToInt(sizePositive);
totalPointerAmount = negativePointerAmount + positivePointerAmount;
timePointerArea.sizeDelta = new Vector2(timePointerInterval * (sizeNegative + sizePositive), 60f);
delayDistanceOffset = timePointerInterval * (negativePointerAmount - sizeNegative);
leftSideSongTime = timeline.beatmapStartTime;
rightSideSongTime = timeline.timePerBeat * (visibleTimePointerArea.rect.width / timePointerInterval);
songTimeDistance = rightSideSongTime;
for (int i = -negativePointerAmount; i <= positivePointerAmount; i++)
{
CreatePointer(beatDivider, i);
}
//ChangeSongTimeDistance(0);
SetRange(timeline.beatmapStartTime);
}
}
public partial class TimePointerModule
{
/// <summary>
/// 设置Timeline的显示区间区间宽度使用当前的区间宽度
/// </summary>
/// <param name="startTime">开始时间,结束时间即(开始时间+区间宽度)</param>
public void SetRange(float startTime)
{
startTime = Mathf.Clamp(startTime, timeline.beatmapStartTime, songInformation.song.length);
timePointerArea.anchoredPosition =
new Vector2((timePointerArea.sizeDelta.x / 2) -
(startTime + songInformation.delay) / timeline.timePerBeat * timePointerInterval, 0);
float proportion = mainTimePointer.anchoredPosition.x / visibleTimePointerArea.rect.width;
leftSideSongTime = startTime - songTimeDistance * proportion;
rightSideSongTime = startTime + songTimeDistance * (1 - proportion);
}
/// <summary>
/// 生成指示线
/// </summary>
/// <param name="beatDivider">细分X分音符</param>
/// <param name="index"></param>
TimePointer OnePointer = null;//第一个pointer
private void CreatePointer(int beatDivider, int index)
{
TimePointer pointer = Instantiate(timePointerPrefab, timePointerArea).GetComponent<TimePointer>();
timePointerList.Add(pointer);
pointer.index = index;
pointer.GetComponent<RectTransform>().anchoredPosition =
new Vector2((index + negativePointerAmount) * timePointerInterval + 15f - delayDistanceOffset, 0);
pointer.time = index * intervalUnit / 1000f;
pointer.intervalUnitText.text = Mathf.RoundToInt(index * intervalUnit).ToString();
if (index == 0)
{
OnePointer = pointer;
}
if (beatDivider > 1)
{
}
}
/// <summary>
/// 更新指示线位置
/// </summary>
public void UpdatePointers()
{
// 计算延迟距离偏移量
delayDistanceOffset = timePointerInterval * (negativePointerAmount - sizeNegative);
// 更新指示线区域的大小
timePointerArea.sizeDelta = new Vector2(timePointerInterval * totalPointerAmount, 55f);
// 更新每个指示线的位置
foreach (var pointer in timePointerList)
{
pointer.GetComponent<RectTransform>().anchoredPosition =
new Vector2((pointer.index + negativePointerAmount) * timePointerInterval + 15f - delayDistanceOffset, 0);
}
}
/// <summary>
/// 清楚所有指示线
/// </summary>
private void ClearPointers()
{
foreach (var pointer in timePointerList)
{
Destroy(pointer.gameObject);
Destroy(timePointerList[i].gameObject);
}
timePointerList.Clear();
}
/// <summary>
/// 缩放时间线的展示时间宽度
/// </summary>
/// <param name="value">增减值</param>
public void ChangeSongTimeDistance(float value)
{
float oldDistance = songTimeDistance;
float changedDistance = songTimeDistance + value;
float songLength = songInformation.song.length;
if (changedDistance < 1 || changedDistance > songLength)
for (int i = 0; i < songInformation.songLength / timeline.timePerBeat; i++)
{
return;
TimePointer timePointer = Instantiate(timePointerPrefab, timePointerContainer).GetComponent<TimePointer>();
timePointerList.Add(timePointer);
timePointer.intervalUnitText.text = (i * timeline.timePerBeat).ToString("F3");
timePointer.GetComponent<RectTransform>().localPosition = new Vector3(i * timePointerInterval, 0f, 0f);
timePointer.index = i;
timePointer.gameObject.SetActive(false);
}
float finalDistance = 0, finalValue = 0;
float superfluousDistance = changedDistance - songLength;
if (superfluousDistance > 0)
}
public void SortPos()
{
foreach (var i in timePointerList)
{
finalDistance = songLength;
finalValue = value - superfluousDistance;
i.GetComponent<RectTransform>().localPosition = new Vector3(i.index * timePointerInterval, 0f, 0f);
}
}
public void Update()
{
timePointerContainer.localPosition = new Vector3(-EditorManager.instance.songInformation.songTime / timeline.timePerBeat * timePointerInterval, timePointerContainer.localPosition.y, 0f);
if (NowPointer == null)
{
NowPointer = timePointerList[0];
}
else
{
finalDistance = changedDistance;
finalValue = value;
while (NowPointer.index < timePointerList.Count - 1 && NowPointer.index * timeline.timePerBeat < EditorManager.instance.songInformation.songTime)
{
NowPointer.gameObject.SetActive(false);
NowPointer = timePointerList[NowPointer.index + 1];
}
while (NowPointer.index > 0 && NowPointer.index * timeline.timePerBeat >= EditorManager.instance.songInformation.songTime)
{
NowPointer.gameObject.SetActive(true);
NowPointer = timePointerList[NowPointer.index - 1 >= 0 ? NowPointer.index - 1 : 0];
}
}
songTimeDistance = finalDistance;
float proportion = mainTimePointer.anchoredPosition.x /
visibleTimePointerArea.rect.width;
leftSideSongTime -= finalValue * (proportion);
rightSideSongTime += finalValue * (1 - proportion);
if (leftSideSongTime < -songInformation.delay)
for (int i = NowPointer.index + 1; i < timePointerList.Count; i++)
{
rightSideSongTime += Mathf.Abs(leftSideSongTime);
leftSideSongTime = -songInformation.delay;
}
else if (rightSideSongTime > songLength)
{
leftSideSongTime -= (rightSideSongTime - songLength);
rightSideSongTime = songLength;
timePointerList[i].gameObject.SetActive(true);
if (timePointerList[i].GetComponent<RectTransform>().position.x > rightSide.position.x)
{
timePointerList[i].gameObject.SetActive(false);
break;
}
}
timePointerInterval = timePointerInterval / finalDistance * oldDistance;
UpdatePointers();
//UpdateListItems();
SetRange(leftSideSongTime);
}
}
}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using DG.Tweening;
using Ichni.RhythmGame;
using Sirenix.Utilities;
using TMPro;
@@ -61,8 +62,7 @@ namespace Ichni.Editor
if (timePointerModule.timePointerInterval + scrollValue >= 30)
{
timePointerModule.timePointerInterval += scrollValue;
timePointerModule.UpdatePointers();
timePointerModule.SetRange(songTime);
timePointerModule.SortPos();
SetTimeLine(EditorManager.instance.uiManager.inspector.connectedGameElement);
}
@@ -91,24 +91,43 @@ namespace Ichni.Editor
BeatField.text = songBeat.ToString("F2");
}
private Tweener _activeTweener; // 保存当前动画的引用
public void SetTime(string time)
{
EditorManager.instance.musicPlayer.PauseMusic();
EditorManager.instance.musicPlayer.audioSource.time = Mathf.Clamp(float.Parse(time) - EditorManager.instance.songInformation.offset, 0, EditorManager.instance.songInformation.songLength);
EditorManager.instance.songInformation.songTime = float.Parse(time);
float parsedTime = float.Parse(time);
float offsetedtime = Mathf.Clamp(parsedTime - EditorManager.instance.songInformation.offset, 0, EditorManager.instance.songInformation.songLength);
EditorManager.instance.musicPlayer.audioSource.time = offsetedtime;
if (_activeTweener != null && _activeTweener.IsActive())
{
_activeTweener.Complete();
}
// 使用 DOTween 来平滑过渡到新的时间
_activeTweener = DOTween.To(() => EditorManager.instance.songInformation.songTime, x => EditorManager.instance.songInformation.songTime = x, parsedTime, 0.2f)
.OnUpdate(UpdateTime);
timePointerModule.UpdatePointers();
timePointerModule.SetRange(songTime);
// timePointerModule.UpdatePointers();
// timePointerModule.SetRange(songTime);
}
public void SetBeat(string beat)
{
EditorManager.instance.musicPlayer.PauseMusic();
EditorManager.instance.musicPlayer.audioSource.time = Mathf.Clamp((float.Parse(beat) * timePerBeat) - EditorManager.instance.songInformation.offset, 0, EditorManager.instance.songInformation.songLength);
EditorManager.instance.songInformation.songTime = float.Parse(beat) * timePerBeat;
float parsedTime = float.Parse(beat) * timePerBeat;
float offsetedtime = Mathf.Clamp(parsedTime - EditorManager.instance.songInformation.offset, 0, EditorManager.instance.songInformation.songLength);
EditorManager.instance.musicPlayer.audioSource.time = offsetedtime;
if (_activeTweener != null && _activeTweener.IsActive())
{
_activeTweener.Complete();
}
timePointerModule.UpdatePointers();
timePointerModule.SetRange(songTime);
_activeTweener = DOTween.To(() => EditorManager.instance.songInformation.songTime, x => EditorManager.instance.songInformation.songTime = x, parsedTime, 0.2f)
.OnUpdate(UpdateTime);
// EditorManager.instance.musicPlayer.audioSource.time = Mathf.Clamp((float.Parse(beat) * timePerBeat) - EditorManager.instance.songInformation.offset, 0, EditorManager.instance.songInformation.songLength);
// EditorManager.instance.songInformation.songTime = float.Parse(beat) * timePerBeat;
// timePointerModule.UpdatePointers();
// timePointerModule.SetRange(songTime);
}
}

View File

@@ -53,7 +53,7 @@ public class TimelineTab : MonoBehaviour
else if (gameElement is NoteBase)
{
float Judgetime = ((NoteBase)gameElement).exactJudgeTime;
if (SubTabs.ContainsKey(Judgetime))
{
SubTabs[Judgetime].Set(gameElement, Judgetime);

View File

@@ -90,7 +90,7 @@ namespace Ichni.RhythmGame
UnityAction action = (() =>
{
Debug.Log($"Song Information Updated: {songName}, BPM: {bpm}, Delay: {delay}, Offset: {offset}");
EditorManager.instance.uiManager.timeline.timePointerModule.Initialize(delay, bpm);
EditorManager.instance.uiManager.timeline.timePointerModule.OnceSpawn();
});
p.AddListenerFunction(action);
o.AddListenerFunction(action);

View File

@@ -79,75 +79,73 @@ namespace Ichni.RhythmGame
}
protected virtual void Update()
{
if (isOnTrack)
var editor = EditorManager.instance;
var cameraManager = editor.cameraManager;
float songTime = editor.songInformation.songTime;
// 轨道位置更新
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleStatic)
{
if (track.trackTimeSubmodule is TrackTimeSubmoduleStatic)
{
UpdateNoteInStaticTrack();
}
UpdateNoteInStaticTrack();
}
float songTime = EditorManager.instance.songInformation.songTime;
// 判定状态更新
if (isFirstJudged && songTime < exactJudgeTime)
{
isFirstJudged = false;
}
if (!isFirstJudged && songTime >= exactJudgeTime)
else if (!isFirstJudged && songTime >= exactJudgeTime)
{
if (!isFirstJudged)
noteAudioSubmodule?.PlayNoteJudgeAudios(editor.currentJudgeType);
isFirstJudged = true;
}
// 判定单元更新
if (noteJudgeSubmodule != null && !cameraManager.isSceneCameraActive)
{
foreach (var unit in noteJudgeSubmodule.judgeUnitList)
{
noteAudioSubmodule.PlayNoteJudgeAudios(EditorManager.instance.currentJudgeType);
isFirstJudged = true;
}
}
if (noteJudgeSubmodule != null && !EditorManager.instance.cameraManager.isSceneCameraActive)
{
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
{
unit.UpdateJudge();
if (unit.isShowingJudge) unit.UpdateJudge();
}
}
// 视觉效果更新
if (noteVisual != null)
{
noteVisual.effectSubmodule.effectCollection["Generate"].ForEach(e => e.UpdateEffect(exactJudgeTime));
noteVisual.effectSubmodule.effectCollection["GeneralJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
var effects = noteVisual.effectSubmodule.effectCollection;
UpdateEffectList(effects["Generate"]);
UpdateEffectList(effects["GeneralJudge"]);
switch (EditorManager.instance.currentJudgeType)
switch (editor.currentJudgeType)
{
case NoteJudgeType.Perfect:
noteVisual.effectSubmodule.effectCollection["Perfect"].ForEach(e => e.UpdateEffect(exactJudgeTime));
break;
case NoteJudgeType.Good:
noteVisual.effectSubmodule.effectCollection["Good"].ForEach(e => e.UpdateEffect(exactJudgeTime));
break;
case NoteJudgeType.Bad:
noteVisual.effectSubmodule.effectCollection["Bad"].ForEach(e => e.UpdateEffect(exactJudgeTime));
break;
case NoteJudgeType.Miss:
noteVisual.effectSubmodule.effectCollection["Miss"].ForEach(e => e.UpdateEffect(exactJudgeTime));
break;
case NoteJudgeType.Perfect: UpdateEffectList(effects["Perfect"]); break;
case NoteJudgeType.Good: UpdateEffectList(effects["Good"]); break;
case NoteJudgeType.Bad: UpdateEffectList(effects["Bad"]); break;
case NoteJudgeType.Miss: UpdateEffectList(effects["Miss"]); break;
}
noteVisual.effectSubmodule.effectCollection["AfterJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
UpdateEffectList(effects["AfterJudge"]);
if (EditorManager.instance.cameraManager.haveGameCamera)
// 屏幕位置更新(降低频率)
if (cameraManager.haveGameCamera)//&& Time.frameCount % 3 == 0)
{
noteScreenPosition = EditorManager.instance.cameraManager.gameCamera.gameCamera.WorldToScreenPoint(noteVisual.transform.position);
noteScreenPosition = cameraManager.gameCamera.gameCamera.WorldToScreenPoint(
noteVisual.transform.position);
}
}
//Editor
if (noteVisual != null)
{
// 碰撞体状态
noteVisual.GetComponent<Collider>().enabled = !isFirstJudged;
}
}
// 辅助方法:更新效果列表
private void UpdateEffectList(List<EffectBase> effects)
{
for (int i = 0; i < effects.Count; i++)
{
effects[i].UpdateEffect(exactJudgeTime);
}
}
public void ExecuteStartJudge()
{

View File

@@ -8,7 +8,7 @@ namespace Ichni.RhythmGame
{
public partial class Track
{
public TrackNoteEditor trackNoteEditor;
/// <summary>
/// 快速复制粘贴Track
/// </summary>

View File

@@ -51,6 +51,11 @@ public class EventPoint : MonoBehaviour
}
public float value => FatherTab.scalevalue;
public void Refresh()
{
ReDraw(value);
UpdateValue();
}
public void ReDraw(float value)
{
@@ -130,13 +135,7 @@ public class EventPoint : MonoBehaviour
}
private void Update()
{
if (RectTransformUtility.RectangleContainsScreenPoint(CurveCanvas.GetComponent<RectTransform>(), Mouse.current.position.ReadValue()))
{
}
}
public void SelectButtonClick()//unity内当按钮按下时
{
if (Keyboard.current.leftShiftKey.isPressed)
@@ -187,7 +186,12 @@ public class EventPoint : MonoBehaviour
FatherTab.FatherWindow.ConnectedPoint.EvDrawimage.color.b, 0.5f
);
}
UpdateValue();
}
private void UpdateValue()
{
// 设置新的连接点并更新UI
FatherTab.FatherWindow.ConnectedPoint = this;
EvDrawimage.color = new Color(EvDrawimage.color.r, 0.75f, EvDrawimage.color.b, 1f);
@@ -208,7 +212,6 @@ public class EventPoint : MonoBehaviour
FatherTab.FatherWindow.animationCurveTypeDropdown.onValueChanged.AddListener(value => FatherTab.FatherWindow.ChangeValue());
}
// 添加静态方法:查找插入索引
public static int FindInsertIndex(List<EventPoint> eventPoints, float startTime)
{

View File

@@ -221,18 +221,20 @@ public partial class GraphicalFlexibleFloatWindow
}
}
}
if (RectTransformUtility.RectangleContainsScreenPoint(GetComponent<RectTransform>(), Mouse.current.position.ReadValue()))
if (ConnectedPoint != null && RectTransformUtility.RectangleContainsScreenPoint(GetComponent<RectTransform>(), Mouse.current.position.ReadValue()))
{
if (Keyboard.current.aKey.wasPressedThisFrame)
{
if (ConnectedPoint != null)
{
ConnectedPoint.animatedFloat.endValue *= -1;
ConnectedPoint.animatedFloat.startValue *= -1;
ConnectedPoint.ReDraw(scalevalue);
}
ConnectedPoint.animatedFloat.endValue *= -1;
ConnectedPoint.animatedFloat.startValue *= -1;
ConnectedPoint.Refresh();
}
if (Keyboard.current.sKey.wasPressedThisFrame)
{
float value = ConnectedPoint.animatedFloat.startValue;
ConnectedPoint.animatedFloat.startValue = ConnectedPoint.animatedFloat.endValue;
ConnectedPoint.animatedFloat.endValue = value;
ConnectedPoint.Refresh();
}
}

View File

@@ -234,34 +234,34 @@ public class SampleWindow : MovableWindow//该window高度为300横的要XWid
far -= 1f / Xdevide;
float time = far * timePerBeat;
;
switch (NoteCode)
{
case 0:
Tap a = Tap.GenerateElement("New Tap", Guid.NewGuid(), new List<string>(), true, gameElement, time);
noteBases.Add(a);
a.noteVisual.transformSubmodule.originalPosition = new Vector3(localMousePosition.x / XWidth, 0f, 0f);
a.noteVisual.transformSubmodule.originalPosition = new Vector3(isExpand ? (localMousePosition.x / XWidth) : 0f, 0f, 0f);
a.noteVisual.transformSubmodule.Refresh();
SpawnNote(a, isExpand ? localMousePosition.x : 0f);
break;
case 3:
Hold b = Hold.GenerateElement("New Hold", Guid.NewGuid(), new List<string>(), true, gameElement, time, time + 0.5f);
noteBases.Add(b);
b.noteVisual.transformSubmodule.originalPosition = new Vector3(localMousePosition.x / XWidth, 0f, 0f);
b.noteVisual.transformSubmodule.originalPosition = new Vector3(isExpand ? (localMousePosition.x / XWidth) : 0f, 0f, 0f);
b.noteVisual.transformSubmodule.Refresh();
SpawnNote(b, isExpand ? localMousePosition.x : 0f);
break;
case 1:
Stay c = Stay.GenerateElement("New Stay", Guid.NewGuid(), new List<string>(), true, gameElement, time);
noteBases.Add(c);
c.noteVisual.transformSubmodule.originalPosition = new Vector3(localMousePosition.x / XWidth, 0f, 0f);
c.noteVisual.transformSubmodule.originalPosition = new Vector3(isExpand ? (localMousePosition.x / XWidth) : 0f, 0f, 0f);
c.noteVisual.transformSubmodule.Refresh();
SpawnNote(c, isExpand ? localMousePosition.x : 0f);
break;
case 2:
Flick d = Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, gameElement, time, new List<Vector2>());
noteBases.Add(d);
d.noteVisual.transformSubmodule.originalPosition = new Vector3(localMousePosition.x / XWidth, 0f, 0f);
d.noteVisual.transformSubmodule.originalPosition = new Vector3(isExpand ? (localMousePosition.x / XWidth) : 0f, 0f, 0f);
d.noteVisual.transformSubmodule.Refresh();
SpawnNote(d, isExpand ? localMousePosition.x : 0f);
break;

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f613492402ff5f2449535cf8161474ef
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,28 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using Dreamteck.Splines;
using Ichni.RhythmGame;
using Unity.VisualScripting;
using UnityEngine;
public class TrackNoteEditor : MonoBehaviour
{
public SplineRenderer splineRenderer;
public SplineComputer splineComputer;
public int BeatDevider = 4; // 节拍分割数
public Track Track;
public void Initialize(Track track)
{
Track = track;
Track.trackNoteEditor = this;
// 初始化其他相关组件或数据
UnityEditorInternal.ComponentUtility.CopyComponent(Track.trackPathSubmodule.path);
UnityEditorInternal.ComponentUtility.PasteComponentAsNew(gameObject);
splineComputer = GetComponent<SplineComputer>();
if (Track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
{
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c643f60e3c1d85543a8835265334bd58
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -62,7 +62,7 @@ namespace Ichni.Editor
isPlaying = false;
EditorManager.instance.songInformation.songTime = 0;
audioSource.Stop();
EditorManager.instance.uiManager.timeline.timePointerModule.SetRange(0);
//EditorManager.instance.uiManager.timeline.timePointerModule.SetRange(0);
}
}
}

View File

@@ -97,5 +97,5 @@ Material:
- _Color: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
- _Tint2: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
- _Tint2: {r: 0.39999998, g: 0.39999998, b: 0.39999998, a: 0.5}
m_BuildTextureStacks: []

View File

@@ -8,62 +8,63 @@ using UnityEngine.Rendering;
public class SkyboxBlender : MonoBehaviour
{
[Tooltip("The materials you want to blend to linearly.")]
public List<Material> skyboxMaterials;
[Tooltip("Checking this will instantly make the first material your current skybox.")]
public bool makeFirstMaterialSkybox;
public List<Material> skyboxMaterials;
[Tooltip("Checking this will instantly make the first material your current skybox.")]
public bool makeFirstMaterialSkybox;
[Min(0), Tooltip("The speed of the blending between the skyboxes.")]
public float blendSpeed = 0.5f;
[Min(0), Tooltip("The time to wait before blending the next skybox material.")]
public float timeToWait = 0f;
[Tooltip("If enabled, will loop the materials list. When the blender reaches the last skybox in the list, it'll blend back to the first one.")]
public bool loop = true;
public float blendSpeed = 0.5f;
[Min(0), Tooltip("The time to wait before blending the next skybox material.")]
public float timeToWait = 0f;
[Tooltip("If enabled, will loop the materials list. When the blender reaches the last skybox in the list, it'll blend back to the first one.")]
public bool loop = true;
[Tooltip("If enabled, the lighting of the world will be updated to that of the skyboxes blending.")]
public bool updateLighting;
[Tooltip("If enabled, the reflections of the world will be updated to that of the skyboxes blending.")]
public bool updateReflections;
public bool updateReflections;
[Range(1, 30), Tooltip("Set how many frames need to pass during blend before updating the reflections & lighting each time. Updating these take a toll on performance so the higher this number is, the more performant your game will be (during blend) but the less accurate the lighting & reflections update will be. The less this number is, the slower the game will be but the accuracy increases. By average the best performance/accuracy results is setting it between 5-10.")]
public int updateEveryFrames = 5;
public int updateEveryFrames = 5;
[Tooltip("Keep rotating the skybox infinetly while blending.")]
public bool keepRotating;
[Tooltip("if you would prefer a certain degree to rotate the skybox to during blending - 360 is a full turn.")]
public float rotateToAngle = 180;
public float rotateToAngle = 180;
[Min(0), Tooltip("The speed of the skybox rotation.")]
public float rotationSpeed;
public float rotationSpeed;
[Tooltip("If enabled, the rotation will stop when the blend finishes. If disabled, even after blending the skybox will continue rotating. TAKE NOTE: if loop is enabled in blend options. This will not take effect.")]
public bool stopRotationOnBlendFinish;
#region SYSTEM VARIABLES
Material defaultSkyboxMaterial;
Material skyboxBlenderMaterial;
Texture currentTexture;
Material defaultSkyboxMaterial;
Material skyboxBlenderMaterial;
Texture currentTexture;
float totalBlendValue = 1f;
float totalBlendValue = 1f;
public float blendValue { private set; get; }
float defaultBlend;
float defaultRotation;
float rotationSpeedValue;
float defaultBlend;
float defaultRotation;
float rotationSpeedValue;
int index = 0;
public int CurrentIndex {
int index = 0;
public int CurrentIndex
{
get { return index; }
}
int indexToBlend;
int indexToBlend;
int usedBlend;
int LightAndReflectionFrames;
bool linearBlending;
bool currentSkyboxNotFirstMaterialBlending;
bool linearBlending;
bool currentSkyboxNotFirstMaterialBlending;
bool comingFromLoop;
bool rotateSkybox;
bool oneTickBlend = false;
bool stillRunning = false;
bool singleBlend = false;
bool rotateSkybox;
bool oneTickBlend = false;
bool stillRunning = false;
bool singleBlend = false;
bool stopped = false;
bool blendByIndex;
bool stopRotation;
@@ -72,30 +73,31 @@ public class SkyboxBlender : MonoBehaviour
bool isLinearBlend;
bool isSetReflectionProbeOnStart;
ReflectionProbe reflectionProbe;
Cubemap cubemap = null;
ReflectionProbe reflectionProbe;
Cubemap cubemap = null;
#endregion
#region UNITY METHODS
void Awake()
void Awake()
{
// load the material
skyboxBlenderMaterial = Resources.Load("Material & Shader/Skybox Blend Material", typeof(Material)) as Material;
if (skyboxBlenderMaterial)
if (skyboxBlenderMaterial)
{
defaultBlend = skyboxBlenderMaterial.GetFloat("_BlendCubemaps");
defaultRotation = skyboxBlenderMaterial.GetFloat("_Rotation");
defaultSkyboxMaterial = skyboxBlenderMaterial;
InspectorAndAwakeChanges();
}
else {
else
{
Debug.LogWarning("Can't find Skybox Blend Material in resources. Please re-import!");
}
if (updateLighting || updateReflections)
if (updateLighting || updateReflections)
{
SetReflectionProbe();
UpdateLightingAndReflections(true);
@@ -104,7 +106,8 @@ public class SkyboxBlender : MonoBehaviour
void OnValidate()
{
if (skyboxBlenderMaterial == null) {
if (skyboxBlenderMaterial == null)
{
skyboxBlenderMaterial = Resources.Load("Material & Shader/Skybox Blend Material", typeof(Material)) as Material;
}
@@ -116,24 +119,26 @@ public class SkyboxBlender : MonoBehaviour
// return the material to original blend
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", defaultBlend);
skyboxBlenderMaterial.SetFloat("_Rotation", defaultRotation);
if (currentTexture != null) {
if (currentTexture != null)
{
skyboxBlenderMaterial.SetTexture("_Tex", currentTexture);
}
RenderSettings.skybox = defaultSkyboxMaterial;
}
void Update()
void Update()
{
// when in editor mode, set the skybox material in the skybox linearBlendmaterial
if (!Application.isPlaying)
if (!Application.isPlaying)
{
if (RenderSettings.skybox == null) {
if (RenderSettings.skybox == null)
{
return;
}
if (RenderSettings.skybox.HasProperty("_Tex"))
if (RenderSettings.skybox.HasProperty("_Tex"))
{
skyboxBlenderMaterial.SetTexture("_Tex", RenderSettings.skybox.GetTexture("_Tex"));
skyboxBlenderMaterial.SetColor("_Tint", RenderSettings.skybox.GetColor("_Tint"));
@@ -142,23 +147,24 @@ public class SkyboxBlender : MonoBehaviour
return;
}
if (updateReflections && !isSetReflectionProbeOnStart)
if (updateReflections && !isSetReflectionProbeOnStart)
{
if (!SetReflectionProbeTexture()) {
if (!SetReflectionProbeTexture())
{
return;
}
}
// skybox blending linearly the list
if (linearBlending && !stopped)
if (linearBlending && !stopped)
{
// set the type of the used blending
usedBlend = 1;
blendValue += Time.deltaTime * blendSpeed;
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", blendValue);
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", blendValue);
UpdateLightingAndReflections();
if (skyboxBlenderMaterial.GetFloat("_BlendCubemaps") >= totalBlendValue)
if (skyboxBlenderMaterial.GetFloat("_BlendCubemaps") >= totalBlendValue)
{
blendFinished = true;
linearBlending = false;
@@ -170,40 +176,44 @@ public class SkyboxBlender : MonoBehaviour
SetSkyBoxes(true, index, false, 0, true);
UpdateLightingAndReflections(true);
if (comingFromLoop)
if (comingFromLoop)
{
index = 0;
}
// increment index and linearBlend if not reached end
if ((index + 1) < skyboxMaterials.Count)
if ((index + 1) < skyboxMaterials.Count)
{
if (!comingFromLoop) {
if (!comingFromLoop)
{
index++;
}
comingFromLoop = false;
SetSkyBoxes(true, index);
if (index + 1 < skyboxMaterials.Count) {
SetSkyBoxes(false, 0, true, index+1);
if (index + 1 < skyboxMaterials.Count)
{
SetSkyBoxes(false, 0, true, index + 1);
}
if (index - (skyboxMaterials.Count - 1) > 0) {
if (index - (skyboxMaterials.Count - 1) > 0)
{
if (!oneTickBlend) linearBlending = true;
}
else {
else
{
if (!oneTickBlend) StartCoroutine(WaitBeforeBlending());
}
}
// if reached end and loopable
if (index >= skyboxMaterials.Count-1)
if (index >= skyboxMaterials.Count - 1)
{
if (loop)
if (loop)
{
if (oneTickBlend)
if (oneTickBlend)
{
stillRunning = false;
return;
@@ -214,15 +224,18 @@ public class SkyboxBlender : MonoBehaviour
StartCoroutine(WaitBeforeBlending());
}
else {
else
{
stillRunning = false;
if (stopRotationOnBlendFinish) {
if (stopRotationOnBlendFinish)
{
StopRotation();
}
}
}
}
else {
else
{
blendFinished = false;
}
}
@@ -233,42 +246,45 @@ public class SkyboxBlender : MonoBehaviour
blendValue += Time.deltaTime * blendSpeed;
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", blendValue);
UpdateLightingAndReflections();
if (skyboxBlenderMaterial.GetFloat("_BlendCubemaps") >= totalBlendValue)
if (skyboxBlenderMaterial.GetFloat("_BlendCubemaps") >= totalBlendValue)
{
blendFinished = true;
singleBlend = false;
blendValue = 0f;
StopAllCoroutines();
if (blendByIndex)
if (blendByIndex)
{
index = indexToBlend;
blendByIndex = false;
}
else {
else
{
if (index + 1 < skyboxMaterials.Count) index++;
else index = 0;
}
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", 0f);
SetSkyBoxes(true, index, false, 0, true);
UpdateLightingAndReflections(true);
stillRunning = false;
if (stopRotationOnBlendFinish) {
if (stopRotationOnBlendFinish)
{
StopRotation();
}
}
else {
else
{
blendFinished = false;
}
}
// blending for if the current skybox is not the same as first material
if (currentSkyboxNotFirstMaterialBlending && !stopped)
if (currentSkyboxNotFirstMaterialBlending && !stopped)
{
// set the type of the used blending
usedBlend = 2;
@@ -276,7 +292,7 @@ public class SkyboxBlender : MonoBehaviour
blendValue += Time.deltaTime * blendSpeed;
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", blendValue);
UpdateLightingAndReflections();
if (skyboxBlenderMaterial.GetFloat("_BlendCubemaps") >= totalBlendValue)
{
blendFinished = true;
@@ -284,32 +300,37 @@ public class SkyboxBlender : MonoBehaviour
blendValue = 0f;
StopAllCoroutines();
int indexForFirst = 0;
// int indexForFirst = 0;
int indexForSecond = 1;
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", 0f);
if (skyboxMaterials.Count == 1) {
if (skyboxMaterials.Count == 1)
{
indexForSecond = 0;
}
SetSkyBoxes(true, 0, true, indexForSecond, true);
UpdateLightingAndReflections(true);
if (oneTickBlend) {
if (oneTickBlend)
{
stillRunning = false;
}
else {
else
{
StartCoroutine(WaitBeforeBlending());
}
if (stopRotationOnBlendFinish && !blendingCurrentSkyToListNotSingleBlend) {
if (stopRotationOnBlendFinish && !blendingCurrentSkyToListNotSingleBlend)
{
StopRotation();
}
blendingCurrentSkyToListNotSingleBlend = false;
}
else {
else
{
blendFinished = false;
}
}
@@ -319,14 +340,18 @@ public class SkyboxBlender : MonoBehaviour
{
rotationSpeedValue += Time.deltaTime * rotationSpeed;
if (keepRotating) {
if (keepRotating)
{
skyboxBlenderMaterial.SetFloat("_Rotation", rotationSpeedValue);
}
else {
if (skyboxBlenderMaterial.GetFloat("_Rotation") < rotateToAngle) {
else
{
if (skyboxBlenderMaterial.GetFloat("_Rotation") < rotateToAngle)
{
skyboxBlenderMaterial.SetFloat("_Rotation", rotationSpeedValue);
}
else {
else
{
rotateSkybox = false;
skyboxBlenderMaterial.SetFloat("_Rotation", rotateToAngle);
}
@@ -339,21 +364,22 @@ public class SkyboxBlender : MonoBehaviour
#region SYSTEM METHODS
// set the skybox material
void SetSkyBoxes(bool firstTex = false, int firstTexIndex = 0, bool secondTex = false, int secondTexIndex = 0, bool apply = false)
void SetSkyBoxes(bool firstTex = false, int firstTexIndex = 0, bool secondTex = false, int secondTexIndex = 0, bool apply = false)
{
if (firstTex)
if (firstTex)
{
skyboxBlenderMaterial.SetTexture("_Tex", skyboxMaterials[firstTexIndex].GetTexture("_Tex"));
skyboxBlenderMaterial.SetColor("_Tint", skyboxMaterials[firstTexIndex].GetColor("_Tint"));
}
if (secondTex)
if (secondTex)
{
skyboxBlenderMaterial.SetTexture("_Tex2", skyboxMaterials[secondTexIndex].GetTexture("_Tex"));
skyboxBlenderMaterial.SetColor("_Tint2", skyboxMaterials[secondTexIndex].GetColor("_Tint"));
}
if (apply) {
if (apply)
{
RenderSettings.skybox = skyboxBlenderMaterial;
}
}
@@ -379,30 +405,32 @@ public class SkyboxBlender : MonoBehaviour
}
// change skyboxes and material textures on inspector change and script awake
public void InspectorAndAwakeChanges()
public void InspectorAndAwakeChanges()
{
if (makeFirstMaterialSkybox)
if (makeFirstMaterialSkybox)
{
if (skyboxMaterials.Count >= 1)
if (skyboxMaterials.Count >= 1)
{
if (skyboxMaterials[0] != null)
{
if (skyboxMaterials[0] != null)
{
skyboxBlenderMaterial.SetTexture("_Tex", skyboxMaterials[0].GetTexture("_Tex"));
skyboxBlenderMaterial.SetColor("_Tint", skyboxMaterials[0].GetColor("_Tint"));
RenderSettings.skybox = skyboxBlenderMaterial;
RenderSettings.skybox = skyboxBlenderMaterial;
Debug.Log("Skybox set to the first material in the list: " + skyboxMaterials[0].name);
}
}
else {
else
{
Debug.LogWarning("You need to set a material first to make it the skybox");
}
}
if (skyboxMaterials != null)
if (skyboxMaterials != null)
{
if (skyboxMaterials.Count > 1)
if (skyboxMaterials.Count > 1)
{
if (skyboxMaterials[1] != null) {
if (skyboxMaterials[1] != null)
{
skyboxBlenderMaterial.SetTexture("_Tex2", skyboxMaterials[1].GetTexture("_Tex"));
skyboxBlenderMaterial.SetColor("_Tint2", skyboxMaterials[1].GetColor("_Tint"));
}
@@ -416,7 +444,8 @@ public class SkyboxBlender : MonoBehaviour
{
reflectionProbe = GetComponent<ReflectionProbe>();
if (reflectionProbe == null) {
if (reflectionProbe == null)
{
reflectionProbe = gameObject.AddComponent<ReflectionProbe>() as ReflectionProbe;
}
@@ -425,7 +454,7 @@ public class SkyboxBlender : MonoBehaviour
reflectionProbe.mode = ReflectionProbeMode.Realtime;
reflectionProbe.timeSlicingMode = ReflectionProbeTimeSlicingMode.NoTimeSlicing;
if (updateReflections)
if (updateReflections)
{
RenderSettings.defaultReflectionMode = DefaultReflectionMode.Custom;
cubemap = new Cubemap(reflectionProbe.resolution, reflectionProbe.hdr ? TextureFormat.RGBAHalf : TextureFormat.RGBA32, true);
@@ -433,38 +462,41 @@ public class SkyboxBlender : MonoBehaviour
}
// update the lighting and reflections of the world
void UpdateLightingAndReflections(bool forceUpdate=false)
void UpdateLightingAndReflections(bool forceUpdate = false)
{
// exit if both options are off
if (!updateReflections && !updateLighting)
if (!updateReflections && !updateLighting)
{
LightAndReflectionFrames = 0;
return;
}
if (!forceUpdate)
if (!forceUpdate)
{
// run every set frames for performance
if (LightAndReflectionFrames < updateEveryFrames) {
if (LightAndReflectionFrames < updateEveryFrames)
{
LightAndReflectionFrames++;
return;
}
}
// update the lighting if set
if (updateLighting) {
if (updateLighting)
{
DynamicGI.UpdateEnvironment();
}
// if update reflections is off then exit the function
if (!updateReflections) {
if (!updateReflections)
{
return;
}
LightAndReflectionFrames = 0;
reflectionProbe.RenderProbe();
if (reflectionProbe.texture != null)
if (reflectionProbe.texture != null)
{
Graphics.CopyTexture(reflectionProbe.texture, cubemap as Texture);
RenderSettings.customReflection = cubemap;
@@ -474,12 +506,13 @@ public class SkyboxBlender : MonoBehaviour
bool SetReflectionProbeTexture()
{
if (!isSetReflectionProbeOnStart)
if (!isSetReflectionProbeOnStart)
{
SetReflectionProbe();
UpdateLightingAndReflections(true);
if (reflectionProbe.texture != null) {
if (reflectionProbe.texture != null)
{
isSetReflectionProbeOnStart = true;
}
}
@@ -493,35 +526,41 @@ public class SkyboxBlender : MonoBehaviour
// trigger the skybox blend
public void Blend(bool singlePassBlend = false, bool rotate = true)
{
if (currentSkyboxNotFirstMaterialBlending && !stopped) {
{
if (currentSkyboxNotFirstMaterialBlending && !stopped)
{
return;
}
if (isLinearBlend && !stopped) {
if (isLinearBlend && !stopped)
{
return;
}
if (rotate) {
if (rotate)
{
rotateSkybox = true;
stopRotation = false;
}
if ((stopped || stillRunning) && !singlePassBlend) {
if ((stopped || stillRunning) && !singlePassBlend)
{
stopped = false;
if (blendFinished) {
if ((usedBlend == 1 || usedBlend == 2) && !stillRunning) {
if (blendFinished)
{
if ((usedBlend == 1 || usedBlend == 2) && !stillRunning)
{
StartCoroutine(WaitBeforeBlending());
return;
}
}
}
stopped = false;
blendByIndex = false;
@@ -529,25 +568,32 @@ public class SkyboxBlender : MonoBehaviour
currentTexture = RenderSettings.skybox.GetTexture("_Tex");
if (blendValue > 0) {
if (blendValue > 0)
{
oneTickBlend = singlePassBlend;
return;
}
if (singlePassBlend) {
if (index == 0 && currentTexture != skyboxMaterials[0].GetTexture("_Tex")) {
if (singlePassBlend)
{
if (index == 0 && currentTexture != skyboxMaterials[0].GetTexture("_Tex"))
{
PrepareMaterialForBlend(0);
currentSkyboxNotFirstMaterialBlending = true;
}
else {
else
{
int indexToTransition = index;
if (!stopped) {
if (index >= skyboxMaterials.Count - 1) {
if (!stopped)
{
if (index >= skyboxMaterials.Count - 1)
{
indexToTransition = 0;
}
else {
else
{
indexToTransition++;
}
}
@@ -555,24 +601,31 @@ public class SkyboxBlender : MonoBehaviour
PrepareMaterialForBlend(indexToTransition);
singleBlend = true;
}
RenderSettings.skybox = skyboxBlenderMaterial;
stillRunning = true;
}
else {
else
{
// if only one element then linear blend from current scene skybox to the first material
if (skyboxMaterials.Count == 1) {
if (currentTexture != skyboxMaterials[0].GetTexture("_Tex")) {
if (skyboxMaterials.Count == 1)
{
if (currentTexture != skyboxMaterials[0].GetTexture("_Tex"))
{
PrepareMaterialForBlend(0);
RenderSettings.skybox = skyboxBlenderMaterial;
}
}
else {
if (index == 0 && skyboxMaterials[0] != null) {
if (currentTexture == skyboxMaterials[0].GetTexture("_Tex")) {
else
{
if (index == 0 && skyboxMaterials[0] != null)
{
if (currentTexture == skyboxMaterials[0].GetTexture("_Tex"))
{
SetSkyBoxes(true, 0, false, 0, true);
}
else {
else
{
SetSkyBoxes(false, 0, true, 0, true);
currentSkyboxNotFirstMaterialBlending = true;
@@ -583,20 +636,23 @@ public class SkyboxBlender : MonoBehaviour
// is this the last material
if (index >= skyboxMaterials.Count - 1) {
if (index >= skyboxMaterials.Count - 1)
{
comingFromLoop = true;
}
// if the rotate parameter passed
if (rotate) {
if (rotate)
{
rotateSkybox = true;
stopRotation = false;
}
// flag some vars to start the blending in Update
if (!currentSkyboxNotFirstMaterialBlending) {
if (!currentSkyboxNotFirstMaterialBlending)
{
linearBlending = true;
stillRunning = true;
@@ -612,40 +668,44 @@ public class SkyboxBlender : MonoBehaviour
}
// call using material index
public void Blend(int skyboxIndex, bool rotate = true)
public void Blend(int skyboxIndex, bool rotate = true)
{
stopped = false;
if (stillRunning) return;
if (index == skyboxIndex) {
if (index == skyboxIndex)
{
Debug.Log("Skybox material already set on the one you're trying to call.");
return;
}
if (skyboxIndex > skyboxMaterials.Count - 1) {
if (skyboxIndex > skyboxMaterials.Count - 1)
{
Debug.Log("The passed index is bigger than the Count of the skybox materials list.");
return;
}
if (skyboxIndex < 0) {
if (skyboxIndex < 0)
{
skyboxIndex = skyboxMaterials.Count - 1;
}
if (skyboxMaterials[skyboxIndex] == null) {
if (skyboxMaterials[skyboxIndex] == null)
{
Debug.Log("There is no material in the list with the passed index.");
return;
}
StopAllCoroutines();
currentTexture = RenderSettings.skybox.GetTexture("_Tex");
blendByIndex = true;
indexToBlend = skyboxIndex;
@@ -655,9 +715,10 @@ public class SkyboxBlender : MonoBehaviour
RenderSettings.skybox = skyboxBlenderMaterial;
if (rotate) {
if (rotate)
{
rotateSkybox = true;
stopRotation = false;
}
@@ -686,34 +747,38 @@ public class SkyboxBlender : MonoBehaviour
skyboxBlenderMaterial.SetFloat("_BlendCubemaps", 0f);
SetSkyBoxes(true, index, false, 0, true);
UpdateLightingAndReflections(true);
}
// stop the blending
public void Stop(bool stopRot=true)
public void Stop(bool stopRot = true)
{
stopped = true;
StopAllCoroutines();
if (stopRot && rotateSkybox) {
if (stopRot && rotateSkybox)
{
stopRotation = true;
}
}
// resume the blending
public void Resume(bool resumeRot=true)
public void Resume(bool resumeRot = true)
{
stopped = false;
if (resumeRot) {
if (resumeRot)
{
stopRotation = false;
}
if (usedBlend == 1 || usedBlend == 2) {
if (blendFinished) {
if (usedBlend == 1 || usedBlend == 2)
{
if (blendFinished)
{
StartCoroutine(WaitBeforeBlending());
}
}
@@ -722,11 +787,13 @@ public class SkyboxBlender : MonoBehaviour
// check if blending is in process
public bool IsBlending()
{
if (stopped) {
if (stopped)
{
return false;
}
if (linearBlending|| singleBlend || currentSkyboxNotFirstMaterialBlending) {
if (linearBlending || singleBlend || currentSkyboxNotFirstMaterialBlending)
{
return true;
}

View File

@@ -728,8 +728,8 @@
"animatedFloatList" : [
{
"startValue" : 0,
"endValue" : 0,
"startTime" : 2,
"endValue" : 360,
"startTime" : 0,
"endTime" : 2.5,
"animationCurveType" : 0
},{
@@ -879,24 +879,6 @@
"attachedElementGuid" : {
"value" : "155543d6-e13f-4c5a-8afc-adbd35893edd"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackRendererSubmoduleAutoOrient_BM,Assembly-CSharp",
"materialThemeBundleName" : "basic",
"materialName" : "Basic_Track_Segments",
"enableEmission" : false,
"emissionIntensity" : 1,
"zWrite" : false,
"uvScale" : {
"x" : 1,
"y" : 1
},
"uvOffset" : {
"x" : 1,
"y" : 1
},
"attachedElementGuid" : {
"value" : "155543d6-e13f-4c5a-8afc-adbd35893edd"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
@@ -1878,379 +1860,6 @@
"attachedElementGuid" : {
"value" : "7e1f2e2d-1e13-4ad9-b14f-1cca01476469"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.Trail_BM,Assembly-CSharp",
"visibleTimeLength" : 1,
"renderMaterialName" : null,
"materialThemeBundleName" : "",
"materialName" : "",
"isAutoOrient" : true,
"widthMultiplier" : 1,
"widthCurve" : {
"keys" : [
{
"time" : 0,
"value" : 1,
"inTangent" : 0,
"outTangent" : 0
},{
"time" : 1,
"value" : 1,
"inTangent" : 0,
"outTangent" : 0
}
],
"preWrapMode" : 8,
"postWrapMode" : 8
},
"gradient" : {
"colorKeys" : [
{
"color" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"time" : 0
},{
"color" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"time" : 1
}
],
"alphaKeys" : [
{
"alpha" : 1,
"time" : 0
},{
"alpha" : 1,
"time" : 1
}
],
"mode" : 0
},
"elementName" : "New Trail",
"tags" : [
],
"elementGuid" : {
"value" : "13d598ef-f99c-4b31-ad12-8e94913e2f65"
},
"attachedElementGuid" : {
"value" : "b244693f-7163-45dd-80fa-e87a9cc0a1e4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 1,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "13d598ef-f99c-4b31-ad12-8e94913e2f65"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ElementFolder_BM,Assembly-CSharp",
"elementName" : "New Folder",
"tags" : [
],
"elementGuid" : {
"value" : "c3558156-a8b1-413b-9494-be49fdcab8de"
},
"attachedElementGuid" : {
"value" : "00000000-0000-0000-0000-000000000000"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "c3558156-a8b1-413b-9494-be49fdcab8de"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "c3558156-a8b1-413b-9494-be49fdcab8de"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.Track_BM,Assembly-CSharp",
"elementName" : "New Track",
"tags" : [
],
"elementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
},
"attachedElementGuid" : {
"value" : "c3558156-a8b1-413b-9494-be49fdcab8de"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackPathSubmodule_BM,Assembly-CSharp",
"trackSpaceType" : 0,
"trackSamplingType" : 0,
"isClosed" : false,
"isShowingDisplay" : false,
"attachedElementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TrackRendererSubmoduleAutoOrient_BM,Assembly-CSharp",
"materialThemeBundleName" : "basic",
"materialName" : "Basic_Track_Segments",
"enableEmission" : false,
"emissionIntensity" : 0,
"zWrite" : true,
"uvScale" : {
"x" : 1,
"y" : 5.5
},
"uvOffset" : {
"x" : 0,
"y" : 0
},
"attachedElementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
"elementName" : "New Path Node",
"tags" : [
],
"elementGuid" : {
"value" : "0b8e6106-3f73-4f30-ab43-cef25698c88c"
},
"attachedElementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "0b8e6106-3f73-4f30-ab43-cef25698c88c"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "0b8e6106-3f73-4f30-ab43-cef25698c88c"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
"originalBaseColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionEnabled" : false,
"originalEmissionColor" : {
"r" : 0,
"g" : 0,
"b" : 0,
"a" : 1
},
"originalEmissionIntensity" : 0,
"attachedElementGuid" : {
"value" : "0b8e6106-3f73-4f30-ab43-cef25698c88c"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
"elementName" : "New Path Node",
"tags" : [
],
"elementGuid" : {
"value" : "6160857d-7559-4a30-b51a-bdcb8a3cb226"
},
"attachedElementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 45,
"y" : 0,
"z" : 23
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "6160857d-7559-4a30-b51a-bdcb8a3cb226"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "6160857d-7559-4a30-b51a-bdcb8a3cb226"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
"originalBaseColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionEnabled" : false,
"originalEmissionColor" : {
"r" : 0,
"g" : 0,
"b" : 0,
"a" : 1
},
"originalEmissionIntensity" : 0,
"attachedElementGuid" : {
"value" : "6160857d-7559-4a30-b51a-bdcb8a3cb226"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.PathNode_BM,Assembly-CSharp",
"isShowingSphere" : true,
"elementName" : "New Path Node",
"tags" : [
],
"elementGuid" : {
"value" : "53736ab1-1a61-4434-9afe-f78848f8dc5c"
},
"attachedElementGuid" : {
"value" : "0665cd1e-d8ec-4da5-8421-093769bb70a4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 90,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "53736ab1-1a61-4434-9afe-f78848f8dc5c"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "53736ab1-1a61-4434-9afe-f78848f8dc5c"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ColorSubmodule_BM,Assembly-CSharp",
"originalBaseColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionEnabled" : false,
"originalEmissionColor" : {
"r" : 0,
"g" : 0,
"b" : 0,
"a" : 1
},
"originalEmissionIntensity" : 0,
"attachedElementGuid" : {
"value" : "53736ab1-1a61-4434-9afe-f78848f8dc5c"
}
}
],
"attachedElementGuid" : {

View File

@@ -35728,7 +35728,7 @@
],
"elementGuid" : {
"value" : "89360236-9f66-4b73-b581-f55f9ddfdb74"
"value" : "3b491f74-604d-49e8-a52c-763f7e1f8534"
},
"attachedElementGuid" : {
"value" : "ff8926ef-e06e-4f85-837f-2b3948290d18"
@@ -35751,7 +35751,7 @@
"z" : 1
},
"attachedElementGuid" : {
"value" : "89360236-9f66-4b73-b581-f55f9ddfdb74"
"value" : "3b491f74-604d-49e8-a52c-763f7e1f8534"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.EffectSubmodule_BM,Assembly-CSharp",
@@ -35791,7 +35791,7 @@
]
},
"attachedElementGuid" : {
"value" : "89360236-9f66-4b73-b581-f55f9ddfdb74"
"value" : "3b491f74-604d-49e8-a52c-763f7e1f8534"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.Tap_BM,Assembly-CSharp",
@@ -46176,7 +46176,7 @@
],
"elementGuid" : {
"value" : "4d309171-2527-438a-a8a0-ecea6d8d122f"
"value" : "f9ac9b57-2551-4f59-b84d-e0f468744952"
},
"attachedElementGuid" : {
"value" : "ff8926ef-e06e-4f85-837f-2b3948290d18"
@@ -46199,7 +46199,7 @@
"z" : 1
},
"attachedElementGuid" : {
"value" : "4d309171-2527-438a-a8a0-ecea6d8d122f"
"value" : "f9ac9b57-2551-4f59-b84d-e0f468744952"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.EffectSubmodule_BM,Assembly-CSharp",
@@ -46269,7 +46269,7 @@
]
},
"attachedElementGuid" : {
"value" : "4d309171-2527-438a-a8a0-ecea6d8d122f"
"value" : "f9ac9b57-2551-4f59-b84d-e0f468744952"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ElementFolder_BM,Assembly-CSharp",
@@ -55265,7 +55265,7 @@
],
"elementGuid" : {
"value" : "8045d2cb-14a0-49d5-88cd-c860ff73b6c6"
"value" : "264c8cd5-a36a-4804-ac72-f23da1790e78"
},
"attachedElementGuid" : {
"value" : "ff8926ef-e06e-4f85-837f-2b3948290d18"
@@ -55288,7 +55288,7 @@
"z" : 1
},
"attachedElementGuid" : {
"value" : "8045d2cb-14a0-49d5-88cd-c860ff73b6c6"
"value" : "264c8cd5-a36a-4804-ac72-f23da1790e78"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.EffectSubmodule_BM,Assembly-CSharp",
@@ -55328,7 +55328,7 @@
]
},
"attachedElementGuid" : {
"value" : "8045d2cb-14a0-49d5-88cd-c860ff73b6c6"
"value" : "264c8cd5-a36a-4804-ac72-f23da1790e78"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.ElementFolder_BM,Assembly-CSharp",

View File

@@ -1,38 +1,128 @@
# Console概要
# 更新版 Console 文档
## Console概要
Editor内有console系统用于执行某些方便的操作。
在编辑界面内按 **`** esc下面可以唤出console输入框在其中输入完成后按enter键即可尝试执行框内的指令。
在编辑界面内按 **`** Esc键下方可以唤出console输入框输入完成后按Enter键执行指令。
输入框配有上下文,在输入时按上下箭头可以跳转到上一次的指令。
输入框支持上下文历史记录,按上下箭头可浏览历史指令。
输入格式按照 **func "abc123" 1 2 [0,1,2]** 的格式输入,也可以用**func(1,2,3,"a",[1,2,3])**输入,其中值大多是数字值,如果是字符的话,需要带上双引号(`"abc123"`如果是向量vector23就需要用中括号括起来(` [0,0,1] `)。
输入格式
- **func "abc123" 1 2 [0,1,2]**
- 或 **func(1,2,3,"a",[1,2,3])**
- 字符串需双引号包裹(`"abc123"`
- 向量需中括号包裹(`[0,0,1]`
如果因为某种原因而导致指令执行失败的话会在下面的log window有提醒
执行失败时会在Log Window显示错误信息。部分指令依赖Inspector窗口当前选中对象请提前选择目标对象
有一些指令是依托于右边的inspector窗口来获取物体的所以在执行操作前注意选中要执行的物体。
---
## 命令列表
(格式:命令名字 值1 值2 …值x
### 基础操作
```csharp
tp(Vector3 pos)
将场景相机移动到指定的三维坐标 pos。
```
- 将场景相机移动到指定坐标
- 示例:`tp [10,5,0]`
```csharp
tp()
将场景相机移动到当前 Inspector 选中元素的位置。
```
- 将场景相机移动到当前选中对象的位置
- 需在Inspector中选中对象
reName(string message)
将当前 Inspector 选中元素的名称改为 message
```csharp
ReName(string message)
```
- 重命名当前选中对象
- 示例:`ReName "NewTrackName"`
lgp(int loop, Vector3 start, Vector3 end)
在选中的 Track 上,按线性插值方式批量生成 loop 个 PathNode起止点为 start 和 end。
### 路径生成
```csharp
Lgp(int loop, Vector3 start, Vector3 end)
```
- 在选中的Track上生成线性路径节点
- 参数:
- `loop`:生成节点数量
- `start`:起始坐标
- `end`:结束坐标
- 示例:`Lgp 10 [0,0,0] [5,0,5]`
spiral(int loop, Vector3 center, float r, float h, int pointsPerTurn, string axis = "y")
在选中的 Track 上按指定主轴x/y/z和参数批量生成螺旋线分布的 PathNode。
```csharp
Spiral(int loop, Vector3 center, float r, float h, int pointsPerTurn, string axis = "y")
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"`
spiral(int loop, Vector3 center, float r, float h, int pointsPerTurn, Vector3 dir)
在选中的 Track 上按任意方向dir 向量)和参数,批量生成螺旋线分布的 PathNode。
### 数据处理
```csharp
SamplerImport(string inputData)
```
- 导入采样器格式的音符数据
- 数据格式:`(动作类型, 轨道ID, 时间戳, X值, [Hold持续时间])`
- 支持动作类型Tap, Stay, Hold, Flick
- 示例:`SamplerImport "(Tap, Track1, 12.5, 3.2)"`
### 音符操作
```csharp
SetNoteHLInGame(bool forceSetOff = false, bool SameTheme = false)
```
- 全局高亮重复时间点的音符
- 参数:
- `forceSetOff`:是否先关闭所有高亮
- `SameTheme`:是否要求音符类型相同
```csharp
SetNoteHLInElement(bool forceSetOff = false, bool SameTheme = false)
```
- 在当前元素内高亮重复时间点的音符
- 参数同上
```csharp
AttachNoteInNearestTrail()
```
- 将轨道上的音符吸附到最近的轨迹线
- 需选中Track对象
### 动画操作
```csharp
swapDisplacement()
```
- 反转位移动画方向(正负值互换)
- 需选中Displacement元素
```csharp
swapSwirl()
```
- 反转旋转动画方向
- 需选中Swirl元素
```csharp
swapScale()
```
- 反转缩放动画方向
- 需选中Scale元素
### 对象管理
```csharp
DelSameInParent()
```
- 删除父对象中所有同类型的兄弟元素(包括自身)
- 示例:删除当前选中类型的所有同级对象
---
## 其他
在做了
更多功能持续开发中。使用console时可参考编辑器内的自动补全提示和参数类型检查功能。