暂时存档
Timeline WindowAnim不止window能用
This commit is contained in:
265
Assets/Prefabs/DynamicUI/Timeline/TimelimeTab.prefab
Normal file
265
Assets/Prefabs/DynamicUI/Timeline/TimelimeTab.prefab
Normal 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}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b8e53d787aedce4c99c84ff45821227
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@@ -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()
|
||||
{
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Ichni.Editor
|
||||
parentElement.connectedTab.childTabList.Add(this);
|
||||
this.tabLayer = this.parentTab.tabLayer + 1;
|
||||
this.transform.SetSiblingIndex(this.parentTab.transform.GetSiblingIndex() + GetAllChildrenCount(this.parentTab));
|
||||
|
||||
|
||||
if (!this.parentTab.isExpanded)
|
||||
{
|
||||
this.isExpanded = false;
|
||||
@@ -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()
|
||||
@@ -101,7 +102,7 @@ namespace Ichni.Editor
|
||||
if (isExpanded)
|
||||
{
|
||||
expandButton.transform.Rotate(new Vector3(0, 0, 180));
|
||||
|
||||
|
||||
for (var index = 0; index < connectedGameElement.childElementList.Count; index++)
|
||||
{
|
||||
var childElement = connectedGameElement.childElementList[index];
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -47,9 +46,9 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.stringUnit;
|
||||
|
||||
|
||||
//初始化:获取当前的List<string>,并生成对应的Unit
|
||||
List<string> list = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as List<string>;
|
||||
foreach (string item in list)
|
||||
@@ -57,14 +56,14 @@ namespace Ichni.Editor
|
||||
GenerateUnit(item);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
//为添加新的Unit的按钮设置点击事件
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit("");
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
//将当前所有Unit的值应用到对应的变量中
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
@@ -86,22 +85,22 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedFloatUnit;
|
||||
|
||||
|
||||
FlexibleFloat flexibleFloat = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleFloat;
|
||||
foreach (AnimatedFloat animatedFloat in flexibleFloat.animations)
|
||||
{
|
||||
GenerateUnit(animatedFloat);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedFloat(0, 0, 0, 0, AnimationCurveType.Linear));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleFloat newFlexibleFloat = new FlexibleFloat();
|
||||
@@ -121,22 +120,22 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedIntUnit;
|
||||
|
||||
|
||||
FlexibleInt flexibleInt = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleInt;
|
||||
foreach (AnimatedInt animatedInt in flexibleInt.animations)
|
||||
{
|
||||
GenerateUnit(animatedInt);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedInt(0, 0));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleInt newFlexibleInt = new FlexibleInt();
|
||||
@@ -156,7 +155,7 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedBoolUnit;
|
||||
FlexibleBool flexibleBool = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleBool;
|
||||
foreach (AnimatedBool animatedBool in flexibleBool.animations)
|
||||
@@ -164,13 +163,13 @@ namespace Ichni.Editor
|
||||
GenerateUnit(animatedBool);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedBool(0, false));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleBool newFlexibleBool = new FlexibleBool();
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,20 +10,25 @@ namespace Ichni.Editor
|
||||
public GameElement connectedGameElement;
|
||||
public RectTransform WindowRect { get; set; }
|
||||
public List<DynamicUIContainer> Containers { get; set; }
|
||||
|
||||
|
||||
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));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -12,15 +12,15 @@ namespace Ichni.Editor
|
||||
{
|
||||
private Timeline timeline => EditorManager.instance.uiManager.timeline;
|
||||
private SongInformation songInformation => EditorManager.instance.songInformation;
|
||||
|
||||
|
||||
public GameObject timePointerPrefab;
|
||||
public List<TimePointer> timePointerList;
|
||||
|
||||
|
||||
public RectTransform timePointerArea;
|
||||
public RectTransform visibleTimePointerArea;
|
||||
|
||||
|
||||
public RectTransform mainTimePointer;
|
||||
|
||||
|
||||
public float intervalUnit;
|
||||
public float timePointerInterval;
|
||||
public float sizeNegative, sizePositive;
|
||||
@@ -29,7 +29,7 @@ namespace Ichni.Editor
|
||||
/// delay时间区间中,(-delay, 0)的距离偏移量
|
||||
/// </summary>
|
||||
public float delayDistanceOffset;
|
||||
|
||||
|
||||
public float leftSideSongTime, rightSideSongTime, songTimeDistance;
|
||||
|
||||
private void Start()
|
||||
@@ -62,20 +62,20 @@ namespace Ichni.Editor
|
||||
/// <param name="delay"></param>
|
||||
/// <param name="bpm"></param>
|
||||
public void Initialize(float delay, float bpm)
|
||||
{
|
||||
{
|
||||
timePointerInterval = 30;
|
||||
ClearPointers();
|
||||
|
||||
|
||||
int beatDivider = 1;
|
||||
|
||||
|
||||
intervalUnit = (60f / bpm) / beatDivider * 1000;
|
||||
|
||||
|
||||
sizeNegative = delay * beatDivider / timeline.timePerBeat;
|
||||
sizePositive = songInformation.song.length * beatDivider / timeline.timePerBeat;
|
||||
|
||||
|
||||
negativePointerAmount = Mathf.CeilToInt(sizeNegative);
|
||||
positivePointerAmount = Mathf.CeilToInt(sizePositive);
|
||||
|
||||
|
||||
totalPointerAmount = negativePointerAmount + positivePointerAmount;
|
||||
|
||||
timePointerArea.sizeDelta = new Vector2(timePointerInterval * (sizeNegative + sizePositive), 60f);
|
||||
@@ -90,12 +90,12 @@ namespace Ichni.Editor
|
||||
{
|
||||
CreatePointer(beatDivider, i);
|
||||
}
|
||||
|
||||
|
||||
//ChangeSongTimeDistance(0);
|
||||
SetRange(timeline.beatmapStartTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class TimePointerModule
|
||||
{
|
||||
/// <summary>
|
||||
@@ -115,7 +115,7 @@ namespace Ichni.Editor
|
||||
leftSideSongTime = startTime - songTimeDistance * proportion;
|
||||
rightSideSongTime = startTime + songTimeDistance * (1 - proportion);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成指示线
|
||||
/// </summary>
|
||||
@@ -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);
|
||||
@@ -149,7 +152,7 @@ namespace Ichni.Editor
|
||||
new Vector2((pointer.index + negativePointerAmount) * timePointerInterval + 15f - delayDistanceOffset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清楚所有指示线
|
||||
/// </summary>
|
||||
@@ -161,7 +164,7 @@ namespace Ichni.Editor
|
||||
}
|
||||
timePointerList.Clear();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 缩放时间线的展示时间宽度
|
||||
/// </summary>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
//在做了
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
23
Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs
Normal file
23
Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs
Normal 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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs.meta
Normal file
11
Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2508d5efc83bb294aa25a45eb1d2f59d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
45
Assets/Scripts/DynamicUI/WindowAnim.cs
Normal file
45
Assets/Scripts/DynamicUI/WindowAnim.cs
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/DynamicUI/WindowAnim.cs.meta
Normal file
11
Assets/Scripts/DynamicUI/WindowAnim.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4e9f7cedbb8ef246b2a3920b1ce4402
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user