public PersistableClassTreeNode(PersistableClass cls) { _class = cls; if (_class == null) { return; } base.Text = _class.Name; }
public void Load(PersistableClass o) { Debug.Log("Loading file: " + this.savePath); if (!File.Exists(this.savePath)) { Debug.Log("First time playing. Loading canceled!"); return; } using ( var reader = new BinaryReader(File.Open(savePath, FileMode.Open)) ) { o.Load(new GameDataReader(reader)); } }
public void Save(PersistableClass o) { Debug.Log("Saving file: " + this.savePath); #if UNITY_WEBGL o.Save(new GameDataWriter(null)); #else using ( var writer = new BinaryWriter(File.Open(savePath, FileMode.Create)) ) { o.Save(new GameDataWriter(writer)); } #endif }
private void AddPersisableClass(PersistableClass cls, TreeNode parent) { if (cls == null) { return; } PersistableClassTreeNode node = new PersistableClassTreeNode(cls); if (parent == null) { treeView1.Nodes.Add(node); } else { parent.Nodes.Add(node); } foreach (PersistableClass child in cls.ChildClasses) { AddPersisableClass(child, node); } }