暂时存档

Timeline
WindowAnim不止window能用
This commit is contained in:
2025-02-21 15:30:14 +08:00
parent cd9ef00d13
commit 6781de4d53
14 changed files with 642 additions and 85 deletions

View File

@@ -0,0 +1,265 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1245149450732101372
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2856594644468795856}
- component: {fileID: 1654394841794307147}
- component: {fileID: 6703809492793959247}
- component: {fileID: 2457717289953408719}
m_Layer: 5
m_Name: TimelimeTab
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2856594644468795856
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1245149450732101372}
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:
- {fileID: 5024219022659495223}
- {fileID: 7453192480244305691}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 299.006, y: 25.652}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1654394841794307147
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1245149450732101372}
m_CullTransparentMesh: 1
--- !u!114 &6703809492793959247
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1245149450732101372}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.30588236}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 103ba97838400454ab58fa34c508cbbb, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &2457717289953408719
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1245149450732101372}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2508d5efc83bb294aa25a45eb1d2f59d, type: 3}
m_Name:
m_EditorClassIdentifier:
Title: {fileID: 120879144137107311}
connectedGameElement: {fileID: 0}
GelementPointer: []
--- !u!1 &1843458013635033358
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5024219022659495223}
- component: {fileID: 6088173518698648135}
- component: {fileID: 120879144137107311}
m_Layer: 5
m_Name: Title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5024219022659495223
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1843458013635033358}
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: 2856594644468795856}
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.0009784698, y: 0.000018597}
m_SizeDelta: {x: 299, y: 25.652}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6088173518698648135
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1843458013635033358}
m_CullTransparentMesh: 1
--- !u!114 &120879144137107311
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1843458013635033358}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 3944eaaf70beffa4097d8c293604125e, type: 2}
m_sharedMaterial: {fileID: 7159369417392969216, guid: 3944eaaf70beffa4097d8c293604125e,
type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 14.2
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 1
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &4420271929815980515
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7453192480244305691}
m_Layer: 5
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7453192480244305691
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4420271929815980515}
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: 2856594644468795856}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 1046.8994, y: 0.0000076293945}
m_SizeDelta: {x: 1494.721, y: 25.652}
m_Pivot: {x: 0.5, y: 0.5}

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -47,6 +47,13 @@ namespace Ichni.Editor
}catch(Exception e){Debug.LogWarning("WTF Command! "+e);}
}
private void Update(){
UIscale();
if(InputCommand.isFocused)InputDect();
}
private void UIscale(){
if(Keyboard.current.backquoteKey.wasPressedThisFrame){
ConsoleUI.SetActive(isHide);
@@ -65,8 +72,10 @@ namespace Ichni.Editor
}
}
if(InputCommand.isFocused){
if(Keyboard.current.downArrowKey.wasPressedThisFrame){
}
private void InputDect(){
if(Keyboard.current.downArrowKey.wasPressedThisFrame){
if(historyCommand.Count-1>historycount){
historycount++;
InputCommand.text=historyCommand[historycount];}
@@ -80,12 +89,8 @@ namespace Ichni.Editor
historycount--;
InputCommand.text=historyCommand[historycount];
}
}
}
private void Start()
{

View File

@@ -91,6 +91,7 @@ namespace Ichni.Editor
{
EditorManager.instance.operationManager.SelectElement(connectedGameElement);
EditorManager.instance.uiManager.inspector.SetInspector(connectedGameElement);
EditorManager.instance.timeline.SetTimeLine(connectedGameElement);
}
private void ExpandOrFold()
@@ -123,9 +124,9 @@ namespace Ichni.Editor
{
if (!expand && isExpanded)
{
for(int i=childTabList.Count;i>0;i--)
for (int i = childTabList.Count; i > 0; i--)
{
childTabList[i-1].SetExpansion(expand); //false
childTabList[i - 1].SetExpansion(expand); //false
}
}

View File

@@ -18,15 +18,14 @@ namespace Ichni.Editor
public void Initialize(IBaseElement baseElement, string title, string parameterName)
{
transform.localScale = Vector3.zero;
this.connectedBaseElement = baseElement;
this.parameterName = parameterName;
this.title.text = title;
unitList = new List<DynamicUICompositeUnit>();
closeButton.onClick.AddListener(() =>
{
ApplyParameters();
Destroy(gameObject);
});
closeButton.onClick.AddListener(Quit);
StartCoroutine(WindowAnim.ShowPanel(gameObject));
}
public void RemoveUnit(DynamicUICompositeUnit unit)
@@ -181,5 +180,12 @@ namespace Ichni.Editor
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, newFlexibleBool);
};
}
public void Quit()
{
ApplyParameters();
//StartCoroutine(WindowAnim.HidePanel(gameObject, true));
Destroy(gameObject);
}
}
}

View File

@@ -13,15 +13,20 @@ namespace Ichni.Editor
public void Initialize(GameElement gameElement, string title)
{
StartCoroutine(WindowAnim.ShowPanel(gameObject));
WindowRect = windowRect;
Containers = new List<DynamicUIContainer>();
connectedGameElement = gameElement;
this.title.text = title;
closeButton.onClick.AddListener(() =>
{
Destroy(gameObject);
});
closeButton.onClick.AddListener(Quit);
}
public void Quit()
{
Destroy(gameObject);
//StartCoroutine(WindowAnim.HidePanel(gameObject, true));
}
}

View File

