Beispiel #1
0
        private void OpenBulletPhysics_Click(object sender, RoutedEventArgs e)
        {
            BinaryFormatter formatter    = new BinaryFormatter();
            TextBlock       selectedFile = (TextBlock)BulletPreset.SelectedItem;

            try
            {
                using (FileStream fs = new FileStream(Environment.CurrentDirectory + "/data/mapeditor/particle_systems/presets_gun/" + selectedFile.Text, FileMode.OpenOrCreate))
                {
                    bulletPhysics           = (BulletPhysics)formatter.Deserialize(fs);
                    NameBullet.Text         = bulletPhysics.GetNameBullet();
                    NameGun.SelectedItem    = SelectedNameGun();
                    LongRange.Text          = bulletPhysics.GetLongRange().ToString();
                    DifficultUseGun.Text    = bulletPhysics.GetDifficultUse().ToString();
                    CountsBullet.Text       = bulletPhysics.GetCountBullets().ToString();
                    VelocityBullet.Text     = bulletPhysics.GetVelocity().ToString();
                    SizeBullet.Text         = bulletPhysics.GetSizeBullet().ToString();
                    OnBurstbullet.IsChecked = bulletPhysics.GetBurstBullet();
                    MessageBox.Show(string.Format("Пресет открыт"));
                }
            }
            catch
            {
                MessageBox.Show(string.Format("Пресет не выбран"));
            }
        }