StartMenu!
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
@@ -16,10 +17,6 @@ namespace Ichni.RhythmGame
|
||||
public Color originalEmissionColor;
|
||||
public float originalEmissionIntensity;
|
||||
|
||||
public List<Color> baseColorOffset = new List<Color>();
|
||||
public List<Color> emissionColorOffset = new List<Color>();
|
||||
public List<float> emissionIntensityOffset = new List<float>();
|
||||
|
||||
public Color currentBaseColor;
|
||||
public Color currentEmissionColor;
|
||||
public float currentEmissionIntensity;
|
||||
@@ -40,6 +37,9 @@ namespace Ichni.RhythmGame
|
||||
|
||||
this.baseColorDirtyMark = false;
|
||||
this.emissionColorDirtyMark = false;
|
||||
|
||||
(attachedGameElement as IHaveColorSubmodule).colorSubmodule = this;
|
||||
(attachedGameElement as IHaveColorSubmodule).SetColorObserver();
|
||||
}
|
||||
|
||||
public ColorSubmodule(GameElement attachedGameElement, Color originalBaseColor) : base(attachedGameElement)
|
||||
@@ -57,6 +57,7 @@ namespace Ichni.RhythmGame
|
||||
this.emissionColorDirtyMark = false;
|
||||
|
||||
(attachedGameElement as IHaveColorSubmodule).colorSubmodule = this;
|
||||
(attachedGameElement as IHaveColorSubmodule).SetColorObserver();
|
||||
}
|
||||
|
||||
public ColorSubmodule(GameElement attachedGameElement, Color originalBaseColor, bool emissionEnabled,
|
||||
@@ -75,6 +76,7 @@ namespace Ichni.RhythmGame
|
||||
this.emissionColorDirtyMark = false;
|
||||
|
||||
(attachedGameElement as IHaveColorSubmodule).colorSubmodule = this;
|
||||
(attachedGameElement as IHaveColorSubmodule).SetColorObserver();
|
||||
}
|
||||
|
||||
public override void SaveBM()
|
||||
@@ -86,20 +88,78 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Color");
|
||||
|
||||
var baseColor = inspector.GenerateBaseColorPicker(this, container, "Base Color", nameof(originalBaseColor));
|
||||
baseColor.AddListenerFunction(Refresh);
|
||||
if (attachedGameElement.childElementList.Exists(x => x is BaseColorChange))
|
||||
{
|
||||
baseColor.title.text += " (Occupied by Animation)";
|
||||
baseColor.canvasGroup.interactable = false;
|
||||
}
|
||||
|
||||
if ((attachedGameElement as IHaveColorSubmodule).haveEmission)
|
||||
{
|
||||
var emissionColor = inspector.GenerateEmissionColorPicker(this, container, "Emission Color",
|
||||
nameof(emissionEnabled), nameof(originalEmissionColor), nameof(originalEmissionIntensity));
|
||||
emissionColor.AddListenerFunction(Refresh);
|
||||
|
||||
if (attachedGameElement.childElementList.Exists(x => x is EmissionColorChange))
|
||||
{
|
||||
emissionColor.title.text += " (Occupied by Animation)";
|
||||
emissionColor.canvasGroup.interactable = false;
|
||||
}
|
||||
}
|
||||
|
||||
container.SetDeviver(1);
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
currentBaseColor = originalBaseColor;
|
||||
currentEmissionColor = originalEmissionColor;
|
||||
baseColorDirtyMark = true;
|
||||
emissionColorDirtyMark = true;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveColorSubmodule
|
||||
{
|
||||
public ColorSubmodule colorSubmodule { get; set; }
|
||||
public bool haveEmission { get; }
|
||||
|
||||
public void SetColorObserver()
|
||||
{
|
||||
GameElement attachedGameElement = colorSubmodule.attachedGameElement;
|
||||
|
||||
Observable.EveryUpdate().Subscribe(_ =>
|
||||
{
|
||||
if (colorSubmodule == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool willRefresh = false;
|
||||
|
||||
if (colorSubmodule.baseColorDirtyMark)
|
||||
{
|
||||
//在动画物体中改变currentColor
|
||||
colorSubmodule.baseColorDirtyMark = false;
|
||||
willRefresh = true;
|
||||
}
|
||||
|
||||
if (colorSubmodule.emissionColorDirtyMark)
|
||||
{
|
||||
//在动画物体中改变currentColor
|
||||
colorSubmodule.emissionColorDirtyMark = false;
|
||||
willRefresh = true;
|
||||
}
|
||||
|
||||
if (willRefresh)
|
||||
{
|
||||
attachedGameElement.Refresh();
|
||||
}
|
||||
}).AddTo(attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
Reference in New Issue
Block a user