The level format's contribution for managed properties.
The native side treats what this produces as text it does not interpret: it writes the text as a node under the entity, and it hands the text it read back here. That is what lets a property hold anything the json writer can express, and what lets a level written with this extension still be saved by a build that does not have it.
Entity references inside a property are written as the guid the file names the target by, and read back through the map the file gives. The level format cannot resolve them on its own, because it does not read this text, so it hands the map here before the call that needs it. Without a map a reference writes as null, which is what a build that has no file to resolve against gets.
|
| static string | Utf8 (IntPtr ptr, int length) |
| | Text from a pointer the native side owns.
|
| static void | SetRefContext (string pairs) |
| | The file's guid map, as "guid:entityId" pairs.
|
| static bool | IsAuthored (ulong entityId, string path) |
| static List< string > | CollectKeys (string text) |
| | The keys one text carries, as "property.field" paths.
|
| static int | JsonKeys (string text, IntPtr outBuffer, int maxLen) |
| static string | MergeJson (string baseText, string overText) |
| | What the base text gives when the keys the other text carries are put over it.
|
| static int | MergeJson (string baseText, string overText, IntPtr outBuffer, int maxLen) |
| static string | Resolve (string baseText, string keys) |
| | The text for the named keys, each value read from the base text, or the field's default when the base has nothing.
|
| static int | Resolve (string baseText, string keys, IntPtr outBuffer, int maxLen) |
| static void | RegisterAssembly (Assembly assembly) |
| | The property types of an assembly, by the name the level file carries them under.
|
| static void | ClearAssembly (Assembly assembly) |
| | The property types of an assembly that is going away.
|
| static int | SerializeEntity (ulong entityId, IntPtr outBuffer, int maxLen) |
| | The json object of one entity's properties, written into a buffer the native side owns.
|
| static int | SerializeKeys (ulong entityId, string keys, IntPtr outBuffer, int maxLen) |
| | The entity's text with only the keys it authored, as the newline separated paths the level format holds for it.
|
| static unsafe int | ApplyEntity (ulong entityId, IntPtr jsonUtf8, int length) |
| | One entity, put back from the json the file carried for it.
|
| static void | RecordChange (ulong entityId, Type type, string fieldName, string valueJson) |
| | The write path the inspector uses.
|
| static void | DrawProperties (ulong entityId) |
| | The property section the inspector draws.
|
| static int | HasProperty (ulong entityId, string propertyName) |
| | Whether the entity has the property.
|
| static int | DefaultPropertyJson (string propertyName, IntPtr outBuffer, int maxLen) |
| | The text a default instance of the type produces, which is what an editor's add writes.
|
| static string | BuildJsonText (Nebula.Game.Entity entity, HashSet< string > keys) |
|
| static | PropertyLevelFormat () |
| static string | KeyPath (string propertyName, string fieldName) |
| static List< string > | SplitKeys (string keys) |
| static void | WriteMerged (Utf8JsonWriter writer, JsonNode baseNode, bool hasBase, JsonNode overNode, bool hasOver) |
| static void | WriteNode (Utf8JsonWriter writer, JsonNode node) |
| static int | WriteNames (List< string > names, IntPtr outBuffer, int maxLen) |
| static int | WriteText (string text, IntPtr outBuffer, int maxLen) |
| static int | WriteBytes (byte[] bytes, IntPtr outBuffer, int maxLen) |
| static void | MirrorNames () |
| static void | DrawProperty (ulong entityId, Nebula.Game.Property property) |
| static void | DrawField (ulong entityId, Type type, Nebula.Game.Property property, FieldInfo field) |
| static byte | ToByte (float value) |
| static bool | DrawEnum (string key, Type enumType, object current, out int index, string description) |
| static int | ApplyProperty (Nebula.Game.Entity entity, string propertyName, string json) |
| static Nebula.Game.Entity | ResolveEntity (World world, UInt64 id) |
| static Type | GetPropertyType (string propertyName) |
| static List< Nebula.Game.Property > | SortedProperties (Nebula.Game.Entity entity) |
| static byte[] | BuildJson (Nebula.Game.Entity entity, HashSet< string > keys) |
| static string | BuildChangeJson (Nebula.Game.Entity entity, Type type, string fieldName, string valueJson) |
| static bool | AnyKeyFor (HashSet< string > keys, Type type) |
| static void | WritePropertyFields (Utf8JsonWriter writer, Type type, Nebula.Game.Property property, string fieldName, string valueJson, HashSet< string > keys) |
| static FieldInfo[] | GetSerializableFields (Type type) |
| unsafe int Nebula.PropertyLevelFormat.ApplyEntity |
( |
ulong | entityId, |
|
|
IntPtr | jsonUtf8, |
|
|
int | length ) |
|
inlinestatic |
One entity, put back from the json the file carried for it.
Exact: the entity's properties are the nodes the text names, and what it does not name is taken off. A command holds the entity's whole text, so this is what makes a change that took one property off read as a change rather than as an addition. A property the text names but the assembly does not have is skipped, because there is no type to make it from.
| void Nebula.PropertyLevelFormat.RecordChange |
( |
ulong | entityId, |
|
|
Type | type, |
|
|
string | fieldName, |
|
|
string | valueJson ) |
|
inlinestatic |
The write path the inspector uses.
It does not write the field: it works out what the entity's text would be after the change and hands the before and the after text to the editor, which is what runs the change through a command. That is why the command is the only place a property changes, and why plugin code that sets a field directly does not record anything: a runtime change is not an authoring change.
A null field means the property is left out, which is what a removal reports. The path is what the recorder builds the override marker from, and it is the only thing that says which key inside the text changed. A property the entity did not have is reported as the whole property, which is what the recorder reads as an add: every key the after text carries for it is the entity's own.