Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Newtonsoft.Json;
- using UniRx;
- using UnityEngine;
- public class IntReactivePropertyJsonConverter : JsonConverter<IntReactiveProperty>
- {
- public override void WriteJson(JsonWriter writer, IntReactiveProperty value, JsonSerializer serializer)
- {
- Debug.Log(nameof(WriteJson));
- Debug.Log("value.Value = " + value.Value);
- writer.WriteValue(value.Value);
- }
- public override IntReactiveProperty ReadJson(
- JsonReader reader,
- Type objectType,
- IntReactiveProperty existingValue,
- bool hasExistingValue,
- JsonSerializer serializer)
- {
- Debug.Log(nameof(ReadJson));
- object readerValue = reader.Value;
- Debug.Log("readerValue = " + readerValue);
- var s = readerValue.ToString();
- Debug.Log("s = " + s);
- int value = int.Parse(s);
- Debug.Log("value = " + value);
- return new IntReactiveProperty(value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement