private void initCurrentProject()
        {
            var project = new Project
                {
                    ApplicationVersionCode = 1,
                    ApplicationVersionName = "Version 1",
                    DeviceName = "Device1",
                    ProjectName = "Project1",
                    ScreenHeight = 800,
                    ScreenWidth = 480,
                    PlatformVersion = "7.1.1",
                    Platform = "Windows Phone 7.5"
                };

            // TODO: implement other design data here

            var sprites = new SpriteList(project);
            var sprite = new Sprite(project);
            sprite.Name = "Object 1";

            sprite.Costumes = new CostumeList(sprite);
            var costume = new Costume("Cat", sprite);
            var image = new byte[0]; //new BitmapImage(new Uri(costume.FileName, UriKind.Relative)); // TODO: fix me
            //costume.Image = image;
            sprite.Costumes.Costumes.Add(costume);

            sprite.Sounds = new SoundList(sprite);
            var sound = new Sound("Miau_Sound", sprite);
            sprite.Sounds.Sounds.Add(sound);

            sprite.Scripts = new ScriptList(sprite);
            Script startScript = new StartScript(sprite);

            startScript.Bricks = new BrickList(sprite);
            var setCostumeBrick = new SetCostumeBrick(sprite);
            var costumeRef = new CostumeReference(sprite);
            costumeRef.Costume = costume;
            //setCostumeBrick.Costume = costumeRef;

            //TODO: Add more Bricks if you need them

            sprites.Sprites.Add(sprite);

            currentProject = project;
        }
Exemple #2
0
        protected override void LoadFromXML(String xml)
        {
            document = XDocument.Load(new StringReader(xml));
              document.Declaration = new XDeclaration("1.0", "UTF-8", "yes");

              Converter.Convert(document);

              XElement project = document.Element("project");
              applicationVersionCode = int.Parse(project.Element("applicationVersionCode").Value);
              applicationVersionName = project.Element("applicationVersionName").Value;
              if (project.Element("applicationXmlVersion") != null)
            applicationXmlVersion = double.Parse(project.Element("applicationXmlVersion").Value,
                                             CultureInfo.InvariantCulture);
              deviceName = project.Element("deviceName").Value;
              platform = project.Element("platform").Value;
              platformVersion = project.Element("platformVersion").Value;
              projectName = project.Element("projectName").Value;
              screenHeight = int.Parse(project.Element("screenHeight").Value);
              screenWidth = int.Parse(project.Element("screenWidth").Value);

              spriteList = new SpriteList(this);
              spriteList.LoadFromXML(project.Element("spriteList"));
        }