Exemple #1
0
 public void Update(Palette palette)
 {
     _palette = palette;
     _renderer.Update(palette);
     CanvasArea.Background = new SolidColorBrush(palette.RgbColors[0][0].ToMediaColor());
     Update();
 }
Exemple #2
0
        private void PaletteSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Palette selectedPalette = _palettesService.GetPalette(((Palette)PaletteSelector.SelectedItem).Id);

            _renderer.Update(selectedPalette);
            ObjectSelector.Update(selectedPalette);
            Update();
        }
Exemple #3
0
        public void Initialize(GameObjectService gameObjectService, PalettesService palettesService, GraphicsAccessor graphicsAccessor, Palette palette)
        {
            _gameObjectService = gameObjectService;
            _graphicsAccessor  = graphicsAccessor;
            _palette           = palette;
            _palettesService   = palettesService;

            _objectTypes = new List <GameObjectType>();

            _renderer = new GameObjectRenderer(gameObjectService, _palettesService, graphicsAccessor);

            Dpi dpi = this.GetDpi();

            _bitmap = new WriteableBitmap(256, 256, dpi.X, dpi.Y, PixelFormats.Bgra32, null);

            _selectedGroup = new Dictionary <GameObjectType, string>();

            switch (ObjectGroup)
            {
            case GameObjectGroup.Level:
                _objectTypes.Add(GameObjectType.Global);
                _objectTypes.Add(GameObjectType.TypeA);
                _objectTypes.Add(GameObjectType.TypeB);

                break;

            case GameObjectGroup.World:
                _objectTypes.Add(GameObjectType.World);
                break;

            case GameObjectGroup.All:
                _objectTypes.Add(GameObjectType.Global);
                _objectTypes.Add(GameObjectType.TypeA);
                _objectTypes.Add(GameObjectType.TypeB);
                _objectTypes.Add(GameObjectType.World);
                break;
            }

            foreach (var objectType in _objectTypes)
            {
                _selectedGroup[objectType] = null;
            }


            _selectedObject = null;

            GameObjectImage.Source      = _bitmap;
            GameObjectTypes.ItemsSource = _objectTypes;

            _renderer.Update(palette);

            CanvasArea.Background         = new SolidColorBrush(palette.RgbColors[0][0].ToMediaColor());
            GameObjectTypes.SelectedIndex = 0;

            _gameObjectService.GameObjectUpdated += GameObjectsUpdated;
        }