コード例 #1
0
 private SceneControl AddSceenControl(Scene scene)
 {
     SceneControl sceneControl = new SceneControl(scene);
     ScenesWrapPanel.Children.Add(sceneControl);
     sceneControl.Removed += new EventHandler(sceneControl_Removed);
     return sceneControl;
 }
コード例 #2
0
 public SceneControl(Scene scene)
 {
     this.InitializeComponent();
     Scene = scene;
     SceneNameTextBox.Text = scene.Name;
     Scene.Playing += new EventHandler(Scene_Playing);
     Scene.Stopping += new EventHandler(Scene_Stopping);
 }
コード例 #3
0
 private void AddSceneButton_Click(object sender, RoutedEventArgs e)
 {
     Scene scene = new Scene();
     Module.Scenes.Add(scene);
     AddSceenControl(scene);
     SoundEffect soundEffect = new SoundEffect();
     scene.SoundEffects.Add(soundEffect);
     Sample sample = new Sample();
     soundEffect.Samples.Add(sample);
     Module.ReverbTime = 0;
     Module.ReverbMix = 0;
 }
コード例 #4
0
        public SceneEditor(Scene sceneToEdit)
        {
            this.InitializeComponent();
            Scene = sceneToEdit;

            foreach (SoundEffect soundEffect in Scene.SoundEffects)
            {
                AddSoundEffectControl(soundEffect);
            }

            SceneNameTextBox.Text = Scene.Name;
            StopOthersCheckBox.IsChecked = Scene.StopsOthers;
            FadeOutCheckBox.IsChecked = Scene.FadesOut;
            PlayStopButton.IsChecked = Scene.IsPlaying;
            FadeOutSlider.Value = Scene.FadeOutLength;
            SceneVolumeSlider.Value = Scene.SceneVolume;
            FadeOutSlider.IsEnabled = Scene.FadesOut;

            AttachEvents();
        }
コード例 #5
0
ファイル: Softrope.cs プロジェクト: softrope/softrope-desktop
        public static void SaveSceneZip(Scene scene, string path)
        {
            using (ZipOutputStream zipStream = new ZipOutputStream(File.Create(path)))
            {
                zipStream.SetLevel(0);

                XmlSerializer serializer = new XmlSerializer(typeof(Scene));
                MemoryStream ms = new MemoryStream();
                TextWriter writer = new StreamWriter(ms, new UTF8Encoding());
                serializer.Serialize(writer, scene);
                writer.Close();

                ZipEntry manifest = new ZipEntry("manifest.xml");

                manifest.DateTime = DateTime.Now;

                zipStream.PutNextEntry(manifest);

                zipStream.Write(ms.ToArray(),0,ms.ToArray().Length);

                foreach (SoundEffect soundEffect in scene.SoundEffects)
                {
                    foreach (Sample sample in soundEffect.Samples)
                    {
                        ZipEntry sampleEntry = new ZipEntry(Path.GetFileName(sample.FileName));
                        zipStream.PutNextEntry(sampleEntry);
                        Byte[] sampleBytes = File.ReadAllBytes(sample.FileName);
                        zipStream.Write(sampleBytes, 0, sampleBytes.Length);
                    }
                }

                zipStream.Finish();
                zipStream.Close();

            }
        }