diff --git a/.claude/rules/coding-patterns.md b/.claude/rules/coding-patterns.md new file mode 100644 index 00000000..4e1cccfe --- /dev/null +++ b/.claude/rules/coding-patterns.md @@ -0,0 +1,50 @@ +# JEngine Coding Patterns + +## Async Patterns + +Use `UniTask` for async operations, not `System.Threading.Tasks.Task`: +```csharp +public async UniTask LoadAssetAsync() { } +``` + +## Thread Safety + +For properties accessed across callbacks: +```csharp +private static volatile bool _flag; +public static bool Flag => _flag; +``` + +## Encryption Architecture + +JEngine supports three encryption algorithms: +- **XOR** (`EncryptionOption.Xor`) - Fast, simple +- **AES** (`EncryptionOption.Aes`) - Moderate security +- **ChaCha20** (`EncryptionOption.ChaCha20`) - High security + +Each has implementations for bundles and manifests in `Runtime/Encrypt/`. + +### Adding New Encryption + +1. Create config class in `Runtime/Encrypt/Config/` +2. Implement bundle encryption in `Runtime/Encrypt/Bundle/` +3. Implement manifest encryption in `Runtime/Encrypt/Manifest/` +4. Add to `EncryptionOption` enum +5. Update `EncryptionMapping` class + +## ScriptableObject Configuration + +Use `ScriptableObject` for runtime configuration: +```csharp +public abstract class ConfigBase : ScriptableObject where T : ConfigBase +{ + public static T Instance { get; } +} +``` + +## Editor Scripts + +- Use `[InitializeOnLoad]` for editor initialization +- Handle Unity domain reloads properly (state resets on recompile) +- Use `SessionState` or `EditorPrefs` for persistent editor state +- Clean up resources in `EditorApplication.quitting` diff --git a/.claude/rules/commit-conventions.md b/.claude/rules/commit-conventions.md new file mode 100644 index 00000000..521a5a5e --- /dev/null +++ b/.claude/rules/commit-conventions.md @@ -0,0 +1,73 @@ +# Commit Message Format + +All commits should follow the Conventional Commits specification to enable automatic changelog generation. + +## Format + +``` +(): + + + +