using UnityEngine; using System.Collections; using System.Collections.Generic; using System; public class NetworkTreeOperationLog : TreeOperationLog { public LinkedList list; public int Size; public string Uuid; public string TreeName; public long TimeStamp; public NetworkTreeOperationLog () { list = new LinkedList(); this.Size = 0; this.TreeName = ""; this.TimeStamp = DateTime.Now.ToBinary(); } public NetworkTreeOperationLog(string uid, string name, IEnumerable _list) { this.list = new LinkedList(); this.Uuid = uid; this.Size = 0; this.TreeName = name; this.TimeStamp = DateTime.Now.ToBinary(); foreach(var op in _list) { NetworkTreeOperation nOp = new NetworkTreeOperation(op); this.list.AddLast(nOp); } this.Size = this.list.Count; } public NetworkTreeOperationLog (string uid, string name, IEnumerable _list, long timestamp) { this.Uuid = uid; this.TreeName = name; this.list = new LinkedList(); this.Size = 0; this.TimeStamp = timestamp; foreach(var op in _list) { NetworkTreeOperation nOp = new NetworkTreeOperation(op); this.list.AddLast(nOp); } this.Size = this.list.Count; } public NetworkTreeOperationLog (IEnumerable _list) { this.Uuid = ""; this.TreeName = ""; this.list = new LinkedList(); this.Size = 0; this.TimeStamp = DateTime.Now.ToBinary(); foreach(var op in _list) { NetworkTreeOperation nOp = new NetworkTreeOperation(op); this.list.AddLast(nOp); } this.Size = this.list.Count; } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } public IEnumerator GetEnumerator() { foreach(NetworkTreeOperation l in list){ yield return l; } } public TreeOperationLog add (NodePath path, NodeOperation op) { NetworkTreeOperation nOp = new NetworkTreeOperation(path, op); this.list.AddLast(nOp); this.Size = list.Count; return this; } public TreeOperationLog append (TreeOperationLog log) { foreach(TreeOperation o in log) { NetworkTreeOperation op = new NetworkTreeOperation(o); this.list.AddLast(op); } this.Size = list.Count; return this; } public int length () { return this.list.Count; } public string getUuid() { return Uuid; } public string getTreeName () { return TreeName; } public long getTimeStamp () { return TimeStamp; } public void setTimeStamp (long timestamp) { this.TimeStamp = timestamp; } }