Esempio n. 1
0
        public virtual void GameReceived(object sender, string gameJason)
        {
            JObject game;

            try
            {
                game = JObject.Parse(gameJason);
            }
            catch (JsonReaderException)
            {
                return;
            }

            PlayerMaze  = game.ToMazeWrapper();
            RivalRow    = PlayerMaze.StartRow;
            RivalColumn = PlayerMaze.StartCol;
            IsLoading   = false;
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ObservableCollection <ICell> cells = new ObservableCollection <ICell>();

            MazeWrapper maze = (MazeWrapper)(value);

            if (maze == null)
            {
                return(null);
            }

            string representation = maze.MazeStr;

            for (int i = 0; i < maze.Rows; i++)
            {
                for (int j = 0; j < maze.Cols; j++)
                {
                    cells.Add(new Cell(j, i, representation[i * maze.Cols + j]));
                }
            }

            return(cells);
        }