/// <summary>
        /// Load up a map.
        /// </summary>
        public void Load()
        {
            this.animatedVisualBrushes = new Dictionary <string, VisualBrush>();
            if (true)
            {
                this.logicCalcTimer          = new DispatcherTimer();
                this.logicCalcTimer.Interval = TimeSpan.FromMilliseconds(GameModel.MOVETIME);
                this.logicCalcTimer.Tick    += this.TimerTick;
                Task.Delay(GameModel.MOVETIME * 4).ContinueWith(_ =>
                {
                    this.logicCalcTimer.Start();
                });
            }

            foreach (DictionaryEntry item in Properties.Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true))
            {
                if (item.Value is System.Drawing.Bitmap)
                {
                    var brush = this.TryFindResource(item.Key.ToString());
                    if (brush is VisualBrush)
                    {
                        this.animatedVisualBrushes[item.Key.ToString()] = brush as VisualBrush;
                    }
                }
            }

            this.logic   = new GameLogic(finishMap);
            this.model   = this.logic.LoadLevel(this.map);
            this.display = new BoulderDisplay(this.model, this.ActualWidth, this.ActualHeight, GameModel.MOVETIME, this.animatedVisualBrushes);
            this.InvalidateVisual();
        }
Пример #2
0
        private void LbMain_Selected(object sender, RoutedEventArgs e)
        {
            this.selectedMenu = (sender as ListBox).SelectedItem as MyMenuItem;
            this.model        = this.logic.LoadLevel(this.levels[this.selectedMenu.Name]);
            this.model.Camera.AngleWidthTile  = 400;
            this.model.Camera.AngleHeightTile = 220;
            this.display = new BoulderDisplay(this.model, this.ActualWidth, this.ActualHeight, 200, this.animatedVisualBrushes);

            this.map.Background = new DrawingBrush(this.display.BuildDrawing());
        }