コード例 #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;
 }
コード例 #3
0
 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";
 }
コード例 #6
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 OneKillBannerPlugin(wvm));
            return wvm;
        }
コード例 #7
0
 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;
 }
コード例 #10
0
 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());
        }
コード例 #15
0
        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;
        }
コード例 #16
0
        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;
        }
コード例 #17
0
        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);
        }
コード例 #19
0
 public FindChestWithPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Find Chests With";
 }
コード例 #20
0
 public OneKillBannerPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "One Kill Banner";
 }
コード例 #21
0
 static ViewModelLocator()
 {
     _worldViewModel = CreateWorldViewModel();
 }
コード例 #22
0
 public ClipboardManager(WorldViewModel worldView)
 {
     _wvm = worldView;
 }
コード例 #23
0
 public SimplePerlinGeneratorPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     _noiseGenerator = new PerlinNoise(1);
     Name = "Simple Ore Generator";
 }
コード例 #24
0
 public ReplaceAllPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Replace All Tiles";
 }
コード例 #25
0
 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";
 }
コード例 #30
0
 public AnalyzeTilesPlugin(WorldViewModel worldViewModel)
     : base(worldViewModel)
 {
     Name = "Analyze Tiles";
 }