private void LoadPainting() { _isLoadingPainting = true; PaintingData p = Storage.Load(); if (p != null) { ClearPainting(); Queue <Stroke> paintingStrokes = new Queue <Stroke>(); foreach (List <StrokeData> strokeDataList in p.strokes) { SetPaint(strokeDataList[0].color); Stroke stroke = new Stroke(this.transform, pencil.transform, paint); stroke.SetStrokeData(strokeDataList); paintingStrokes.Enqueue(stroke); } while (paintingStrokes.Count > 0) { strokesUndone.Push(paintingStrokes.Dequeue()); } RedoStroke(); } }
private void Start() { for (int i = 0; i < _paintingDatas.Length; i++) { string get = _paintingDatas[i].ToString(); PaintingData newData = JsonUtility.FromJson <PaintingData>(get); _data.Add(newData); } }
public static void Save(PaintingData p) { BinaryFormatter bf = CreatePaintingBinaryFormatter(); FileStream file = File.Create(filePath); bf.Serialize(file, p); file.Close(); Debug.Log("Saved Painting: " + p.name); }
public void Init(ARTrackedImage image) { PaintingsDataStorage paintingsDataStorage = PaintingsDataStorage.GetInstance; _paintingData = paintingsDataStorage.GetPaintingData(image.referenceImage.name); _paintingTitle.text = _paintingData.Title; _paintingAuthor.text = _paintingData.Author; _paintingInfo.text = _paintingData.Info; transform.parent = image.transform; transform.localPosition = _offset; }
private void SavePainting() { PaintingData p = new PaintingData(); p.name = "testPainting"; List <List <StrokeData> > paintingStrokeData = new List <List <StrokeData> >(); foreach (Stroke s in strokesDone) { paintingStrokeData.Add(s.GetStrokeData()); } p.strokes = paintingStrokeData; Storage.Save(p); }
public static PaintingData Load() { if (File.Exists(filePath)) { BinaryFormatter bf = CreatePaintingBinaryFormatter(); FileStream file = File.Open(filePath, FileMode.Open); PaintingData p = (PaintingData)bf.Deserialize(file); file.Close(); Debug.Log("Loaded Painting: " + p.name); return(p); } else { Debug.Log("File not found: " + filePath); return(null); } }
public uint?GetPaintingAddress() { PaintingData paintingData = _listBoxPainting.SelectedItem as PaintingData; return(paintingData?.GetAddress()); }