예제 #1
0
        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 FindChestWithPlugin(wvm));
            wvm.Plugins.Add(new FindPlanteraBulbPlugin(wvm));
            wvm.Plugins.Add(new RemoveAllWaterPlugin(wvm));
            wvm.Plugins.Add(new RemoveAllHoneyPlugin(wvm));
            wvm.Plugins.Add(new RemoveAllLavaPlugin(wvm));
            wvm.Plugins.Add(new RemoveAllCorruption(wvm));
            wvm.Plugins.Add(new RemoveAllAltars(wvm));
            wvm.Plugins.Add(new RemoveAllPots(wvm));
            return(wvm);
        }
예제 #2
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;
 }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = ViewModelLocator.WorldViewModel;
     _vm = (WorldViewModel)DataContext;
     AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent);
 }
예제 #4
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;
 }
예제 #5
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";
 }
        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);
 }
예제 #8
0
 public PickerTool(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Icon = new BitmapImage(new Uri(@"pack://application:,,,/TEditXna;component/Images/Tools/eyedropper.png"));
     ToolType = ToolType.Pixel;
     Name = "Picker";
 }
예제 #9
0
 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;
 }
예제 #11
0
 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;
 }
예제 #12
0
 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;
 }
예제 #13
0
 public MainWindow()
 {
     InitializeComponent();
     this.Width = World.AppSize.X;
     this.Height = World.AppSize.Y;
     DataContext = ViewModelLocator.WorldViewModel;
     _vm = (WorldViewModel)DataContext;
     AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent);
 }
예제 #14
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;
        }
예제 #18
0
        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));
            return(wvm);
        }
 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 ReplaceAllPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Replace All Tiles";
 }
 public UnlockAllChestsPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Unlock All Chests";
 }
예제 #26
0
 //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;
                 }
             }
     }
 }
예제 #27
0
 public SandSettlePlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Settle Sand";
 }
예제 #28
0
 protected BasePlugin(WorldViewModel worldViewModel)
 {
     _wvm = worldViewModel;
 }
 public RemoveAllUnlockedChestsPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Remove All Unlocked Chests";
 }
 public AnalyzeTilesPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Analyze Tiles";
 }