public void GetData() { SaveToTxt save = new SaveToTxt(); PointSave pointSave = new PointSave(); pointSave.InitObject(); points.GetDataPoint(data, pointSave); level.SetData(pointSave); string saveText; SaveController.Save <PointSave>(pointSave, out saveText); save.WriteString(pointSave.nameLevel, saveText); SceneManager.LoadScene("Redactor"); }
public void GetDataPoint(RedactorData redactorData, PointSave pointSave) { float diffX = Vector2.Distance(new Vector2(redactorData.minBorder.x, 0), new Vector2(redactorData.maxBorder.x, 0)); float diffY = Vector2.Distance(new Vector2(0, redactorData.minBorder.y), new Vector2(0, redactorData.maxBorder.y)); pointSave.saveData = new List <PointData>(); for (int i = 0; i < listPoints.Count; i++) { PointData pointData = new PointData(); pointData.X_data = GetPercent(listPoints[i].transformObj.localPosition.x, diffX, redactorData.minBorder.x); pointData.Y_data = GetPercent(listPoints[i].transformObj.localPosition.y, diffY, redactorData.minBorder.y); pointSave.saveData.Add(pointData); } }
DataShape LoadLevel(string levelName) { string levelData; SaveToTxt saveToTxt = new SaveToTxt(); saveToTxt.ReadString(levelName, out levelData); PointSave pointSave = new PointSave(); pointSave.InitObject(); SaveController.Load <PointSave>(ref pointSave, levelData); DataShape shape = new DataShape(); shape.sprite = Resources.Load <Sprite>("Shape/" + pointSave.nameImage); shape.pointData = pointSave.saveData; return(shape); }
public void SetData(PointSave pointSave) { pointSave.nameLevel = nameLevel.text; pointSave.nameImage = nameImage.text; }