尝试优化Inspector的排版
在输数字的地方输入框的输入限制可以改成十进制数,这样就不会因为输了字母然后报错了
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
@@ -9,9 +10,23 @@ namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIContainer : MonoBehaviour
|
||||
{
|
||||
|
||||
Inspector Inspector => EditorManager.instance.uiManager.inspector;
|
||||
public TMP_Text title;
|
||||
public GridLayoutGroup gridLayoutGroup;
|
||||
public List<DynamicUIElement> dynamicUIElements = new List<DynamicUIElement>();
|
||||
[FormerlySerializedAs("container")] public RectTransform rect;
|
||||
|
||||
public void SetDeviver(int num){//rect 500
|
||||
gridLayoutGroup.cellSize=new Vector2(Inspector.inspectorRect.rect.width/num,gridLayoutGroup.cellSize.y);
|
||||
|
||||
bool CanCompress=true;//这是是想着如果没有按钮以外的东西就把y值调小一点的
|
||||
|
||||
foreach(var i in GetComponentsInChildren<DynamicUIElement>()){
|
||||
i.DeviverSet(num);
|
||||
if(i.GetType()!=typeof(DynamicUIButton))CanCompress=false;
|
||||
}
|
||||
if(CanCompress)gridLayoutGroup.cellSize=new Vector2(gridLayoutGroup.cellSize.x,gridLayoutGroup.cellSize.y/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
@@ -24,6 +26,7 @@ namespace Ichni.Editor
|
||||
|
||||
public virtual void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
|
||||
this.connectedBaseElement = baseElement;
|
||||
this.parameterName = parameterName;
|
||||
if (title != string.Empty)
|
||||
@@ -34,8 +37,23 @@ namespace Ichni.Editor
|
||||
{
|
||||
this.title.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void DeviverSet(int DeviveNum){
|
||||
float o=2f/DeviveNum;//因为所有的单UI都是根据2栏来的
|
||||
Button[] childb=GetComponentsInChildren<Button>();
|
||||
TMP_Text[] childt=GetComponentsInChildren<TMP_Text>();
|
||||
foreach (var i in childb){
|
||||
RectTransform rectTransform = i.GetComponent<RectTransform>();
|
||||
rectTransform.sizeDelta=new Vector2(rectTransform.sizeDelta.x*o,rectTransform.sizeDelta.y);
|
||||
}
|
||||
foreach (var i in childt){
|
||||
RectTransform rectTransform = i.GetComponent<RectTransform>();
|
||||
rectTransform.sizeDelta=new Vector2(rectTransform.sizeDelta.x*o,rectTransform.sizeDelta.y);
|
||||
}
|
||||
}
|
||||
|
||||
//public abstract void ApplyParameters();
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace Ichni.Editor
|
||||
public TMP_InputField inputFieldEmissionI;
|
||||
public Image colorPreview;
|
||||
|
||||
public new void Initialize(IBaseElement baseElement, string title,
|
||||
public void Initialize(IBaseElement baseElement, string title,
|
||||
string emissionEnabledName, string colorParameterName, string emissionIntensityName)
|
||||
{
|
||||
base.Initialize(baseElement, title, colorParameterName);
|
||||
|
||||
@@ -28,7 +28,9 @@ namespace Ichni.Editor
|
||||
inputFieldY.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
inputFieldZ.onEndEdit.AddListener(_ => ApplyParameters());
|
||||
}
|
||||
|
||||
public override void DeviverSet(int i){
|
||||
//我什么也不做
|
||||
}
|
||||
private void ApplyParameters()
|
||||
{
|
||||
Vector3 newValue = new Vector3(float.Parse(inputFieldX.text), float.Parse(inputFieldY.text), float.Parse(inputFieldZ.text));
|
||||
|
||||
@@ -26,10 +26,11 @@ namespace Ichni.Editor
|
||||
|
||||
public void PlayMusic()
|
||||
{
|
||||
isPlaying = true;
|
||||
isPlaying = !isPlaying;
|
||||
Trail.SetAllTrails(true, false);
|
||||
EditorManager.instance.songInformation.songTime = audioSource.time;
|
||||
audioSource.Play();
|
||||
if( isPlaying)audioSource.Play();
|
||||
else audioSource.Pause();
|
||||
}
|
||||
|
||||
public void PauseMusic()
|
||||
|
||||
@@ -14,4 +14,5 @@ namespace Ichni.Editor
|
||||
public TimePointerModule timePointerModule;
|
||||
public MusicPlayer musicPlayer;
|
||||
}
|
||||
|
||||
}
|
||||
8
Assets/Scripts/DynamicUI/Timeline/TimelineElement.meta
Normal file
8
Assets/Scripts/DynamicUI/Timeline/TimelineElement.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6eb61dffe3843041b021e96e9c7cb0b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user