Codex实装,RegularGridFloor

This commit is contained in:
SoulliesOfficial
2026-07-08 04:29:20 -04:00
parent 7b7d069b84
commit d474a8929c
176 changed files with 31884 additions and 890 deletions

View File

@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
{
public partial class DTMRegularGridFloor : EnvironmentObject
{
#region Exposed Fields
public float gridSizeX = 100f;
public float gridSizeY = 100f;
public float gridDensity = 1f;
public float lineThickness = 0.05f;
public float edgeSoftness;
public float moveVectorX;
public float moveVectorY;
public bool enableOuterBorder = true;
public Color outerBorderColor = Color.white;
public float outerBorderWidth = 0.005f;
public Renderer meshRenderer;
#endregion
#region Lifecycle & Factory
public static DTMRegularGridFloor GenerateElement(string elementName, Guid id, List<string> tags,
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
bool isStatic,
float gridSizeX, float gridSizeY, float gridDensity,
float lineThickness, float edgeSoftness, float moveVectorX, float moveVectorY,
bool enableOuterBorder, Color outerBorderColor, float outerBorderWidth)
{
DTMRegularGridFloor regularGridFloor = EnvironmentObject.GenerateElement(elementName, id, tags,
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DTMRegularGridFloor>();
regularGridFloor.gridSizeX = gridSizeX;
regularGridFloor.gridSizeY = gridSizeY;
regularGridFloor.gridDensity = gridDensity;
regularGridFloor.lineThickness = lineThickness;
regularGridFloor.edgeSoftness = edgeSoftness;
regularGridFloor.moveVectorX = moveVectorX;
regularGridFloor.moveVectorY = moveVectorY;
regularGridFloor.enableOuterBorder = enableOuterBorder;
regularGridFloor.outerBorderColor = outerBorderColor;
regularGridFloor.outerBorderWidth = outerBorderWidth;
return regularGridFloor;
}
public override void FirstSetUpObject(bool isFirstGenerated)
{
if (meshRenderer == null)
meshRenderer = GetComponentInChildren<Renderer>();
meshRenderer.InitializeShader();
}
public override void AfterInitialize()
{
base.AfterInitialize();
UpdateMaterialProperties();
}
public override void OnDirtyRefresh(Dictionary<string, bool> flags)
{
UpdateMaterialProperties();
}
#endregion
#region Core Effect Logic
public void UpdateMaterialProperties()
{
if (meshRenderer != null && meshRenderer.material != null)
{
Material mat = meshRenderer.material;
mat.SetVector("_GridSize", new Vector4(gridSizeX, gridSizeY, 0f, 0f));
mat.SetFloat("_GridDensity", gridDensity);
mat.SetFloat("_LineThickness", lineThickness);
mat.SetFloat("_EdgeSoftness", edgeSoftness);
mat.SetVector("_MoveVector", new Vector4(moveVectorX, moveVectorY, 0f, 0f));
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);
mat.SetColor("_Color0", colorSubmodule.currentBaseColor);
}
}
public override void Refresh()
{
base.Refresh();
if (meshRenderer != null)
{
meshRenderer.material.SetColor("_Color0", colorSubmodule.currentBaseColor);
}
}
#endregion
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 23b750fa4c234eb995b6be5e65b56dba