コード例 #1
0
        protected PresentationModel ExtractModel()
        {
            var model = new PresentationModel();

            model.name = presentationName;

            foreach (var slide in GetComponentsInChildren <Slide>())
            {
                model.slides.Add(slide.ExtractModel());
            }

            return(model);
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }