Пример #1
0
        public PreGame(string path)
        {
            InitializeComponent();

            _path = path;

            // load the scenario from json file
            using (StreamReader r = new StreamReader(Path.Combine(_path, "scenario.json")))
            {
                string         json     = r.ReadToEnd();
                ScenarioSchema scenario = JsonConvert.DeserializeObject <ScenarioSchema>(json);
                // set the title of the scenario
                TitleLabel.Content = new TextBlock {
                    Text = scenario.Title, TextWrapping = TextWrapping.Wrap
                };
                // set description text
                DescriptionLabel.Content = new TextBlock {
                    Text = scenario.Description, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Left
                };
                // load the image
                BitmapImage bitmapImage = new BitmapImage(new Uri(Path.Combine(_path, scenario.Image)));
                BgImage.Source = bitmapImage;
                // prepare the scenario's settings to be loaded
                _settings   = scenario.Settings;
                _introVideo = scenario.IntroVideo;
            }
        }
Пример #2
0
 public static void SetScenarioSettings(ScenarioSettings settings)
 {
     _HP           = settings.StartingHP;
     _Points       = settings.StartingPoints;
     _Branch       = settings.StartingBranch;
     _PathPosition = settings.StartingPathPosition;
 }