@@ -132,13 +132,16 @@ namespace Ichni.Editor
pointer.time = index * intervalUnit / 1000f;
pointer.intervalUnitText.text = Mathf.RoundToInt(index * intervalUnit).ToString();
if (beatDivider > 1)
{
}
}
/// <summary>
/// 更新指示线位置
/// </summary>
private void UpdatePointers()
public void UpdatePointers()
{
delayDistanceOffset = timePointerInterval * (negativePointerAmount - sizeNegative);
timePointerArea.sizeDelta = new Vector2(timePointerInterval * totalPointerAmount, 55f);

View File

@@ -1,18 +1,119 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.RhythmGame;
using Sirenix.Utilities;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
namespace Ichni.Editor
{
public class Timeline : MonoBehaviour
public partial class Timeline : MonoBehaviour
{
public float songTime => EditorManager.instance.songInformation.songTime;
public float songBeat => EditorManager.instance.songInformation.songBeat;
public float beatmapStartTime => -EditorManager.instance.songInformation.delay;
public float timePerBeat => 60f / EditorManager.instance.songInformation.bpm;
public GameObject timelineTabRect;
public TimePointerModule timePointerModule;
public MusicPlayer musicPlayer;
public TMP_InputField TimeField;
public TMP_InputField BeatField;
public RectTransform GetinputArea;
public void Update()
{
if (musicPlayer.isPlaying) UpdateTime();
if (RectTransformUtility.RectangleContainsScreenPoint(GetinputArea, Mouse.current.position.ReadValue()))
{
DetectSetRange();
}
}
private void DetectSetRange()
{
if (Mouse.current.scroll.ReadValue().y != 0)
{
if (Keyboard.current.leftCtrlKey.isPressed || Keyboard.current.rightCtrlKey.isPressed)
{
float scrollValue = Mouse.current.scroll.ReadValue().y / 12;
if (timePointerModule.timePointerInterval + scrollValue >= 30)
{
timePointerModule.timePointerInterval += scrollValue;
timePointerModule.UpdatePointers();
timePointerModule.SetRange(songTime);
}
}
else
{
if (Mouse.current.scroll.ReadValue().y >= 0)
{
SetTime((EditorManager.instance.songInformation.songTime + timePerBeat).ToString());
}
else
{
if (EditorManager.instance.songInformation.songTime - timePerBeat >= 0)
SetTime((EditorManager.instance.songInformation.songTime - timePerBeat).ToString());
else
SetTime("0");
}
UpdateTime();
}
}
}
private void UpdateTime()
{
TimeField.text = songTime.ToString("F2");
BeatField.text = songBeat.ToString("F2");
}
public void SetTime(string time)
{
musicPlayer.PauseMusic();
musicPlayer.audioSource.time = float.Parse(time);
EditorManager.instance.songInformation.songTime = float.Parse(time);
timePointerModule.UpdatePointers();
timePointerModule.SetRange(songTime);
}
public void SetBeat(string beat)
{
musicPlayer.PauseMusic();
musicPlayer.audioSource.time = float.Parse(beat) * timePerBeat;
EditorManager.instance.songInformation.songTime = float.Parse(beat) * timePerBeat;
timePointerModule.UpdatePointers();
timePointerModule.SetRange(songTime);
}
}
public partial class Timeline
{
public TimelineTab timelineTabPrefab;
public Dictionary<Type, TimelineTab> timelineTabList = new Dictionary<Type, TimelineTab>();
public void SetTimeLine(GameElement element)
{
//在做了
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame;
using TMPro;
using UnityEngine;
public class TimelineTab : MonoBehaviour
{
public TMP_Text Title;
public GameElement connectedGameElement;
public List<GameElement> GelementPointer;
public void SetTab(GameElement element, Type DisplayType)
{
connectedGameElement = element;
Title.text = DisplayType.ToString();
foreach (var i in element.childElementList) if (i.GetType() == DisplayType) GelementPointer.Add(i);
}
public void AddElement(GameElement gameElement)
{
}
}

View File

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

View File

@@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class WindowAnim
{
public static IEnumerator ShowPanel(GameObject gameObject)
{
AnimationCurve animationCurve = new AnimationCurve(
new Keyframe(0, 0),
new Keyframe(0.25f, 0.55f),
new Keyframe(0.5f, 0.85f),
new Keyframe(0.75f, 0.97f),
new Keyframe(1, 1)
);
float timer = 0;
while (timer <= 1)
{
gameObject.transform.localScale = Vector3.one * animationCurve.Evaluate(timer);
timer += Time.deltaTime * 5f;
yield return null;
}
gameObject.transform.localScale = Vector3.one;
}
public static IEnumerator HidePanel(GameObject gameObject, bool DestoryOrNot = false)
{
AnimationCurve animationCurve = new AnimationCurve(
new Keyframe(0, 0),
new Keyframe(0.25f, 0.55f),
new Keyframe(0.5f, 0.85f),
new Keyframe(0.75f, 0.97f),
new Keyframe(1, 1)
);
float timer = 1;
while (timer >= 0)
{
gameObject.transform.localScale = Vector3.one * animationCurve.Evaluate(timer);
timer += Time.deltaTime * 5f;
yield return null;
}
gameObject.transform.localScale = Vector3.zero;
}
}

View File

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

View File

@@ -20,7 +20,7 @@ namespace Ichni
public OperationManager operationManager;
public BackgroundController backgroundController;
public CameraManager cameraManager;
public Timeline timeline;
public ProjectInformation projectInformation;
public SongInformation songInformation;
public BeatmapContainer beatmapContainer;