修复
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
|
||||
{
|
||||
public class DTMFramesFloor : EnvironmentObject
|
||||
{
|
||||
#region [暴露属性字段] Exposed Fields
|
||||
public float patternSizeX;
|
||||
public float patternSizeY;
|
||||
public float gridDensity;
|
||||
public float timeAngle;
|
||||
public float stepA;
|
||||
public float stepB;
|
||||
|
||||
public bool enableOuterBorder;
|
||||
public Color outerBorderColor;
|
||||
public float outerBorderWidth;
|
||||
|
||||
public Renderer meshRenderer;
|
||||
#endregion
|
||||
|
||||
#region [生命周期与工厂] Lifecycle & Factory
|
||||
public static DTMFramesFloor GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
|
||||
bool isStatic,
|
||||
float patternSizeX, float patternSizeY, float gridDensity,
|
||||
float timeAngle, float stepA, float stepB,
|
||||
bool enableOuterBorder,
|
||||
Color outerBorderColor,
|
||||
float outerBorderWidth)
|
||||
{
|
||||
DTMFramesFloor framesFloor = EnvironmentObject.GenerateElement(elementName, id, tags,
|
||||
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DTMFramesFloor>();
|
||||
|
||||
framesFloor.patternSizeX = patternSizeX;
|
||||
framesFloor.patternSizeY = patternSizeY;
|
||||
framesFloor.gridDensity = gridDensity;
|
||||
framesFloor.timeAngle = timeAngle;
|
||||
framesFloor.stepA = stepA;
|
||||
framesFloor.stepB = stepB;
|
||||
|
||||
framesFloor.enableOuterBorder = enableOuterBorder;
|
||||
framesFloor.outerBorderColor = outerBorderColor;
|
||||
framesFloor.outerBorderWidth = outerBorderWidth;
|
||||
|
||||
return framesFloor;
|
||||
}
|
||||
|
||||
public override void FirstSetUpObject(bool isFirstGenerated)
|
||||
{
|
||||
if (meshRenderer == null)
|
||||
meshRenderer = GetComponentInChildren<Renderer>();
|
||||
|
||||
meshRenderer.InitializeShader(); // 实例化材质 / Instantiate material
|
||||
UpdateMaterialProperties();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [效果核心逻辑] Core Effect Logic
|
||||
public void UpdateMaterialProperties()
|
||||
{
|
||||
if (meshRenderer != null && meshRenderer.material != null)
|
||||
{
|
||||
Material mat = meshRenderer.material;
|
||||
|
||||
mat.SetVector("_PatternSize", new Vector4(patternSizeX, patternSizeY, 0, 0));
|
||||
mat.SetFloat("_GridDensity", gridDensity);
|
||||
mat.SetFloat("_TimeAngle", timeAngle);
|
||||
mat.SetFloat("_StepA", stepA);
|
||||
mat.SetFloat("_StepB", stepB);
|
||||
|
||||
float borderOn = enableOuterBorder ? 1f : 0f;
|
||||
mat.SetFloat("_EnableOuterBorder", borderOn);
|
||||
if (enableOuterBorder)
|
||||
{
|
||||
mat.EnableKeyword("_OUTER_BORDER_ON");
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.DisableKeyword("_OUTER_BORDER_ON");
|
||||
}
|
||||
|
||||
mat.SetColor("_OuterBorderColor", outerBorderColor);
|
||||
mat.SetFloat("_OuterBorderWidth", outerBorderWidth);
|
||||
|
||||
// Base Color and Alpha Sync (Unity Color -> HDR)
|
||||
mat.SetColor("_Color0", colorSubmodule.currentBaseColor);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
// Sync environment color changes
|
||||
if (meshRenderer != null)
|
||||
{
|
||||
meshRenderer.material.SetColor("_Color0", colorSubmodule.currentBaseColor);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 677671f1d5140b2489dc52c18792b8f5
|
||||
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
using AtmosphericHeightFog;
|
||||
using FogMode = AtmosphericHeightFog.FogMode;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
|
||||
{
|
||||
public class DTMGlobalFog : EnvironmentObject
|
||||
{
|
||||
#region [暴露属性字段] Exposed Fields
|
||||
public HeightFogGlobal heightFogGlobal;
|
||||
|
||||
public FlexibleFloat fogColorStartR, fogColorStartG, fogColorStartB, fogColorStartA;
|
||||
public FlexibleFloat fogColorEndR, fogColorEndG, fogColorEndB, fogColorEndA;
|
||||
public FlexibleFloat fogColorDuo;
|
||||
|
||||
public FlexibleFloat skyboxFogIntensity;
|
||||
public FlexibleFloat skyboxFogHeight;
|
||||
public FlexibleFloat skyboxFogFalloff;
|
||||
public FlexibleFloat skyboxFogOffset;
|
||||
#endregion
|
||||
|
||||
#region [生命周期与工厂] Lifecycle & Factory
|
||||
public static DTMGlobalFog GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
|
||||
bool isStatic,
|
||||
FlexibleFloat fogColorStartR, FlexibleFloat fogColorStartG, FlexibleFloat fogColorStartB, FlexibleFloat fogColorStartA,
|
||||
FlexibleFloat fogColorEndR, FlexibleFloat fogColorEndG, FlexibleFloat fogColorEndB, FlexibleFloat fogColorEndA,
|
||||
FlexibleFloat fogColorDuo,
|
||||
FlexibleFloat skyboxFogIntensity, FlexibleFloat skyboxFogHeight,
|
||||
FlexibleFloat skyboxFogFalloff, FlexibleFloat skyboxFogOffset)
|
||||
{
|
||||
DTMGlobalFog globalFog = EnvironmentObject.GenerateElement(elementName, id, tags,
|
||||
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DTMGlobalFog>();
|
||||
|
||||
globalFog.fogColorStartR = fogColorStartR;
|
||||
globalFog.fogColorStartG = fogColorStartG;
|
||||
globalFog.fogColorStartB = fogColorStartB;
|
||||
globalFog.fogColorStartA = fogColorStartA;
|
||||
|
||||
globalFog.fogColorEndR = fogColorEndR;
|
||||
globalFog.fogColorEndG = fogColorEndG;
|
||||
globalFog.fogColorEndB = fogColorEndB;
|
||||
globalFog.fogColorEndA = fogColorEndA;
|
||||
|
||||
globalFog.fogColorDuo = fogColorDuo;
|
||||
|
||||
globalFog.skyboxFogIntensity = skyboxFogIntensity;
|
||||
globalFog.skyboxFogHeight = skyboxFogHeight;
|
||||
globalFog.skyboxFogFalloff = skyboxFogFalloff;
|
||||
globalFog.skyboxFogOffset = skyboxFogOffset;
|
||||
|
||||
return globalFog;
|
||||
}
|
||||
|
||||
public override void FirstSetUpObject(bool isFirstGenerated)
|
||||
{
|
||||
if (heightFogGlobal == null)
|
||||
{
|
||||
heightFogGlobal = GetComponentInChildren<HeightFogGlobal>();
|
||||
}
|
||||
|
||||
// Ensure fog mode is set to script settings so it accepts our overrides
|
||||
if (heightFogGlobal != null)
|
||||
{
|
||||
heightFogGlobal.fogMode = FogMode.UseScriptSettings;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [事件动画逻辑] Event Animation Logic
|
||||
private void Update()
|
||||
{
|
||||
if (heightFogGlobal == null) return;
|
||||
|
||||
float songTime = CoreServices.TimeProvider.SongTime;
|
||||
|
||||
fogColorStartR?.UpdateFlexibleFloat(songTime);
|
||||
fogColorStartG?.UpdateFlexibleFloat(songTime);
|
||||
fogColorStartB?.UpdateFlexibleFloat(songTime);
|
||||
fogColorStartA?.UpdateFlexibleFloat(songTime);
|
||||
|
||||
fogColorEndR?.UpdateFlexibleFloat(songTime);
|
||||
fogColorEndG?.UpdateFlexibleFloat(songTime);
|
||||
fogColorEndB?.UpdateFlexibleFloat(songTime);
|
||||
fogColorEndA?.UpdateFlexibleFloat(songTime);
|
||||
|
||||
fogColorDuo?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogIntensity?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogHeight?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogFalloff?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogOffset?.UpdateFlexibleFloat(songTime);
|
||||
|
||||
if (fogColorStartR != null && fogColorStartG != null && fogColorStartB != null && fogColorStartA != null)
|
||||
{
|
||||
heightFogGlobal.fogColorStart = new Color(fogColorStartR.value, fogColorStartG.value, fogColorStartB.value, fogColorStartA.value);
|
||||
}
|
||||
|
||||
if (fogColorEndR != null && fogColorEndG != null && fogColorEndB != null && fogColorEndA != null)
|
||||
{
|
||||
heightFogGlobal.fogColorEnd = new Color(fogColorEndR.value, fogColorEndG.value, fogColorEndB.value, fogColorEndA.value);
|
||||
}
|
||||
|
||||
if (fogColorDuo != null) heightFogGlobal.fogColorDuo = fogColorDuo.value;
|
||||
|
||||
if (skyboxFogIntensity != null) heightFogGlobal.skyboxFogIntensity = skyboxFogIntensity.value;
|
||||
if (skyboxFogHeight != null) heightFogGlobal.skyboxFogHeight = skyboxFogHeight.value;
|
||||
if (skyboxFogFalloff != null) heightFogGlobal.skyboxFogFalloff = skyboxFogFalloff.value;
|
||||
if (skyboxFogOffset != null) heightFogGlobal.skyboxFogOffset = skyboxFogOffset.value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8bab02f6d349f6418ccfe0674b93013
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
|
||||
{
|
||||
public class DTMStarrySkybox : GameElement
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 638fbd0e919667f47a93485dd230c71f
|
||||
Reference in New Issue
Block a user