TextObject
This commit is contained in:
@@ -12,7 +12,8 @@ namespace Ichni.Editor
|
||||
public class DynamicUIEnumDropdown : DynamicUIElement
|
||||
{
|
||||
public TMP_Dropdown dropdown;
|
||||
|
||||
public List<int> realValues;
|
||||
|
||||
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
base.Initialize(baseElement, title, parameterName);
|
||||
@@ -24,12 +25,13 @@ namespace Ichni.Editor
|
||||
{
|
||||
dropdown.ClearOptions();
|
||||
List<string> enumNameList = System.Enum.GetNames(enumType).ToList();
|
||||
realValues = System.Enum.GetValues(enumType).Cast<int>().ToList();
|
||||
dropdown.AddOptions(enumNameList);
|
||||
}
|
||||
|
||||
private void ApplyParameters(int value)
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, realValues[value]);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UniRx;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
@@ -12,7 +15,8 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public bool isOverridingDuration; //是否手动设置了时间区间,开启时,子物体的时间区间将被忽略,且在自动计算区间时跳过此模块
|
||||
public float startTime, endTime; //起止时间
|
||||
|
||||
public IDisposable timeObserver;
|
||||
|
||||
public TimeDurationSubmodule(GameElement attachedGameElement) : base(attachedGameElement)
|
||||
{
|
||||
isOverridingDuration = false;
|
||||
@@ -38,7 +42,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckTimeInDuration(float time, float offset = 0.2f)
|
||||
public bool CheckTimeInDuration(float time, float offset = 0.1f)
|
||||
{
|
||||
return time >= startTime - offset && time <= endTime + offset;
|
||||
}
|
||||
@@ -91,15 +95,38 @@ namespace Ichni.RhythmGame
|
||||
startTime = durations.Min(duration => duration.x);
|
||||
endTime = durations.Max(duration => duration.y);
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new TimeDurationSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TimeDurationSubmodule
|
||||
{
|
||||
public void SetUpObserver(UnityAction enableAction, UnityAction disableAction = null)
|
||||
{
|
||||
timeObserver?.Dispose();
|
||||
timeObserver = Observable.EveryUpdate().Subscribe(_ =>
|
||||
{
|
||||
float songTime = EditorManager.instance.songInformation.songTime;
|
||||
if (CheckTimeInDuration(songTime, 0f) && !attachedGameElement.gameObject.activeSelf)
|
||||
{
|
||||
attachedGameElement.gameObject.SetActive(true);
|
||||
enableAction?.Invoke();
|
||||
Debug.Log($"TimeDurationSubmodule: {attachedGameElement.elementName} is active at time {songTime}, duration: [{startTime}, {endTime}]");
|
||||
}
|
||||
else if (!CheckTimeInDuration(songTime, 0f) && attachedGameElement.gameObject.activeSelf)
|
||||
{
|
||||
attachedGameElement.gameObject.SetActive(false);
|
||||
disableAction?.Invoke();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TimeDurationSubmodule
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new TimeDurationSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Ichni.RhythmGame
|
||||
track.trackPathSubmodule.pathNodeList.Remove(this);
|
||||
track.trackPathSubmodule.SetPathPoints();
|
||||
track.Refresh();
|
||||
print("PathNode " + elementName + " destroyed.");
|
||||
//print("PathNode " + elementName + " destroyed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Profiling;
|
||||
using UnityEngine.Serialization;
|
||||
@@ -14,7 +15,6 @@ namespace Ichni.RhythmGame
|
||||
public GameObject elementFolder;
|
||||
public GameObject gameCamera;
|
||||
|
||||
|
||||
[Title("Track相关")] public GameObject track;
|
||||
public GameObject trackDisplay;
|
||||
public GameObject pathNode;
|
||||
@@ -72,8 +72,10 @@ namespace Ichni.RhythmGame
|
||||
public GameObject gradientAlphaKeyUnit;
|
||||
public GameObject stringIntPairUnit;
|
||||
|
||||
[Title("字体")] public Dictionary<string, TMP_FontAsset> fonts;
|
||||
|
||||
[Title("图形化动画编辑器")] public GameObject graphicalFlexibleFloatWindow;
|
||||
|
||||
|
||||
//采音器
|
||||
|
||||
[Title("Background相关")] public Sprite defaultBackground;
|
||||
|
||||
Reference in New Issue
Block a user