🏗️ Architecture Overview

To use the CSV Standard suite effectively, it is essential to understand the relationship between the Table, the Record, and the Data Flow. This architecture bridges the gap between raw data and your game systems.


1. The Table (The Orchestrator)

The CSVTable<T> acts as the primary controller for your data collections.

  • Collection Management: Manages a List<T> where T inherits from CSVRecord.
  • Reflection Engine: Automatically maps CSV columns to your class fields using C# Reflection.
  • Validation: Includes a “Hardened Type Gate” to ensure data integrity during type conversion.

2. The Record (The Data Object)

The CSVRecord is a ScriptableObject representing a single row of data, fulfilling two roles simultaneously:

  • The Live Class: Holds standard C# fields for direct use in game logic.
  • The Shadow Dictionary: Maintains a private rawValues dictionary that preserves unmapped source columns to guarantee lossless round-tripping.

3. The Data Flow (Hydration & Saving)

Standard manages data through a specialized transformation process:

  1. Hydration (Loading): The Table ingests a raw string grid, applies inbound hooks (OnImportField), and populates the live fields alongside the Shadow Dictionary.
  2. Persistence (Saving): When saving, the framework merges live fields with the Shadow Dictionary, runs outbound hooks (OnExportField), and serializes the output back into an RFC 4180 compliant format.

Summary Table

ObjectTechnical RoleResponsibility
CSVTable<T>OrchestratorManaging the record collection, reflection mapping, and shadow merging.
CSVRecordData ContainerStoring live gameplay values and the rawValues shadow dictionary.
ICSVDisplayable<T>InterfaceActing as the bridge between your data and your UI components.