Beispiel #1
0
        public int createEmitter()
        {
            ParticleResourceModel resMd = new ParticleResourceModel();

            md.lstResource.Add(resMd);

            int idx = lstVM.Count;

            if (idx > 0)
            {
                lstVM[idx - 1].IsLast = false;
            }

            ParticleEditVM vm = new ParticleEditVM()
            {
                idx    = idx,
                md     = resMd,
                Image  = null,
                IsLast = true
            };

            lstVM.Add(vm);

            return(idx);
        }
Beispiel #2
0
        public void load(string path)
        {
            path = path.Trim(new char[] { '/', '\\', ' ', '\t' });
            string xmlPath = path + "/config.gife";

            md      = new ParticleEditModel();
            md.path = path;
            md.name = new Regex(".*?([^\\/]*$)").Replace(path, "$1");

            srv    = new XmlModelServer(md, xmlPath);
            md.srv = srv;
            md.srv.loadFromXml();

            MainModel.ins.particleEditModel = md;

            //md.srv.save();

            lstVM.Clear();
            for (int i = 0; i < md.lstResource.Count; ++i)
            {
                string         imgPath = md.lstResource[i].path;
                ImageSource    img     = loadImage(imgPath, path);
                ParticleEditVM vm      = new ParticleEditVM()
                {
                    idx     = i,
                    md      = md.lstResource[i],
                    Image   = img,
                    ImgName = Path.GetFileName(imgPath)
                };
                lstVM.Add(vm);
            }

            if (lstVM.Count > 0)
            {
                lstVM.Last().IsLast = true;
            }
        }