Преглед изворни кода

Add ISerializable interface

habeebweeb пре 4 година
родитељ
комит
09d234450e

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManager.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal class EffectManager : IManager
+    internal class EffectManager : IManager, ISerializable
     {
         public const string header = "EFFECT";
         public const string footer = "END_EFFECT";

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/IEffectManager.cs

@@ -1,6 +1,6 @@
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal interface IEffectManager : IManager
+    internal interface IEffectManager : IManager, ISerializable
     {
         bool Ready { get; }
         bool Active { get; }

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EnvironmentManager.cs

@@ -3,7 +3,7 @@ using UnityEngine;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal class EnvironmentManager : IManager
+    internal class EnvironmentManager : IManager, ISerializable
     {
         public const string header = "ENVIRONMENT";
         private static bool cubeActive;

+ 0 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/IManager.cs

@@ -5,7 +5,5 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         void Update();
         void Activate();
         void Deactivate();
-        void Serialize(System.IO.BinaryWriter binaryWriter);
-        void Deserialize(System.IO.BinaryReader binaryReader);
     }
 }

+ 8 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/ISerializable.cs

@@ -0,0 +1,8 @@
+namespace COM3D2.MeidoPhotoStudio.Plugin
+{
+    internal interface ISerializable
+    {
+        void Serialize(System.IO.BinaryWriter binaryWriter);
+        void Deserialize(System.IO.BinaryReader binaryReader);
+    }
+}

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/LightManager.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal class LightManager : IManager
+    internal class LightManager : IManager, ISerializable
     {
         public const string header = "LIGHT";
         private List<DragPointLight> lightList = new List<DragPointLight>();

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MeidoManager.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal class MeidoManager : IManager
+    internal class MeidoManager : IManager, ISerializable
     {
         public const string header = "MEIDO";
         private static CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MessageWindowManager.cs

@@ -3,7 +3,7 @@ using UnityEngine;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal class MessageWindowManager : IManager
+    internal class MessageWindowManager : IManager, ISerializable
     {
         public const string header = "TEXTBOX";
         public static readonly SliderProp fontBounds = new SliderProp(25f, 60f);

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/PropManager.cs

@@ -7,7 +7,7 @@ using UnityEngine.Rendering;
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     using static MenuFileUtility;
-    internal class PropManager : IManager
+    internal class PropManager : IManager, ISerializable
     {
         public const string header = "PROP";
         private MeidoManager meidoManager;

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/WindowManager.cs

@@ -4,7 +4,7 @@ using UnityEngine;
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     using static Constants;
-    internal class WindowManager
+    internal class WindowManager : IManager
     {
         private Dictionary<Window, BaseWindow> Windows = new Dictionary<Window, BaseWindow>();
         private List<BaseWindow> WindowList = new List<BaseWindow>();

+ 4 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/Meido.cs

@@ -9,7 +9,7 @@ using static TBody;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal class Meido
+    internal class Meido : ISerializable
     {
         private const int maxMaids = 12;
         public static readonly PoseInfo DefaultPose =
@@ -468,7 +468,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             binaryWriter.Write("END_FACE");
         }
 
-        public void Deserialize(BinaryReader binaryReader, bool mmScene = false)
+        public void Deserialize(BinaryReader binaryReader) => Deserialize(binaryReader, false);
+
+        public void Deserialize(BinaryReader binaryReader, bool mmScene)
         {
             Maid.GetAnimation().Stop();
             binaryReader.ReadInt64(); // meido buffer length