2025-7-17
This commit is contained in:
@@ -9,35 +9,5 @@ using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
public class Building_Wula_DarkEnergy_Engine : Building_GravEngine
|
||||
{
|
||||
// 子类自己的静态只读字段
|
||||
private static readonly string _childStaticValue = "Child Value";
|
||||
private static readonly CachedMaterial Wula_DarkEnergy_OrbMat = new CachedMaterial("Wula/Building/Wula_DarkEnergy_Engine_Orb", ShaderDatabase.Cutout);
|
||||
|
||||
// 通过实例属性暴露静态值
|
||||
protected override string InstanceValue => _childStaticValue;
|
||||
private static readonly CachedMaterial OrbMat = new CachedMaterial("Wula/Building/Wula_DarkEnergy_Engine_Orb", ShaderDatabase.Cutout);
|
||||
}
|
||||
public abstract class Building_Wula_DarkEnergy_Engine_Parent : Building_GravEngine
|
||||
{
|
||||
// 受保护的抽象属性(实例级别)
|
||||
protected abstract string InstanceValue { get; }
|
||||
|
||||
// 公共访问点
|
||||
public void PrintValue()
|
||||
{
|
||||
Console.WriteLine(InstanceValue);
|
||||
}
|
||||
}
|
||||
|
||||
public class Child : Parent
|
||||
{
|
||||
// 子类自己的静态只读字段
|
||||
private static readonly string _childStaticValue = "Child Value";
|
||||
|
||||
// 通过实例属性暴露静态值
|
||||
protected override string InstanceValue => _childStaticValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user