Files
Pal3.Unity/tools/CodeStyle/README.md
T
Jiaqi Liu 5d0f564a00 Add a standalone battle editor and battle system for PAL3 and PAL3A (#99)
* build: migrate C# formatting and add offscreen editor test support

Host IMGUI tests on a detached panel without creating a native editor window.

* feat(core): decode native battle records, geometry and animation metadata

Read the two game variants’ battle tables and model data, with binary-reader and original-resource coverage.

* feat(battle): implement deterministic combat rules and action settlement

Implement actors, inventory, formation, action timing, status interruption, AI, stage ownership and deterministic replay. Keep the domain and its regression suite independent of Unity.

* feat(battle): project native HUD state and input commands

Add the presentation assembly and tests for command routing, lineup selection, floating numbers and stage messages.

* feat(rendering): add battle lighting, actor appearance and native shadows

Support baked and toon lighting, actor and weapon rendering, display refresh rate and resource ownership.

* feat(effects): drive battle effects through shared resource previews

Bind battle control nodes to action owners. Share preview lighting, geometry and effect resources with the existing Unity editors.

* refactor(game): isolate story battle targeting and actor lifetimes

Preserve scene ownership, bound story battle targeting and stop debug attacks when their actor leaves the scene.

* feat(editor): compile original game data into battle scenarios

Build per-variant animation and ability catalogs, encounter music, scene lighting profiles, random parties, equipment and test inventory from the original resources.

* feat(editor): play battle sessions with animated previews and synced media

Drive the preview scene, camera, effects, hit feedback, result choreography, music and movies from simulation snapshots and events.

* feat(editor): add the battle workbench, native HUD and input controls

Expose scenario authoring, replay, diagnostics, responsive command menus and mouse, touch and gamepad targeting. Include the editor workflow and HUD integration tests.
2026-11-21 22:28:47 +08:00

3.1 KiB

C# code style

This .NET CLI formats the repository's owned C# sources under Assets/Scripts/ and Assets/Tests/. It calls the SDK's dotnet format with .editorconfig and StyleCop 1.3.180 layout rules SA1107, SA1502, SA1507 and SA1516. Roslyn identifies the C# text that must be preserved during incremental formatting. It checks both PAL3 and PAL3A conditional branches without Unity or original game data. The formatter and its tests need no Python; use the .NET SDK pinned in the repository's global.json.

Run commands from the repository root. The first run restores the tool's .NET dependencies. StyleCop is used only by the development tool and is not added to the Unity project.

Commands

Format current tracked changes and untracked owned C# files, then verify them:

dotnet run --project tools/CodeStyle --
dotnet run --project tools/CodeStyle -- --check

Check changes since the common ancestor of HEAD and a Git ref, including current working tree changes, as the pull request workflow does:

dotnet run --project tools/CodeStyle -- --check --base origin/main

Format whole files by selecting explicit repository-relative files or directories:

dotnet run --project tools/CodeStyle -- Assets/Scripts/Pal3.Core

Check every owned C# source, or show detailed formatter diagnostics:

dotnet run --project tools/CodeStyle -- --check --all
dotnet run --project tools/CodeStyle -- --check --verbose

Run the formatter's .NET regression tests:

dotnet test tools/CodeStyle.Tests

After the test command restores both projects, verify their own source whitespace with the same SDK checks used by CI:

dotnet format whitespace tools/CodeStyle --no-restore --verify-no-changes
dotnet format whitespace tools/CodeStyle.Tests --no-restore --verify-no-changes

Scope and preservation

Default and --base runs apply formatting only to changed lines and deletion boundaries. Git-detected renames use the original path for comparison, so a pure rename preserves the file byte for byte. Newly added and untracked files, explicit paths and --all use whole-file formatting. Third-party sources outside the owned directories are excluded. --base and --all are mutually exclusive, and neither can be combined with explicit paths.

Files with symbolic links in any component below the repository root are skipped by default and with --all. Explicit paths through symbolic links are rejected. The tool does not follow links into other source trees or replace links with ordinary files.

Check mode formats temporary copies and exits unsuccessfully if formatting is required; it does not rewrite source files. Formatting preserves each source file's BOM. Incremental formatting also preserves the existing line ending convention and protects C# literal contents and inactive conditional text. Whole-file formatting uses the complete SDK result and the .editorconfig line ending setting.

These checks cover whitespace and member layout. Run the relevant Unity tests after formatting to verify compilation and behavior. ShaderLab/HLSL formatting and rendering checks remain separate.