Elin Decompiled Documentation EA 23.251 Nightly
Loading...
Searching...
No Matches
GameSerializationBinder.cs
Go to the documentation of this file.
1using System;
2using Newtonsoft.Json.Serialization;
3using UnityEngine;
4
5public class GameSerializationBinder : DefaultSerializationBinder, ISerializationBinder
6{
8
9 public override Type BindToType(string assemblyName, string typeName)
10 {
11 try
12 {
13 return base.BindToType(assemblyName, typeName);
14 }
15 catch (Exception ex)
16 {
17 Core.Instance.ui.Say("Possible Mod Error, please contact the mod auther.");
18 Core.Instance.ui.Say(ex.Message);
19 Debug.LogError(ex.Message);
20 Debug.LogError(assemblyName + "/" + typeName);
21 if (ModUtil.fallbackTypes.ContainsKey(typeName))
22 {
23 Debug.Log(typeName + "/" + Type.GetType(ModUtil.fallbackTypes[typeName]));
24 return Type.GetType(ModUtil.fallbackTypes[typeName]);
25 }
26 if (typeName.StartsWith("Quest"))
27 {
28 return typeof(QuestDummy);
29 }
30 if (typeName.StartsWith("Zone"))
31 {
32 return typeof(Zone);
33 }
34 return typeof(UnknownTypePlaceholder);
35 }
36 }
37}
Definition: Core.cs:14
static new Core Instance
Definition: Core.cs:15
UI ui
Definition: Core.cs:63
override Type BindToType(string assemblyName, string typeName)
static readonly GameSerializationBinder Instance
static Dictionary< string, string > fallbackTypes
Definition: ModUtil.cs:10
Definition: Zone.cs:12