加加加加
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -14,7 +15,7 @@ namespace Ichni.Editor
|
||||
public RectTransform tabContainer;
|
||||
public Button addFolderButton;
|
||||
public List<HierarchyTab> tabList;
|
||||
|
||||
public Button expandButtom;
|
||||
private void Awake()
|
||||
{
|
||||
tabList = new List<HierarchyTab>();
|
||||
@@ -22,6 +23,8 @@ namespace Ichni.Editor
|
||||
{
|
||||
ElementFolder.GenerateElement("New Folder", Guid.NewGuid(), new List<string>(), true, null);
|
||||
});
|
||||
expandButtom.onClick.AddListener(Expand);
|
||||
rectTransform = this.GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
public HierarchyTab GenerateTab(GameElement targetElement, GameElement parentElement)
|
||||
@@ -31,6 +34,48 @@ namespace Ichni.Editor
|
||||
tabList.Add(tab);
|
||||
return tab;
|
||||
}
|
||||
public bool isExpand = false;
|
||||
private RectTransform rectTransform;
|
||||
public void Expand()
|
||||
{
|
||||
float originX = 225f;
|
||||
isExpand = !isExpand;
|
||||
// 用DOTween动画赋值
|
||||
if (isExpand)
|
||||
{
|
||||
rectTransform.DOSizeDelta(
|
||||
new Vector2(rectTransform.sizeDelta.x * 2, rectTransform.sizeDelta.y), 0.5f);
|
||||
rectTransform.DOAnchorPos(
|
||||
new Vector2(originX * 2, rectTransform.anchoredPosition.y), 0.5f);
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.x * 3,
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
expandButtom.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.x * 2,
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTransform.DOSizeDelta(
|
||||
new Vector2(rectTransform.sizeDelta.x / 2, rectTransform.sizeDelta.y), 0.5f);
|
||||
rectTransform.DOAnchorPos(
|
||||
new Vector2(originX, rectTransform.anchoredPosition.y), 0.5f);
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.x / 3,
|
||||
enableButtonGroup.disableButton.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
expandButtom.GetComponent<RectTransform>().DOAnchorPos(
|
||||
new Vector2(
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.x / 2,
|
||||
expandButtom.GetComponent<RectTransform>().anchoredPosition.y
|
||||
), 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public ScrollRect scrollRect;
|
||||
public Vector2 vector2;
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Ichni.Editor
|
||||
}
|
||||
public void SetStatus()
|
||||
{
|
||||
//expandButton.interactable = !connectedGameElement.childElementList.IsNullOrEmpty();
|
||||
expandButton.gameObject.SetActive(!connectedGameElement.childElementList.IsNullOrEmpty());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,11 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public FlexibleInt trackSwitch;
|
||||
public FlexibleFloat trackPercent;
|
||||
|
||||
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
public bool MotionAngles = false;
|
||||
|
||||
public static CrossTrackPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, ElementFolder elementFolder, FlexibleInt trackSwitch, FlexibleFloat trackPercent)
|
||||
{
|
||||
@@ -55,7 +57,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
private void SetPoint()
|
||||
{
|
||||
if (nowAttachedTrackIndex != trackSwitch.value &&
|
||||
if (nowAttachedTrackIndex != trackSwitch.value &&
|
||||
trackSwitch.value >= 0 &&
|
||||
trackSwitch.value < trackListFolder.trackList.Count)
|
||||
{
|
||||
@@ -63,7 +65,7 @@ namespace Ichni.RhythmGame
|
||||
nowAttachedTrackIndex = trackSwitch.value;
|
||||
trackPositioner.spline = trackListFolder.trackList[trackSwitch.value].trackPathSubmodule.path;
|
||||
}
|
||||
|
||||
|
||||
trackPositioner.SetPercent(trackPercent.value);
|
||||
}
|
||||
|
||||
@@ -88,13 +90,16 @@ namespace Ichni.RhythmGame
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new CrossTrackPoint_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM, trackSwitch, trackPercent);
|
||||
parentElement.matchedBM as GameElement_BM, trackSwitch, trackPercent)
|
||||
{
|
||||
MotionAngles = this.MotionAngles
|
||||
};
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
|
||||
|
||||
base.SetUpInspector();
|
||||
var container = inspector.GenerateContainer("Cross Track Point");
|
||||
var pointSettings = container.GenerateSubcontainer(3);
|
||||
@@ -108,18 +113,30 @@ namespace Ichni.RhythmGame
|
||||
});
|
||||
var pasteTrackListButton = inspector.GenerateButton(this, pointSettings, "Paste Track List", PasteTrackList);
|
||||
|
||||
// 新增MotionAngles开关
|
||||
var motionAnglesToggle = inspector.GenerateToggle(this, pointSettings, "Motion With Angles", nameof(MotionAngles));
|
||||
|
||||
var generation = container.GenerateSubcontainer(3);
|
||||
var generateCameraButton = inspector.GenerateButton(this, generation, "Game Camera",
|
||||
() => GameCamera.GenerateElement("New Game Camera", Guid.NewGuid(), new List<string>(),
|
||||
() => GameCamera.GenerateElement("New Game Camera", Guid.NewGuid(), new List<string>(),
|
||||
true, this, GameCamera.CameraViewType.Perspective, 60, 10));
|
||||
var generateTrailButton = inspector.GenerateButton(this, generation, "Trail",
|
||||
() => Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(),
|
||||
true, this, 1, true, 1,
|
||||
AnimationCurve.Constant(0,1,1), ColorExtensions.DefaultGradient()));
|
||||
() => Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(),
|
||||
true, this, 1, true, 1,
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient()));
|
||||
var environmentObjectButton = inspector.GenerateButton(this, generation, "Environment Object",
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
true, this));
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
if (trackPositioner != null && trackPositioner.motion != null)
|
||||
trackPositioner.motion.applyRotation = MotionAngles;
|
||||
|
||||
this.transform.eulerAngles = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
@@ -128,6 +145,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public FlexibleInt trackSwitch;
|
||||
public FlexibleFloat trackPercent;
|
||||
public bool MotionAngles = false;
|
||||
|
||||
public CrossTrackPoint_BM()
|
||||
{
|
||||
@@ -144,14 +162,26 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
var element = CrossTrackPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as ElementFolder, trackSwitch, trackPercent);
|
||||
matchedElement = element;
|
||||
// 还原MotionAngles
|
||||
if (element is CrossTrackPoint ctp && this != null)
|
||||
{
|
||||
ctp.MotionAngles = this.MotionAngles;
|
||||
}
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return CrossTrackPoint.GenerateElement(elementName, Guid.NewGuid(), tags, false,
|
||||
var newElement = CrossTrackPoint.GenerateElement(elementName, Guid.NewGuid(), tags, false,
|
||||
parent as ElementFolder, trackSwitch, trackPercent);
|
||||
// 复制MotionAngles
|
||||
if (newElement is CrossTrackPoint ctp)
|
||||
{
|
||||
ctp.MotionAngles = this.MotionAngles;
|
||||
}
|
||||
return newElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Ichni.RhythmGame
|
||||
public SplinePositioner trackPositioner;
|
||||
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
|
||||
public bool MotionAngles = false;
|
||||
public static TrackHeadPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, Track track)
|
||||
{
|
||||
@@ -28,9 +28,9 @@ namespace Ichni.RhythmGame
|
||||
head.trackPositioner = head.gameObject.AddComponent<SplinePositioner>();
|
||||
head.trackPositioner.spline = track.trackPathSubmodule.path;
|
||||
head.trackTimeSubmoduleMovable = track.trackTimeSubmodule as TrackTimeSubmoduleMovable;
|
||||
|
||||
|
||||
head.trackPositioner.motion.applyRotation = false;
|
||||
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
@@ -52,33 +52,47 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM);
|
||||
// 保存MotionAngles到BM
|
||||
matchedBM = new TrackHeadPoint_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM)
|
||||
{
|
||||
MotionAngles = this.MotionAngles
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
base.SetUpInspector();
|
||||
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Track Percent Point");
|
||||
|
||||
var MotionAngles = container.GenerateSubcontainer(3);
|
||||
var MotionAnglesT = inspector.GenerateToggle(this, MotionAngles, "Motion With Angles", nameof(MotionAngles));
|
||||
var generation = container.GenerateSubcontainer(3);
|
||||
var generateTrailButton = inspector.GenerateButton(this, generation, "Generate Trail", () =>
|
||||
{
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
|
||||
this, 1, true, 1,
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
|
||||
this, 1, true, 1,
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient());
|
||||
});
|
||||
var environmentObjectButton = inspector.GenerateButton(this, generation, "Environment Object",
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
true, this));
|
||||
}
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
trackPositioner.motion.applyRotation = MotionAngles;
|
||||
this.transform.eulerAngles = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public class TrackHeadPoint_BM : GameElement_BM
|
||||
{
|
||||
// 新增属性
|
||||
public bool MotionAngles = false;
|
||||
|
||||
public TrackHeadPoint_BM()
|
||||
{
|
||||
|
||||
@@ -92,13 +106,25 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
var element = TrackHeadPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track);
|
||||
matchedElement = element;
|
||||
// 还原MotionAngles
|
||||
if (element is TrackHeadPoint thp && this != null)
|
||||
{
|
||||
thp.MotionAngles = this.MotionAngles;
|
||||
}
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return TrackHeadPoint.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent as Track);
|
||||
var newElement = TrackHeadPoint.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent as Track);
|
||||
// 复制MotionAngles
|
||||
if (newElement is TrackHeadPoint thp)
|
||||
{
|
||||
thp.MotionAngles = this.MotionAngles;
|
||||
}
|
||||
return newElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
private bool isBeyond1 = false;
|
||||
|
||||
public bool MotionAngles = false;
|
||||
|
||||
public static TrackPercentPoint GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated,
|
||||
Track track, FlexibleFloat trackPercent)
|
||||
@@ -50,7 +52,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
point.trackPositioner.motion.applyRotation = false;
|
||||
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -85,7 +87,10 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
matchedBM = new TrackPercentPoint_BM(elementName, elementGuid, tags,
|
||||
parentElement.matchedBM as GameElement_BM,
|
||||
trackPercent.ConvertToBM());
|
||||
trackPercent.ConvertToBM())
|
||||
{
|
||||
MotionAngles = this.MotionAngles
|
||||
};
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
@@ -98,17 +103,29 @@ namespace Ichni.RhythmGame
|
||||
var trackPercentButton = inspector.GenerateButton(this, pointSettings, "Track Percent",
|
||||
() => { inspector.GenerateCompositeParameterWindow(this, "Track Percent", nameof(trackPercent)).SetAsFlexibleFloat(); });
|
||||
|
||||
// 新增MotionAngles开关
|
||||
var motionAnglesToggle = inspector.GenerateToggle(this, pointSettings, "Motion With Angles", nameof(MotionAngles));
|
||||
|
||||
var generation = container.GenerateSubcontainer(3);
|
||||
var generateTrailButton = inspector.GenerateButton(this, generation, "Generate Trail", () =>
|
||||
{
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
|
||||
this, 1, true, 1,
|
||||
Trail.GenerateElement("New Trail", Guid.NewGuid(), new List<string>(), true,
|
||||
this, 1, true, 1,
|
||||
AnimationCurve.Constant(0, 1, 1), ColorExtensions.DefaultGradient());
|
||||
});
|
||||
var environmentObjectButton = inspector.GenerateButton(this, generation, "Environment Object",
|
||||
() => TemporaryObject.GenerateElement("New Environment Object", Guid.NewGuid(), new List<string>(),
|
||||
true, this));
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
|
||||
this.transform.eulerAngles = Vector3.zero;
|
||||
if (trackPositioner != null && trackPositioner.motion != null)
|
||||
trackPositioner.motion.applyRotation = MotionAngles;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
@@ -116,6 +133,7 @@ namespace Ichni.RhythmGame
|
||||
public class TrackPercentPoint_BM : GameElement_BM
|
||||
{
|
||||
public FlexibleFloat_BM trackPercent;
|
||||
public bool MotionAngles = false;
|
||||
|
||||
public TrackPercentPoint_BM()
|
||||
{
|
||||
@@ -131,14 +149,26 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
matchedElement = TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
var element = TrackPercentPoint.GenerateElement(elementName, elementGuid, tags, false,
|
||||
GetElement(attachedElementGuid) as Track, trackPercent.ConvertToGameType());
|
||||
matchedElement = element;
|
||||
// 还原MotionAngles
|
||||
if (element is TrackPercentPoint tpp && this != null)
|
||||
{
|
||||
tpp.MotionAngles = this.MotionAngles;
|
||||
}
|
||||
}
|
||||
|
||||
public override GameElement DuplicateBM(GameElement parent)
|
||||
{
|
||||
return TrackPercentPoint.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent as Track,
|
||||
trackPercent.ConvertToGameType());
|
||||
var newElement = TrackPercentPoint.GenerateElement(elementName, Guid.NewGuid(), tags, false,
|
||||
parent as Track, trackPercent.ConvertToGameType());
|
||||
// 复制MotionAngles
|
||||
if (newElement is TrackPercentPoint tpp)
|
||||
{
|
||||
tpp.MotionAngles = this.MotionAngles;
|
||||
}
|
||||
return newElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Ichni
|
||||
this.elementName = "EditorManager";
|
||||
this.elementGuid = Guid.Empty;
|
||||
uiManager.hierarchy.GenerateTab(this, null);
|
||||
|
||||
this.connectedTab.deleteButton.gameObject.SetActive(false);
|
||||
if (InformationTransistor.instance.isLoadedProject)
|
||||
{
|
||||
LoadProject(InformationTransistor.instance.loadedProjectName);
|
||||
@@ -100,7 +100,7 @@ namespace Ichni
|
||||
if (frameCount == 2)
|
||||
{
|
||||
frameCount = 0;
|
||||
FPStext.text = string.Format("{0:N2}", CurrentFrameRate);
|
||||
FPStext.text = string.Format("FPS: {0:N2}", CurrentFrameRate);
|
||||
}
|
||||
frameCount++;
|
||||
yield return null;
|
||||
|
||||
Reference in New Issue
Block a user