效果模块,以及代码位置整理
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni
|
||||
{
|
||||
public class EditorSettings
|
||||
{
|
||||
public int autoSaveInterval = 300;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
@@ -20,7 +21,19 @@ namespace Ichni.Editor
|
||||
|
||||
private void ApplyParameters(string text)
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, text);
|
||||
Type type = connectedBaseElement.GetType().GetField(parameterName).FieldType;
|
||||
if (type == typeof(int))
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, int.Parse(text));
|
||||
}
|
||||
else if (type == typeof(float))
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, float.Parse(text));
|
||||
}
|
||||
else if (type == typeof(string))
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, text);
|
||||
}
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
@@ -22,5 +23,10 @@ namespace Ichni.Editor
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
|
||||
public void AddListenerFunction(UnityAction<bool> action)
|
||||
{
|
||||
toggle.onValueChanged.AddListener(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@ namespace Ichni.Editor
|
||||
{
|
||||
public class EditorUIManager : MonoBehaviour
|
||||
{
|
||||
public MainPage mainPage;
|
||||
public Hierarchy hierarchy;
|
||||
public Inspector inspector;
|
||||
public Timeline timeline;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,16 @@ namespace Ichni.Editor
|
||||
container.dynamicUIElements.Add(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
public DynamicUIToggle GenerateToggle(IBaseElement baseElement, DynamicUIContainer container, string title,
|
||||
string parameterName)
|
||||
{
|
||||
DynamicUIToggle toggle = Instantiate(EditorManager.instance.basePrefabs.toggle, container.rect)
|
||||
.GetComponent<DynamicUIToggle>();
|
||||
toggle.Initialize(baseElement, title, parameterName);
|
||||
container.dynamicUIElements.Add(toggle);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
public DynamicUIInputField GenerateInputField(IBaseElement baseElement, DynamicUIContainer container,
|
||||
string title, string parameterName)
|
||||
|
||||
8
Assets/Scripts/DynamicUI/MainUI.meta
Normal file
8
Assets/Scripts/DynamicUI/MainUI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6795f50bfe6d14cb7a78043ec0d9b433
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
Assets/Scripts/DynamicUI/MainUI/MainPage.cs
Normal file
13
Assets/Scripts/DynamicUI/MainUI/MainPage.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class MainPage : StaticWindow
|
||||
{
|
||||
public Canvas mainCanvas;
|
||||
public ToolBar toolBar;
|
||||
public ResolutionHints resolutionHints;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/DynamicUI/MainUI/MainPage.cs.meta
Normal file
11
Assets/Scripts/DynamicUI/MainUI/MainPage.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcc87ae8f9fe04833b49d5d7396d9693
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/DynamicUI/MainUI/ResolusionHints.meta
Normal file
8
Assets/Scripts/DynamicUI/MainUI/ResolusionHints.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77cef690bc8234daba9231732db8dfb4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public partial class ResolutionHints : MonoBehaviour
|
||||
{
|
||||
public Image phoneFrame;
|
||||
public Image iPadFrame;
|
||||
public Image safeAreaFrame;
|
||||
}
|
||||
|
||||
public partial class ResolutionHints
|
||||
{
|
||||
public void SetPhoneFrame()
|
||||
{
|
||||
phoneFrame.gameObject.SetActive(!phoneFrame.gameObject.activeSelf);
|
||||
}
|
||||
|
||||
public void SetIPadFrame()
|
||||
{
|
||||
iPadFrame.gameObject.SetActive(!iPadFrame.gameObject.activeSelf);
|
||||
}
|
||||
|
||||
public void SetSafeAreaFrame()
|
||||
{
|
||||
safeAreaFrame.gameObject.SetActive(!safeAreaFrame.gameObject.activeSelf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f39aaf316b5904be48688dae23e2e35f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/Scripts/DynamicUI/MainUI/ToolBar/ToolBar.cs
Normal file
28
Assets/Scripts/DynamicUI/MainUI/ToolBar/ToolBar.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public partial class ToolBar : MonoBehaviour
|
||||
{
|
||||
public Button projectInfoButton;
|
||||
public Button songInfoButton;
|
||||
public Button saveButton;
|
||||
public Button exportButton;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
saveButton.onClick.AddListener(EditorManager.instance.projectManager.saveManager.Save);
|
||||
exportButton.onClick.AddListener(EditorManager.instance.projectManager.exportManager.Export);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ToolBar
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
8
Assets/Scripts/EditorGame.meta
Normal file
8
Assets/Scripts/EditorGame.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bf117e642611451c8562357254c1e83
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -40,6 +40,7 @@ namespace Ichni.RhythmGame
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
public void SetUpInspector();
|
||||
}
|
||||
|
||||
@@ -81,15 +81,18 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
var container = inspector.GenerateContainer("Color");
|
||||
var baseColor = inspector.GenerateBaseColorPicker(this, container, "Base Color", nameof(originalBaseColor));
|
||||
var emissionColor = inspector.GenerateEmissionColorPicker(this, container, "Emission Color", nameof(emissionEnabled),
|
||||
nameof(originalEmissionColor), nameof(originalEmissionIntensity));
|
||||
|
||||
if ((attachedGameElement as IHaveColorSubmodule).haveEmission)
|
||||
{
|
||||
var emissionColor = inspector.GenerateEmissionColorPicker(this, container, "Emission Color",
|
||||
nameof(emissionEnabled), nameof(originalEmissionColor), nameof(originalEmissionIntensity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveColorSubmodule
|
||||
{
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveEmission { get; }
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Sirenix.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -47,11 +49,26 @@ namespace Ichni.RhythmGame
|
||||
effectCollection.Add(effect.Key, effectList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public partial class EffectSubmodule
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
matchedBM = new EffectSubmodule_BM(attachedGameElement);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
foreach (var effect in effectCollection)
|
||||
{
|
||||
var container = inspector.GenerateContainer(effect.Key);
|
||||
foreach (var effectBase in effect.Value)
|
||||
{
|
||||
effectBase.SetUpInspector();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class EffectSubmodule
|
||||
@@ -110,7 +127,7 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class EffectBase
|
||||
public abstract class EffectBase : IBaseElement
|
||||
{
|
||||
public enum EffectState
|
||||
{
|
||||
@@ -120,6 +137,9 @@ namespace Ichni.RhythmGame
|
||||
Error = 100
|
||||
}
|
||||
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
/// <summary>
|
||||
/// 效果的持续时间,如果为0则表示瞬间效果
|
||||
/// </summary>
|
||||
@@ -146,10 +166,15 @@ namespace Ichni.RhythmGame
|
||||
this.effectTime = effectTime;
|
||||
this.nowEffectState = EffectState.Before;
|
||||
}
|
||||
|
||||
public virtual void UpdateEffect()
|
||||
|
||||
public void SaveBM()
|
||||
{
|
||||
EffectState state = CheckEffectState();
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual void UpdateEffect(float triggerTime)
|
||||
{
|
||||
EffectState state = CheckEffectState(triggerTime);
|
||||
|
||||
if (state == EffectState.Before && nowEffectState != EffectState.Before)
|
||||
{
|
||||
@@ -168,9 +193,27 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
public virtual EffectState CheckEffectState()
|
||||
protected virtual EffectState CheckEffectState(float triggerTime)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
float songTime = EditorManager.instance.songInformation.songTime;
|
||||
|
||||
if (songTime < triggerTime)
|
||||
{
|
||||
return EffectState.Before;
|
||||
}
|
||||
|
||||
if (songTime >= triggerTime &&
|
||||
songTime <= triggerTime + effectTime)
|
||||
{
|
||||
return EffectState.Middle;
|
||||
}
|
||||
|
||||
if (songTime > triggerTime + effectTime)
|
||||
{
|
||||
return EffectState.After;
|
||||
}
|
||||
|
||||
return EffectState.Error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -203,6 +246,13 @@ namespace Ichni.RhythmGame
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract EffectBase_BM ConvertToBM();
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract void SetUpInspector();
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
@@ -13,6 +13,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
public SubmoduleBase(GameElement attachedGameElement)
|
||||
{
|
||||
this.attachedGameElement = attachedGameElement;
|
||||
@@ -34,9 +36,7 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
attachedGameElement.submoduleList.Remove(this);
|
||||
}
|
||||
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
|
||||
public virtual void SetUpInspector()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public class TimeDurationSubmodule: SubmoduleBase
|
||||
public partial class TimeDurationSubmodule : SubmoduleBase
|
||||
{
|
||||
public bool isOverridingDuration; //是否手动设置了时间区间,开启时,子物体的时间区间将被忽略,且在自动计算区间时跳过此模块
|
||||
public float startTime, endTime; //起止时间
|
||||
@@ -82,6 +82,28 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TimeDurationSubmodule
|
||||
{
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
var container = inspector.GenerateContainer("Time Duration");
|
||||
var overrideToggle = inspector.GenerateToggle(this, container, "Override Duration", nameof(isOverridingDuration));
|
||||
var startTimeInputField = inspector.GenerateInputField(this, container, "Start Time", nameof(startTime));
|
||||
var endTimeInputField = inspector.GenerateInputField(this, container, "End Time", nameof(endTime));
|
||||
|
||||
void SetInputFieldInteractable(bool interactable)
|
||||
{
|
||||
startTimeInputField.inputField.interactable = interactable;
|
||||
endTimeInputField.inputField.interactable = interactable;
|
||||
}
|
||||
|
||||
SetInputFieldInteractable(isOverridingDuration);
|
||||
overrideToggle.AddListenerFunction(SetInputFieldInteractable);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface IHaveTimeDurationSubmodule
|
||||
{
|
||||
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
||||
@@ -17,11 +17,7 @@ namespace Ichni.RhythmGame
|
||||
public static ElementFolder GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated, GameElement parentElement)
|
||||
{
|
||||
ElementFolder elementFolder = Instantiate(EditorManager.instance.basePrefabs.elementFolder).GetComponent<ElementFolder>();
|
||||
|
||||
elementFolder.Initialize(name, id, tags, isFirstGenerated, parentElement);
|
||||
|
||||
//elementFolder.GenerateTab(parentElement);
|
||||
|
||||
return elementFolder;
|
||||
}
|
||||
|
||||
@@ -33,7 +29,6 @@ namespace Ichni.RhythmGame
|
||||
submoduleList.Add(transformSubmodule);
|
||||
submoduleList.Add(timeDurationSubmodule);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace Ichni.RhythmGame
|
||||
//存档类
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 首次初始化
|
||||
@@ -139,8 +141,6 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public abstract partial class GameElement
|
||||
{
|
||||
public Inspector inspector => EditorManager.instance.uiManager.inspector;
|
||||
|
||||
public virtual void SetUpInspector() //被点击时设置第一层Inspector
|
||||
{
|
||||
var container = inspector.GenerateContainer("Element Info");
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
@@ -28,5 +29,10 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class TimeEffectsCollection : GameElement, IHaveEffectSubmodule
|
||||
{
|
||||
public EffectSubmodule effectSubmodule { get; set; }
|
||||
public float time;
|
||||
|
||||
public static TimeEffectsCollection CreateTimeEffectsCollection(float time)
|
||||
{
|
||||
TimeEffectsCollection timeEffectsCollection = Instantiate(EditorManager.instance.basePrefabs.emptyObject)
|
||||
.AddComponent<TimeEffectsCollection>();
|
||||
timeEffectsCollection.time = time;
|
||||
return timeEffectsCollection;
|
||||
}
|
||||
|
||||
protected override void SetDefaultSubmodules()
|
||||
{
|
||||
effectSubmodule = new EffectSubmodule(this);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
effectSubmodule.effectCollection["Default"].ForEach(effect => effect.UpdateEffect(time));
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TimeEffectsCollection
|
||||
{
|
||||
public override void SaveBM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
var container = inspector.GenerateContainer("Time Effects Collection");
|
||||
var timeInputField = inspector.GenerateInputField(this, container, "Time", nameof(time));
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user