protected PresentationModel ExtractModel() { var model = new PresentationModel(); model.name = presentationName; foreach (var slide in GetComponentsInChildren <Slide>()) { model.slides.Add(slide.ExtractModel()); } return(model); }
protected void SetModel(PresentationModel model) { presentationName = model.name; GetComponentsInChildren <Slide>().DestroyAllGameObjects(); foreach (var slideModel in model.slides) { var slideObject = Instantiate(slidePrefab); slideObject.SetModel(this, slideModel); slideObject.transform.parent = transform; } }
public PresentationModel MakeDefault() { var model = new PresentationModel(); var slide1 = new SlideModel(); slide1.name = "Test slide 1"; model.slides.Add(slide1); var slide2 = new SlideModel(); slide2.name = "Test slide 2"; model.slides.Add(slide2); return(model); }
public void Load() { string json = File.ReadAllText(presentationFile); PresentationModel model; if (json != null && json.Length > 0) { model = new PresentationModel(); model.LoadFromJson(json); } else { model = MakeDefault(); } SetModel(model); }