Changeset 425 for binary-improvements2/WebServer/src/WebAPI/JsonCommons.cs
- Timestamp:
- Apr 10, 2023, 8:23:15 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/WebAPI/JsonCommons.cs
r408 r425 1 using System; 2 using UnityEngine; 1 3 using Utf8Json; 2 4 … … 19 21 _writer.WriteEndObject (); 20 22 } 21 23 24 public static void WritePositionObject (ref JsonWriter _writer, Vector3 _position) { 25 _writer.WriteRaw (jsonKeyPositionX); 26 _writer.WriteSingle (_position.x); 27 28 _writer.WriteRaw (jsonKeyPositionY); 29 _writer.WriteSingle (_position.y); 30 31 _writer.WriteRaw (jsonKeyPositionZ); 32 _writer.WriteSingle (_position.z); 33 34 _writer.WriteEndObject (); 35 } 36 37 private static readonly byte[] jsonKeyCombinedString = JsonWriter.GetEncodedPropertyNameWithBeginObject ("combinedString"); 38 private static readonly byte[] jsonKeyPlatformId = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("platformId"); 39 private static readonly byte[] jsonKeyUserId = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("userId"); 40 41 public static void WritePlatformUserIdentifier (ref JsonWriter _writer, PlatformUserIdentifierAbs _userIdentifier) { 42 if (_userIdentifier == null) { 43 _writer.WriteNull (); 44 return; 45 } 46 47 _writer.WriteRaw (jsonKeyCombinedString); 48 _writer.WriteString (_userIdentifier.CombinedString); 49 50 _writer.WriteRaw (jsonKeyPlatformId); 51 _writer.WriteString (_userIdentifier.PlatformIdentifierString); 52 53 _writer.WriteRaw (jsonKeyUserId); 54 _writer.WriteString (_userIdentifier.ReadablePlatformUserIdentifier); 55 56 _writer.WriteEndObject (); 57 } 58 59 public static void WriteDateTime (ref JsonWriter _writer, DateTime _dateTime) { 60 _writer.WriteString (_dateTime.ToString ("o")); 61 } 22 62 } 23 63 }
Note:
See TracChangeset
for help on using the changeset viewer.