drawingcommand parseSaveCmdLine(string textLine) { string[] values = textLine.Split(','); int _index = Int32.Parse(values [0]); int _objType = Int32.Parse(values [1]); Vector3 _position = new Vector3(Convert.ToSingle(values [2]), Convert.ToSingle(values [3]), Convert.ToSingle(values [4])); Color _color = new Color(Convert.ToSingle(values [5]), Convert.ToSingle(values [6]), Convert.ToSingle(values [7])); float _lineWidth = Convert.ToSingle(values [8]); drawingcommand theCmd = new drawingcommand(_index, _objType, _position, _color, _lineWidth); return(theCmd); }
public void loadFromDrawingHistory() { // read history file FileInfo historyFile = new FileInfo(Application.persistentDataPath + "/historyFile.txt"); StreamReader sr = historyFile.OpenText(); string text; do { text = sr.ReadLine(); if (text != null) { // Create drawing command structure from string. drawingcommand lineCmd = parseSaveCmdLine(text); drawingHistory.Add(lineCmd); } } while (text != null); // load into scene }
public void addDrawingCommand(int index, int objType, Vector3 position, Color color, float lineWidth) { drawingcommand newCommand = new drawingcommand(index, objType, position, color, lineWidth); drawingHistory.Add(newCommand); }