Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public DataObject Copy(Sprite parent)
        {
            var newCostumeData = new Costume(name, parent);

            string path = CatrobatContext.Instance.CurrentProject.BasePath + "/" + Project.ImagesPath + "/";
            string absoluteFileNameOld = path + fileName;
            string absoluteFileNameNew = path + newCostumeData.fileName;

            using (IStorage storage = StorageSystem.GetStorage())
            {
                //if (storage.FileExists(absoluteFileNameOld))
                storage.CopyFile(absoluteFileNameOld, absoluteFileNameNew);
                //else
                //  MessageBox.Show("Das Kostüm konnte nicht kopiert werden.", "Kopieren nicht möglich", MessageBoxButton.OK); // TODO: is this used? names should be unique
            }

            return newCostumeData;
        }
 public void CleanUpCostumeReferences(Costume deletedCostume, Sprite selectedSprite)
 {
     foreach (Script script in selectedSprite.Scripts.Scripts)
     foreach (Brick brick in script.Bricks.Bricks)
       if (brick is SetCostumeBrick)
     (brick as SetCostumeBrick).UpdateReference();
 }
Ejemplo n.º 4
0
        private void DeleteCostumeAction(Costume costume)
        {
            costume.Delete();

              CostumeList costumeList = SelectedSprite.Costumes;
              costumeList.Costumes.Remove(costume);

              CatrobatContext.Instance.CleanUpCostumeReferences(costume, costume.Sprite);
        }
Ejemplo n.º 5
0
        private void CopyCostumeAction(Costume costume)
        {
            Costume newCostume = costume.Copy(SelectedSprite) as Costume;

              CostumeList costumeList = SelectedSprite.Costumes;
              costumeList.Costumes.Add(newCostume);
        }
Ejemplo n.º 6
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     Costume = null;
       NavigationService.GoBack();
 }