public MenuViewModel(Action <Puzzle> puzzleScreenSwitcher) { var facade = new PiCrossFacade(); IGameData gameData = facade.CreateDummyGameData(); this.Choices = gameData.PuzzleLibrary.Entries.Select((IPuzzleLibraryEntry s) => new ChoiceViewModel(s.Puzzle, puzzleScreenSwitcher)); }
public GameWindowViewModel(MainWindowViewModel main) { Main = main; var puzzle = Puzzle.FromRowStrings( "xxxxx", "x...x", "x...x", "x...x", "xxxxx" ); var facade = new PiCrossFacade(); //timer var timeService = ServiceLocator.Current.GetInstance <ITimeService>(); _start = timeService.Now; _timer = ServiceLocator.Current.GetInstance <ITimerService>(); _timer.Tick += Timer_Tick; _timer.Start(new TimeSpan(0, 0, 0, 0, 100)); PlayablePuzzle = facade.CreatePlayablePuzzle(puzzle); SquareGrid = Grid.Create <SquareViewModel>(PlayablePuzzle.Grid.Size, p => new SquareViewModel(PlayablePuzzle.Grid[p])); Timer = "00:00:00"; CloseGameWindow = new CloseGameWindowCommand(main); IsSolved = new IsSolvedCommand(this); }
public void Execute(object parameter) { PuzzleEditScreen screen = (PuzzleEditScreen)parameter; screen.Editor.ResolveAmbiguity(); var facade = new PiCrossFacade(); bool am = false; foreach (IPuzzleEditorSquare square in screen.Editor.Grid.Items) { if (square.Ambiguity.Value == Ambiguity.Ambiguous) { am = true; break; } } if (!am) { IGameData gameData = facade.LoadGameData("../../../../python/picross.zip", true); Puzzle puzzle = screen.Editor.BuildPuzzle(); IPuzzleLibraryEntry entry = gameData.PuzzleLibrary.Create(puzzle, "Jonas"); screen.navigator.selectionScreen.cell.Value.Add(new PuzzleViewModel(entry)); screen.navigator.selectionScreen.PuzzleSizes.Add(puzzle.Size); screen.SwitchTo(new MenuScreen(screen.navigator)); } }
public PuzzleVM(StartupVM startup, IPlayablePuzzle IplayablePuzzle) { this.wrapped = IplayablePuzzle; this.StartupVM = startup; this.PiCrossFacade = new PiCrossFacade(); this.Grid = this.wrapped.Grid.Map(puzzleSquare => new SquareVM(puzzleSquare)).Copy(); }
public LevelSelectorWindowViewModel(MainWindowViewModel Mainvm) { this.VM = Mainvm; var Facade = new PiCrossFacade(); var Puzzle1 = Puzzle.FromRowStrings( ".xxx.", "x.x.x", "xxxxx", "x.x.x", ".xxx." ); var Puzzle2 = Puzzle.FromRowStrings( "x...x", ".x.x.", "..x..", ".x.x.", "x...x" ); this.Puzzles = new PlayablePuzzleViewModel[2]; this.Puzzles[0] = new PlayablePuzzleViewModel(VM, Facade.CreatePlayablePuzzle(Puzzle1), "Puzzel 1"); this.Puzzles[1] = new PlayablePuzzleViewModel(VM, Facade.CreatePlayablePuzzle(Puzzle2), "Puzzel 2"); }
public StartViewModel() { var facade = new PiCrossFacade(); data = facade.CreateDummyGameData(); Puzzles = data.PuzzleLibrary.Entries; SelectedPuzzle = Puzzles.ElementAt(0); }
public void Start() { var facade = new PiCrossFacade(); PlayablePuzzle = facade.CreatePlayablePuzzle(Puzzle); PlayablePuzzle.IsSolved.ValueChanged += IsSolvedValueChanged; grid.Value = PlayablePuzzle.Grid.Map(square => new SquareVM(square)).Copy(); }
public SelectViewModel() { var facade = new PiCrossFacade(); gameData = facade.CreateDummyGameData(); Puzzles = gameData.PuzzleLibrary.Entries; ChosenPuzzle = Puzzles.ElementAt(0); }
//Puzzel genereren via de sub klassse in PiCrossFacade public void PuzzelMaken() { var facade = new PiCrossFacade(); GoedePuzzel = facade.CreatePlayablePuzzle(puzzle); GoedePuzzel.IsSolved.ValueChanged += IsSolved_Verandering; this.grid.Value = this.GoedePuzzel.Grid.Map(square => new SquareViewModel(square)).Copy(); IsSolved_Verandering(); }
public GameVM(Puzzle puzzle) { var facade = new PiCrossFacade(); this.playablePuzzle = facade.CreatePlayablePuzzle(puzzle); this.Grid = this.playablePuzzle.Grid.Map(square => new SquareVM(square)); this.RowConstraints = this.playablePuzzle.RowConstraints.Map(row => new RowConstraintsVM(row)); this.ColumnConstraints = this.playablePuzzle.ColumnConstraints.Map(column => new ColumnConstraintsVM(column)); this.Completed = this.playablePuzzle.IsSolved; }
public PuzzleViewModel(Puzzle puzzle) { var facade = new PiCrossFacade(); this.playablePuzzle = facade.CreatePlayablePuzzle(puzzle); this.Grid = playablePuzzle.Grid.Map((IPlayablePuzzleSquare s) => new SquareViewModel(s)); this.ColumnConstraints = playablePuzzle.ColumnConstraints.Map((IPlayablePuzzleConstraints c) => new ConstraintsViewModel(c)); this.RowConstraints = playablePuzzle.RowConstraints.Map((IPlayablePuzzleConstraints c) => new ConstraintsViewModel(c)); this.ElapsedTime = Cell.Create(TimeSpan.Zero); InitiateTimer(); }
public HelpCommand(IPlayablePuzzle puzzle) { this.puzzle = puzzle; var facade = new PiCrossFacade(); solvedPuzzle = facade.CreateStepwisePuzzleSolver(PlayablePuzzleConstraintsToConstraints(puzzle.RowConstraints), PlayablePuzzleConstraintsToConstraints(puzzle.ColumnConstraints)); while (!solvedPuzzle.IsSolved) { solvedPuzzle.Step(); } }
public GameViewModel(Puzzle puzzle) { var facade = new PiCrossFacade(); this.playablePuzzle = facade.CreatePlayablePuzzle(puzzle); this.Grid = this.playablePuzzle.Grid.Map(square => new SquareViewModel(square)).Copy(); this.RowConstraints = this.playablePuzzle.RowConstraints.Map(row => new RowViewModel(row)).Copy(); this.ColumnConstraints = this.playablePuzzle.ColumnConstraints.Map(column => new ColumnViewModel(column)).Copy(); IsSolved = playablePuzzle.IsSolved; }
public PuzzleVM(StartupVM startup, Puzzle playablePuzzle) { var puzzle = playablePuzzle; this.StartupVM = startup; this.PiCrossFacade = new PiCrossFacade(); this.wrapped = PiCrossFacade.CreatePlayablePuzzle(puzzle); this.Grid = this.wrapped.Grid.Map(puzzleSquare => new SquareVM(puzzleSquare)).Copy(); }
public void Execute(object parameter) { object[] parameters = (object[])parameter; if (!parameters[0].Equals("") && !parameters[1].Equals("")) { int rows = Int32.Parse((string)parameters[0]); int columns = Int32.Parse((string)parameters[1]); PuzzleEditorScreen screen = (PuzzleEditorScreen)parameters[2]; Puzzle puzzle = Puzzle.CreateEmpty(new Size(columns, rows)); var facade = new PiCrossFacade(); screen.SwitchTo(new PuzzleEditScreen(screen.navigator, facade.CreatePuzzleEditor(puzzle))); } }
public SelectPuzzleViewModel(MainWindowViewModel main) { this.Main = main; Library = new PiCrossFacade().LoadGameData(path); Puzzles = new List <PuzzleEntryViewModel>(); Chosen = Cell.Create <PuzzleEntryViewModel>(new PuzzleEntryViewModel("empty")); ClosePuzzleSelect = new ClosePuzzleSelectCommand(Main); SelectPuzzleSelect = new SelectPuzzleSelectCommand(this); foreach (IPuzzleLibraryEntry i in Library.PuzzleLibrary.Entries) { Puzzles.Add(new PuzzleEntryViewModel(i, this)); } }
public PicrossViewModel(Puzzle puzzle) { IsSolved = Cell.Create <bool>(false); var facade = new PiCrossFacade(); playablePuzzle = facade.CreatePlayablePuzzle(puzzle); this.Grid = this.playablePuzzle.Grid.Map(square => new SquareViewModel(square)); this.Chronometer = new Chronometer(); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(250); timer.Tick += (o, s) => Chronometer.Tick(); timer.Start(); RowConstraints = new PlayablePuzzleConstraintsViewModel(this.playablePuzzle.RowConstraints); ColumnConstraints = new PlayablePuzzleConstraintsViewModel(this.playablePuzzle.ColumnConstraints); }
public SelectionScreen(Navigator navigator) : base(navigator) { var facade = new PiCrossFacade(); cell = Cell.Create <IList <PuzzleViewModel> >(facade.LoadGameData("../../../../python/picross.zip").PuzzleLibrary.Entries.Select(entry => new PuzzleViewModel(entry)).ToList()); backup = this.Puzzles.Select(puzzle => puzzle).ToList(); PuzzleSizes = this.Puzzles.Select(puzzle => puzzle.Entry.Puzzle.Size).Distinct().ToList(); GoToPuzzle = new GoToPuzzleCommand(navigator, this); GoToMenu = new EasyCommand(() => SwitchTo(new MenuScreen(navigator))); FilterUnsolved = new FilterUnsolvedCommand(); FilterSize = new FilterSizeCommand(); ClearFilters = new ClearFiltersCommand(); OrderBySolved = new OrderBySolvedCommand(); OrderByUnsolved = new OrderByUnsolvedCommand(); OrderBySize = new OrderBySizeCommand(); }
public GameViewModel() { var puzzle = Puzzle.FromRowStrings( "xxxxx", "x...x", "x...x", "x...x", "xxxxx" ); var facade = new PiCrossFacade(); this.PlayablePuzzle = facade.CreatePlayablePuzzle(puzzle); Console.WriteLine(PlayablePuzzle.RowConstraints.Items); //var vmGrid = this.PlayablePuzzle.Grid.Map(square => new SquareViewModel(square)).Copy(); }
public PuzzleVM(StartupVM startup) { var puzzle = Puzzle.FromRowStrings( "xxxxx", "x...x", "x...x", "x...x", "xxxxx" ); this.StartupVM = startup; this.PiCrossFacade = new PiCrossFacade(); this.wrapped = PiCrossFacade.CreatePlayablePuzzle(puzzle); this.Grid = this.wrapped.Grid.Map(puzzleSquare => new SquareVM(puzzleSquare)).Copy(); }
public PlayWindowViewModel(MainWindowViewModel Mainvm) { this.VM = Mainvm; var DemoPuzzle = Puzzle.FromRowStrings( ".xxx.", "x.x.x", "xxxxx", "x.x.x", ".xxx." ); var Facade = new PiCrossFacade(); this.DemoPlayablePluzzle = Facade.CreatePlayablePuzzle(DemoPuzzle); this.Grid = DemoPlayablePluzzle.Grid.Map(square => new PuzzleSquareViewModel(square)).Copy(); this.ColumnConstraints = DemoPlayablePluzzle.ColumnConstraints.Map(constraint => new PuzzleConstraintsViewModel(constraint)).Copy(); this.RowConstraints = DemoPlayablePluzzle.RowConstraints.Map(constraint => new PuzzleConstraintsViewModel(constraint)).Copy(); this.Retry = new RetryCommand(this.VM); this.Exit = new ExitCommand(this.VM); }
public GameViewModel(Puzzle puzzle) { var facade = new PiCrossFacade(); this.playablePuzzle = facade.CreatePlayablePuzzle(puzzle); this.Grid = this.playablePuzzle.Grid.Map(square => new SquareVM(square)).Copy(); this.ColumnConstraints = this.playablePuzzle.ColumnConstraints.Map(column => new ColumnsVM(column)).Copy(); this.RowConstraints = this.playablePuzzle.RowConstraints.Map(row => new RowsVM(row)).Copy(); Check = playablePuzzle.IsSolved; this.StartTimer = new StartTimer(this); this.StopTimer = new StopTimer(this); lastTick = DateTime.Now; timerken = new DispatcherTimer(TimeSpan.FromMilliseconds(10), DispatcherPriority.Background, t_Tick, Dispatcher.CurrentDispatcher); timerken.IsEnabled = true; }
public PlayableWindow(Navigator navigator, Puzzle puzzle = null) : base(navigator) { if (puzzle == null) { puzzle = Puzzle.FromRowStrings( "xxx", "x..", "x.x" ); } var facade = new PiCrossFacade(); playablePuzzle = facade.CreatePlayablePuzzle(puzzle); this.Grid = playablePuzzle.Grid.Map(square => new ChangeableSquare(square)).Copy(); this.ColumnConstraints = playablePuzzle.ColumnConstraints /*.Map(constraints => new ChangeableCC(constraints)).Copy()*/; this.RowConstraints = playablePuzzle.RowConstraints /*.Map(constraints => new ChangeableCC(constraints)).Copy()*/; BackToStart = new EasyCommand(() => SwitchTo(new StartScreen(navigator))); Refresh = new EasyCommand(() => SwitchTo(new PlayableWindow(navigator, puzzle))); ChooseOther = new EasyCommand(() => SwitchTo(new PuzzleGenerator(navigator))); }
public MainWindowVM() { ActiveScreen = new StartVM(this); PiCrossFacade = new PiCrossFacade(); }
//Launcht op de Home screen view public MainViewModel() { this.Active = new HomeScreenViewModel(this); this.PiCrossFacade = new PiCrossFacade(); }
public PuzzleGenerator(Navigator navigator) : base(navigator) { var facade = new PiCrossFacade(); var puzzle1 = Puzzle.FromRowStrings( ".......xx.xxxx.", ".....xxx.xxxxxx", "...xxxx.xxxxx.x", "..xxxx.xxxxxxxx", ".xxxx.xxxxx.xxx", "xx...x...x.xxxx", "x.........xxxx.", "x.........xxxx.", ".x.......xxxxx.", ".x.......xxxx..", ".x.......xxxx..", ".x.......xxx...", ".x.......xxx...", ".x.......xx....", ".xxxxxxxxx....." ); var puzzle2 = Puzzle.FromRowStrings( ".x...", "xx.xx", ".xxx.", ".xxx.", "..x.." ); var puzzle3 = Puzzle.FromRowStrings( ".xx....xx.", "...xxxx...", "x.xxxxxx.x", ".xx.xx.xx.", ".xxxxxxxx.", ".x.xxxx.x.", ".xxxxxxxx.", ".xx.xx.xx.", "x.xxxxxx.x", "...xxxx..." ); var puzzle4 = Puzzle.FromRowStrings( "x..x.....x", "xx.xx...xx", ".xx.xxxxx.", "..xx.....x", "..x.......", "..x.x....x", ".x.xx...xx", ".xx...x...", ".xx..xxx..", "..xx.....x" ); this.Puzzles = new PlayablePuzzles[4]; this.Puzzles[0] = new PlayablePuzzles(navigator, puzzle1, "Bread"); this.Puzzles[1] = new PlayablePuzzles(navigator, puzzle2, "Chicken"); this.Puzzles[2] = new PlayablePuzzles(navigator, puzzle3, "LadyBug"); this.Puzzles[3] = new PlayablePuzzles(navigator, puzzle4, "Pikachu"); }
public GameVM(MainVM mainVM) { playablePuzzle = new PiCrossFacade().CreatePlayablePuzzle(puzzle); PVM = new PuzzleVM(playablePuzzle); this.mainVM = mainVM; }
public MainViewModel() { this.activeScreen = new WelcomeViewModel(this); this.PiCrossFacade = new PiCrossFacade(); }
public StartupVM() { this.currentWindow = new SelectionScreenVM(this); this.PiCrossFacade = new PiCrossFacade(); }