コード例 #1
0
        public async Task SmearAsync(PaletteType a, PaletteType b)
        {
            GammaPalette result = GammaPalette.Smear(GraphicsService.GetPalette(a), GraphicsService.GetPalette(b));

            await Context.Channel.SendImageAsync(ImageHelper.CreateGradient(result, 128, 64, AngleF.Right),
                                                 "../tmp/smear.png");
        }
コード例 #2
0
ファイル: ChatHandler.cs プロジェクト: AbnerSquared/Orikivo
 public ChatHandler(DesyncContext context, Character npc, DialogTree pool, PaletteType palette = PaletteType.Glass)
 {
     Context = context;
     Npc     = npc;
     Tree    = pool;
     Palette = GraphicsService.GetPalette(palette);
 }
コード例 #3
0
 public ShopHandler(DesyncContext context, Market market, PaletteType palette)
 {
     Context = context;
     Market  = market;
     Vendor  = market.GetActive();
     Palette = GraphicsService.GetPalette(palette);
 }
コード例 #4
0
        public async Task DrawBorderAsync(int width = 32, int height = 32, int thickness = 2, PaletteType palette = PaletteType.GammaGreen, Gamma background = Gamma.StandardDim, Gamma border = Gamma.Max, BorderEdge edge = BorderEdge.Outside, BorderAllow allow = BorderAllow.All)
        {
            /*
             * var width = Context.GetOptionOrDefault("width", 32);
             * var height = Context.GetOptionOrDefault("height", 32);
             * var thickness = Context.GetOptionOrDefault("thickness", 2);
             * var color = Context.GetOptionOrDefault("color", ImmutableColor.GammaGreen);
             * var edge = Context.GetOptionOrDefault("edge", BorderEdge.Outside);
             * var allow = Context.GetOptionOrDefault("allow", BorderAllow.All);
             */

            using (var tmp = ImageHelper.CreateSolid(GraphicsService.GetPalette(palette)[background], width, height))
                using (Bitmap b = ImageHelper.SetBorder(tmp, GraphicsService.GetPalette(palette)[border], thickness, edge, allow))
                    await Context.Channel.SendImageAsync(b, "../tmp/border.png");
        }
コード例 #5
0
        public TileBlockEditor(ProjectService projectService, WorldService worldService, LevelService levelService, GraphicsService graphicsService, PalettesService palettesService, TileService tileService, TextService textService)
        {
            _ignoreChanges = true;
            InitializeComponent();

            _projectService  = projectService;
            _palettesService = palettesService;
            _graphicsService = graphicsService;
            _worldService    = worldService;
            _levelService    = levelService;
            _tileService     = tileService;
            _textService     = textService;

            List <KeyValuePair <string, string> > tileSetText = _textService.GetTable("tile_sets");

            tileSetText.Insert(0, new KeyValuePair <string, string>("0", "Map"));

            TerrainList.ItemsSource        = _localTileTerrain = _tileService.GetTerrainCopy();
            LevelList.ItemsSource          = _levelService.AllWorldsLevels();
            MapInteractionList.ItemsSource = _localMapTileInteraction = _tileService.GetMapTileInteractionCopy();

            _graphicsAccessor = new GraphicsAccessor(_graphicsService.GetTileSection(0), _graphicsService.GetTileSection(0), _graphicsService.GetGlobalTiles(), _graphicsService.GetExtraTiles());

            _graphicsSetRenderer = new GraphicsSetRender(_graphicsAccessor);
            _tileSetRenderer     = new TileSetRenderer(_graphicsAccessor, _localTileTerrain, _localMapTileInteraction);

            Dpi dpi = this.GetDpi();

            _graphicsSetBitmap = new WriteableBitmap(128, 128, dpi.X, dpi.Y, PixelFormats.Bgra32, null);
            _tileBlockBitmap   = new WriteableBitmap(16, 16, dpi.X, dpi.Y, PixelFormats.Bgra32, null);

            GraphicsSetImage.Source = _graphicsSetBitmap;

            TileBlockImage.Source = _tileBlockBitmap;

            BlockSelector.Initialize(_graphicsAccessor, _tileService, _tileService.GetTileSet(0), _graphicsService.GetPalette(0), _tileSetRenderer);
            BlockSelector.TileBlockSelected += BlockSelector_TileBlockSelected;

            LevelList.SelectedIndex          = 1;
            BlockSelector.SelectedBlockValue = 0;
            _ignoreChanges = false;

            _graphicsService.GraphicsUpdated      += _graphicsService_GraphicsUpdated;
            _graphicsService.ExtraGraphicsUpdated += _graphicsService_GraphicsUpdated;
        }