OSDN Git Service

W.I.P. VI: Automap Commanded by local event bus
[automap/automap.git] / Automap / Data / CommandData.cs
diff --git a/Automap/Data/CommandData.cs b/Automap/Data/CommandData.cs
new file mode 100644 (file)
index 0000000..ccce2df
--- /dev/null
@@ -0,0 +1,67 @@
+using System;
+using System.IO;
+
+using Vintagestory.API.Common;
+using Vintagestory.API.Datastructures;
+
+namespace Automap
+{
+       public class CommandData : IAttribute
+       {
+               public RunState State { get; set; }//Run , Stop, SingleSnapshot -> Stop
+
+               //POI Delegate list {enabled/Disable}
+               //Other params...? Tick rate?
+               //Choose : Renderer(s)
+
+
+               public CommandData( RunState assumeState)
+               {
+               State = assumeState;
+
+               }
+
+
+
+               public void FromBytes(BinaryReader stream)
+               {
+               State = ( RunState )stream.ReadByte( );
+               
+
+               }
+
+               public int GetAttributeId( )
+               {
+               return 12346;
+               }
+
+               public object GetValue( )
+               {
+               return this;
+               }
+
+               public void ToBytes(BinaryWriter stream)
+               {
+               stream.Write(( byte )State);
+               
+               }
+
+               public string ToJsonToken( )
+               {
+               return $"New-State:{State},  ";
+               }
+
+               public bool Equals(IWorldAccessor worldForResolve, IAttribute attr)
+               {
+               var other = attr.GetValue( ) as CommandData;
+
+                       if (this.State == other.State )
+                       {
+                       return true;
+                       }
+
+               return false;
+               }
+       }
+}
+