CodeWriter and pain

This commit is contained in:
ThomasCharester committed 2026-01-20 20:38:20 +03:00
1 parent a409054750
commit 85ac63425c
89 files changed
+1439 -1461

No files matched your search

@@ -1,12 +1,56 @@
using Generators;
using System;
namespace InfraGens.Sample;
[Config("Configs/Camera/CameraConfig")]
public class GameCamera
{
[ToConfig] public int Camera;
}
public class StateMachine : Attribute
{
public Type StateMachineContextType;
public Type StateMachineEnumType;
// This code will not compile until you build the project with the Source Generators
public StateMachine(Type stateMachineContextType, Type stateMachineEnumType)
{
StateMachineContextType = stateMachineContextType;
StateMachineEnumType = stateMachineEnumType;
}
}
[Report]
public partial class SampleEntity
public class State : Attribute
{
public Type StateEnum;
public Type StateMachineContext;
public bool SilentBitch; // Поэтому нейминг переменных очень важен
public State(Type stateEnum, Type stateMachineContext, bool silentBitch = false)
{
StateEnum = stateEnum;
StateMachineContext = stateMachineContext;
SilentBitch = silentBitch;
}
}
public class StateRaisingEvent : Attribute
{
}
public class Config : Attribute
{
public bool Multiple;
public string MenuName;
public Config(string menuName, bool multiple = false)
{
Multiple = multiple;
MenuName = menuName;
}
}
public class ToConfig : Attribute
{
}
public class SceneIdEnum : Attribute
{
public int Id { get; } = 42;
public string? Name { get; } = "Sample";
}