示例#1
0
 public FillTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/paintcan.png"));
     Name = "Fill";
     ToolType = ToolType.Pixel;
 }
示例#2
0
 public BrushTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/paintbrush.png"));
     Name = "Brush";
     ToolType = ToolType.Brush;
 }
示例#3
0
 //private ChestPopup _chestPopup;
 //private SignPopup _signPopup;
 public ArrowTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/cursor.png"));
     ToolType = ToolType.Pixel;
     Name = "Arrow";
 }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = ViewModelLocator.WorldViewModel;
     _vm = (WorldViewModel)DataContext;
     AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent);
 }
        private static WorldViewModel CreateWorldViewModel()
        {
            var wvm = new WorldViewModel();
            wvm.Tools.Add(new PasteTool(wvm));
            var defaultTool = new ArrowTool(wvm);
            wvm.Tools.Add(defaultTool);
            wvm.Tools.Add(new SelectionTool(wvm));
            wvm.Tools.Add(new PickerTool(wvm));
            wvm.Tools.Add(new PencilTool(wvm));
            wvm.Tools.Add(new BrushTool(wvm));
            wvm.Tools.Add(new FillTool(wvm));
            wvm.Tools.Add(new PointTool(wvm));
            wvm.Tools.Add(new SpriteTool(wvm));
            wvm.Tools.Add(new MorphTool(wvm));
            wvm.ActiveTool = defaultTool;

            wvm.Plugins.Add(new SandSettlePlugin(wvm));
            wvm.Plugins.Add(new SimplePerlinGeneratorPlugin(wvm));
            wvm.Plugins.Add(new ReplaceAllPlugin(wvm));
            wvm.Plugins.Add(new RemoveAllChestsPlugin(wvm));
            wvm.Plugins.Add(new RemoveAllUnlockedChestsPlugin(wvm));
            wvm.Plugins.Add(new UnlockAllChestsPlugin(wvm));
            wvm.Plugins.Add(new OneKillBannerPlugin(wvm));
            return wvm;
        }
 protected BaseTool(WorldViewModel worldViewModel)
 {
     _wvm = worldViewModel;
     _preview = new WriteableBitmap(1, 1, 96, 96, PixelFormats.Bgra32, null);
     _preview.Clear();
     _preview.SetPixel(0, 0, 127, 0, 90, 255);
 }
 public PickerTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/eyedropper.png"));
     ToolType = ToolType.Pixel;
     Name = "Picker";
 }
 public SpriteTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/sprite.png"));
     Name = "Sprite";
     IsActive = false;
     ToolType = ToolType.Pixel;
 }
 public UndoManager(WorldViewModel viewModel)
 {
     if (!Directory.Exists(Dir))
     {
         Directory.CreateDirectory(Dir);
     }
     _wvm = viewModel;
 }
 public MorphTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     CreateTileLookup();
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/paintbrush.png"));
     Name = "Morph";
     ToolType = ToolType.Brush;
 }
 public PointTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/point.png"));
     Name = "Point";
     IsActive = false;
     ToolType = ToolType.Npc;
 }
 public MainWindow()
 {
     InitializeComponent();
     this.Width = World.AppSize.X;
     this.Height = World.AppSize.Y;
     DataContext = ViewModelLocator.WorldViewModel;
     _vm = (WorldViewModel)DataContext;
     AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent);
 }
示例#13
0
        public UndoManager(WorldViewModel viewModel)
        {
            if (!Directory.Exists(Dir))
            {
                Directory.CreateDirectory(Dir);
            }

            _wvm = viewModel;
            _buffer = new UndoBuffer(GetUndoFileName());
        }
        public SelectionTool(WorldViewModel worldViewModel)
        {
            _wvm = worldViewModel;
            _preview = new WriteableBitmap(1, 1, 96, 96, PixelFormats.Bgra32, null);
            _preview.Clear();
            _preview.SetPixel(0, 0, 127, 0, 90, 255);

            Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/shape_square.png"));
            Name = "Selection";
            IsActive = false;
        }
        public WorldRenderXna()
        {
            _wvm = ViewModelLocator.WorldViewModel;

            if (ViewModelBase.IsInDesignModeStatic)
                return;

            InitializeComponent();
            _gameTimer = new GameTimer();
            _wvm.PreviewChanged += PreviewChanged;
            _wvm.PropertyChanged += _wvm_PropertyChanged;
            _wvm.RequestZoom += _wvm_RequestZoom;
            _wvm.RequestScroll += _wvm_RequestScroll;
        }
        public WorldRenderXna()
        {
            // to stop visual studio design time crash :(
            if (!Debugging.IsInDesignMode)
            {
                InitializeComponent();
                _gameTimer = new GameTimer();
            }

            _wvm = ViewModelLocator.WorldViewModel;
            _wvm.PreviewChanged += PreviewChanged;
            _wvm.PropertyChanged += _wvm_PropertyChanged;
            _wvm.RequestZoom += _wvm_RequestZoom;
            _wvm.RequestScroll += _wvm_RequestScroll;
        }
 public FindChestWithPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Find Chests With";
 }
 public OneKillBannerPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "One Kill Banner";
 }
 static ViewModelLocator()
 {
     _worldViewModel = CreateWorldViewModel();
 }
 public ClipboardManager(WorldViewModel worldView)
 {
     _wvm = worldView;
 }
 public SimplePerlinGeneratorPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     _noiseGenerator = new PerlinNoise(1);
     Name = "Simple Ore Generator";
 }
 public UnlockAllChestsPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Unlock All Chests";
 }
 public ReplaceAllPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Replace All Tiles";
 }
 protected BasePlugin(WorldViewModel worldViewModel)
 {
     _wvm = worldViewModel;
 }
 //This function resets the UV state for the specified tile locations (as well as nearby tiles) such that the UV cache must be re-evaluated
 public static void ResetUVCache(WorldViewModel _wvm, int tileStartX, int tileStartY, int regionWidth, int regionHeight)
 {
     if (_wvm.TilePicker.PaintMode == PaintMode.TileAndWall)
     {
             //Reset UV Cache for nearby tiles and walls
             for (int x = -1; x < regionWidth + 1; x++)
             {
                 int tilex = x + tileStartX;
                 for (int y = -1; y < regionHeight + 1; y++)
                 {
                     int tiley = y + tileStartY;
                     if (tilex < 0 || tiley < 0 || tilex >= _wvm.CurrentWorld.TilesWide || tiley >= _wvm.CurrentWorld.TilesHigh)
                     {
                         continue;
                     }
                     Tile curtile = _wvm.CurrentWorld.Tiles[tilex, tiley];
                     if (_wvm.TilePicker.TileStyleActive)
                     {
                         curtile.uvTileCache = 0xFFFF;
                         curtile.lazyMergeId = 0xFF;
                         curtile.hasLazyChecked = false;
                     }
                     if (_wvm.TilePicker.WallStyleActive)
                         curtile.uvWallCache = 0xFFFF;
                 }
             }
     }
 }
 public SandSettlePlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Settle Sand";
 }
 public RemoveAllUnlockedChestsPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Remove All Unlocked Chests";
 }
 public AnalyzeTilesPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Analyze Tiles";
 }