v0.1.7 - Added Godot (and other engines) Support


Hi! After the whole Unity debacle,  I've been upgrading the Dialogue Visual Editor to be able to save projects and import them into other engines that use C#, especially Godot. For that, I've used Newtonsoft.Json to serialize the SavedData class into a JSON. So now you have the option to save it with Unity serializer or Newtonsoft's one!


Also, is retrocompatible! You can load a Unity serialized JSON and save it as a Newtonsoft one and vice-versa.

The only extra step is adding Newtonsoft.JSON to your project and a custom serialization binding when deserializing. This is an example for godot.

using Godot;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
public static class JsonSerialization
{
     private static JsonSerializerSettings SerializerSettings => new JsonSerializerSettings()
     {
         ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
         TypeNameHandling = TypeNameHandling.All,
         Formatting = Formatting.Indented,
         SerializationBinder = new MySerializationBinder()
     };
      
     public static SavedData ReadJson(string json)
     {
         string storyJson = FileAccess.Open(json, FileAccess.ModeFlags.Read).GetAsText();
         return JsonConvert.DeserializeObject<saveddata>(storyJson, SerializerSettings);
     }
}
public class MySerializationBinder : DefaultSerializationBinder {
     public override Type BindToType(string assemblyName, string typeName)
     {
         switch(typeName)
         {
             case "SavedData": return typeof(SavedData);
             case "NodeData": return typeof(NodeData);
             case "LineData": return typeof(LineData);
             case "DialogueLineData": return typeof(DialogueLineData);
             case "ActionLineData": return typeof(ActionLineData);
             case "GoToLineData": return typeof(GoToLineData);
             case "ConditionalType": return typeof(ConditionalType);
             case "ConditionalLineData": return typeof(ConditionalLineData);
             case "ChoiceData": return typeof(ChoiceData);
             case "System.Collections.Generic.List`1[[NodeData, Assembly-CSharp]]": return typeof(List<nodedata>);
             case "System.Collections.Generic.List`1[[LineData, Assembly-CSharp]]": return typeof(List<linedata>);
             case "System.Collections.Generic.List`1[[ConditionalLineData, Assembly-CSharp]]": return typeof(List<conditionallinedata>);
             default: return base.BindToType(assemblyName, typeName);
         }
     }
      
     public override void BindToName(Type serializedType, out string assemblyName, out string typeName)
     {
         assemblyName = null;
         typeName = serializedType.Name;
     }
 }


Other additions to the 0.1.7 version:

  • The Save button will automatically save with your last saving configuration and override your last save. In case you never saved before, it will ask for a path and default for Newtonsonf serialization.
  • The Dialogue Simulator will show errors. Various errors related to invalid conditional comparisons have been added.

Files

Dialogue Visual Editor - Win64 23 MB
Version 0.1.7 Nov 03, 2023
Files 5.4 kB
Version 0.1.7 Nov 03, 2023

Get Dialogue Visual Editor

Buy Now$15.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.