Пример #1
0
        public bool Matches(BoardGameDataItem game)
        {
            bool match = true;

            if (game == null)
            {
                match = false;
            }

            switch (RequestedStatus)
            {
            case ExpansionStatus.All:
                match = true;
                break;

            case ExpansionStatus.BaseGame:
                match = game.IsExpansion == false;
                break;

            case ExpansionStatus.Expansion:
                match = game.IsExpansion;
                break;

            default:
                match = false;
                break;
            }
            return(match);
        }
Пример #2
0
 public static void AddGame(BoardGameDataItem Game)
 {
     lock (_lock)
     {
         Games.Add(Game);
     }
 }
Пример #3
0
        public static BoardGameDataItem LoadBoardGame()
        {
            BoardGameDataItem bg = new BoardGameDataItem()
            {
                AverageRating = (Double)(7.9),
                BoardGameId   = 7923,
                Description   = "It is a detailed description of a game, but you can get some additional game info at website.",
                GeekRating    = (Double)(6.7),
                MaxPlayers    = 5,
                MinPlayers    = 2,
                BoardGameName = "Eldritch Horror",
                PlayingTime   = 240,
                Rank          = 57,
                YearPublished = 1996,
                Artists       = new ObservableCollection <string>()
                {
                    "Flenn Ferguson",
                    "Jacqueline Rodriquez",
                    "Nathan Holmes",
                    "Melinda Price",
                    "Judy Lawson"
                },
                Designers = new ObservableCollection <string>()
                {
                    "Myrtle Bailey",
                    "Janice Rodriguez"
                },
                Publishers = new ObservableCollection <string>()
                {
                    "Ethel Schmidt"
                },
                PlayerPollResults = new ObservableCollection <PlayerPollResultDataItem>()
                {
                    new PlayerPollResultDataItem()
                    {
                        Best                       = 78,
                        NotRecommended             = 18,
                        NumberOfPlayers            = 1,
                        NumberOfPlayersIsAndHigher = false,
                        Recommended                = 152
                    },
                    new PlayerPollResultDataItem()
                    {
                        Best                       = 10,
                        NotRecommended             = 70,
                        NumberOfPlayers            = 2,
                        NumberOfPlayersIsAndHigher = true,
                        Recommended                = 40
                    }
                }
            };

            return(bg);
        }
Пример #4
0
        public async Task LoadAllComments(BoardGameDataItem item)
        {
            IEnumerable<Comment> comments = await Client.LoadAllComments(item.GameId,item.TotalComments);
            item.Comments.Clear();
            foreach (Comment comment in comments.OrderByDescending(x => x.Text.Length).Take(500))
            {
                item.Comments.Add(new CommentDataItem()
                {
                    Rating = comment.Rating,
                    Text = comment.Text,
                    Username = comment.Username
                });
            }

        }
Пример #5
0
        public bool Matches(BoardGameDataItem BoardGame)
        {
            if (string.IsNullOrEmpty(FilterText))
            {
                return(true);
            }

            if (BoardGame == null)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(BoardGame.Name))
            {
                return(false);
            }

            return(BoardGame.Name.ToLower().Contains(FilterText.ToLower()));
        }
Пример #6
0
        public bool Matches(BoardGameDataItem BoardGame)
        {
            switch (StatusToFilterOn)
            {
            case GameCollectionStatus.All:
                return(true);

            case GameCollectionStatus.Owned:
                return(BoardGame.Owned);

            case GameCollectionStatus.ForTrade:
                return(BoardGame.ForTrade);

            case GameCollectionStatus.PreOrdered:
                return(BoardGame.PreOrdered);

            case GameCollectionStatus.PreviouslyOwned:
                return(BoardGame.PreviouslyOwned);

            case GameCollectionStatus.Want:
                return(BoardGame.Want);

            case GameCollectionStatus.WantToBuy:
                return(BoardGame.WantToBuy);

            case GameCollectionStatus.WantToPlay:
                return(BoardGame.WantToPlay);

            case GameCollectionStatus.WishList:
                return(BoardGame.Wishlist);

            case GameCollectionStatus.Played:
                return(BoardGame.Played);

            case GameCollectionStatus.OwnedUnplayed:
                return(!BoardGame.Played && BoardGame.Owned);
            }
            return(false);
        }
Пример #7
0
        public bool Matches(BoardGameDataItem game)
        {
            bool match = true;

            if (game == null)
            {
                match = false;
            }
            else if (Amount == 0)
            {
                match = true; //match all;
            }
            else if (game.MinPlayers > Amount)
            {
                match = false;
            }
            else if (game.MaxPlayers < Amount)
            {
                match = false;
            }

            return(match);
        }
Пример #8
0
        /// <summary>
        /// Loads a game, first from cache, if not found from the BGG Service
        /// </summary>
        /// <param name="GameId"></param>
        /// <param name="ForceReload"></param>
        /// <returns></returns>
        public async Task<BoardGameDataItem> LoadGame(int GameId, bool ForceReload = false)
        {
            BoardGameDataItem bgdi = BoardGameStorage.LoadGame(GameId);

            // If Force reload, the item should be removed from the storage and fetched anew.
            if (bgdi != null)
            {
                if (ForceReload)
                {
                    BoardGameStorage.RemoveGame(bgdi);
                    bgdi = null;
                }
                else if (bgdi.DataVersion < BoardGameDataItem.CurrentDataVersion)
                {
                    BoardGameStorage.RemoveGame(bgdi);
                    bgdi = null;
                }

            }

            if (bgdi == null || !bgdi.IsFullyLoaded)
            {
                Boardgame game = await Client.LoadGame(GameId);

                if (game != null)
                {
                    #region Filling values
                    if (bgdi == null)
                    {
                        bgdi = new BoardGameDataItem();
                        BoardGameStorage.AddGame(bgdi);
                    }
                    else
                    {
                        bgdi.DisableUpdate = true;
                    }
                    
                    bgdi.Description = WebUtility.HtmlDecode(game.Description);
                    bgdi.GameId = game.GameId;
                    bgdi.Image = game.Image;
                    bgdi.MaxPlayers = game.MaxPlayers;
                    bgdi.MinPlayers = game.MinPlayers;
                    bgdi.Name = game.Name;
                    bgdi.Thumbnail = game.Thumbnail;
                    bgdi.YearPublished = game.YearPublished;
                    bgdi.PlayingTime = game.PlayingTime;
                    bgdi.AverageRating = game.AverageRating;
                    bgdi.Rank = game.Rank;
                    bgdi.BGGRating = game.BGGRating;
                    bgdi.FetchDate = DateTime.Now;
                    bgdi.IsExpansion = game.IsExpansion;
                    bgdi.TotalComments = game.TotalComments;
                    bgdi.IsFullyLoaded = true;

                    foreach (string publisher in game.Publishers)
                        bgdi.Publishers.Add(publisher);
                    foreach (string designer in game.Designers)
                        bgdi.Designers.Add(designer);
                    foreach (string artist in game.Artists)
                        bgdi.Artists.Add(artist);

                    foreach (Comment comment in game.Comments.OrderByDescending(x => x.Text.Length))
                    {
                        bgdi.Comments.Add(new CommentDataItem()
                        {
                            Rating = comment.Rating,
                            Text = comment.Text,
                            Username = comment.Username
                        });
                    }

                    foreach (PlayerPollResult result in game.PlayerPollResults.OrderBy(x => x.NumPlayers + (x.NumPlayersIsAndHigher ? 1 : 0))) // add one to 4+ , making it 5 and the highest
                    {
                        bgdi.PlayerPollResults.Add(new PlayerPollResultDataItem()
                        {
                            Best = result.Best,
                            NumPlayers = result.NumPlayers,
                            NumPlayersIsAndHigher = result.NumPlayersIsAndHigher,
                            NotRecommended = result.NotRecommended,
                            Recommended = result.Recommended
                        });
                    }

                    //if (BoardGameStorage.LoadGame(GameId) == null) // a different thread could have inserted the game by now!


                    bgdi.DisableUpdate = false;
                    #endregion
                }
                else
                    return null;
            }
            return bgdi;
        }
Пример #9
0
        public bool Matches(BoardGameDataItem BoardGame)
        {
            if(string.IsNullOrEmpty(FilterText))
                return true;

            if(BoardGame == null)
                return false;
            if(string.IsNullOrEmpty(BoardGame.Name))
                return false;

            return BoardGame.Name.ToLower().Contains(FilterText.ToLower());
        }
Пример #10
0
        public bool Matches(BoardGameDataItem BoardGame)
        {
            switch (StatusToFilterOn)
            {
                case GameCollectionStatus.All:
                    return true;

                case GameCollectionStatus.Owned:
                    return BoardGame.Owned;

                case GameCollectionStatus.ForTrade:
                    return BoardGame.ForTrade;

                case GameCollectionStatus.PreOrdered:
                    return BoardGame.PreOrdered;

                case GameCollectionStatus.PreviouslyOwned:
                    return BoardGame.PreviouslyOwned;

                case GameCollectionStatus.Want:
                    return BoardGame.Want;

                case GameCollectionStatus.WantToBuy:
                    return BoardGame.WantToBuy;

                case GameCollectionStatus.WantToPlay:
                    return BoardGame.WantToPlay;

                case GameCollectionStatus.WishList:
                    return BoardGame.Wishlist;
                case GameCollectionStatus.Played:
                    return BoardGame.Played;
                case GameCollectionStatus.OwnedUnplayed:
                    return !BoardGame.Played && BoardGame.Owned;

            }
            return false;
        }
Пример #11
0
        public bool Matches(BoardGameDataItem game)
        {
            bool match = true;
            if (game == null)
                match = false;
            else if (Amount == 0)
            {
                match = true; //match all;
            }
            else if (game.PlayingTime == 0)
            {
                match = false;
            }
            else if (game.PlayingTime > Amount)
                match = false;

            return match;
        }
Пример #12
0
        public bool Matches(BoardGameDataItem game)
        {
            bool match = true;
            if (game == null)
                match = false;
            else if (Amount == 0)
            {
                match = true; //match all;
            }
            else if (game.MinPlayers > Amount)
                match = false;
            else if (game.MaxPlayers < Amount)
                match = false;

            return match;
        }
Пример #13
0
 public static void RemoveGame(BoardGameDataItem Game)
 {
     StorageManager.Games.Remove(Game);
 }
Пример #14
0
        public static BoardGameDataItem GetGame()
        {
            BoardGameDataItem demodata = new BoardGameDataItem()
            {
                Description = @"Werewolves of Miller's Hollow is a game that takes place in a small village which is haunted by werewolves. Each player is secretly assigned a role - Werewolf, Ordinary Townsfolk, or special character such as The Sheriff, The Hunter, the Witch, the Little Girl, The Fortune Teller and so on... There is also a Moderator player who controls the flow of the game. The game alternates between night and day phases. At night, the Werewolves secretly choose a Villager to kill. During the day, the Villager who was killed is revealed and is out of the game. The remaining Villagers (normal and special villagers alike) then deliberate and vote on a player they suspect is a Werewolf, helped (or hindered) by the clues the special characters add to the general deliberation. The chosen player is &quot;lynched&quot;, reveals his/her role and is out of the game. Werewolf is a social game that requires no equipment to play, and can accommodate almost any large group of players.&#10;&#10;The Werewolves of Miller's Hollow/les Loups-Garous de Thiercelieux/Die Werw&ouml;lfe von D&uuml;sterwald is a published version arranged by Herv&#195;&#169; Marly and Philippe des Palli&#195;&#168;res and published by Lui-m&#195;&#170;me, 2001 for 8-23 players. This has been nominated for the 2003 Spiel des Jahres award.&#10;&#10;Werewolves of Miller's Hollow is a separate game from Werewolf, and was split from that entry at the request of Asmodee.&#10;&#10;Expanded by:&#10;&#10; New Moon: The Werewolves of Miller's Hollow&#10;&#10;&#10;&#10;&#10;Re-Implemented by:&#10;&#10; Werewolves of Miller's Hollow: The Village&#10;&#10;&#10;&#10;&#10;Home Page: http://lesloupsgarous.free.fr/&#10;&#10;",
                GameId = 25821,
                YearPublished = 2012,
                Thumbnail = @"http://cf.geekdo-images.com/images/pic510856_t.jpg",
                Name = "The Werewolves of Miller's Hollow",
                MinPlayers = 8,
                MaxPlayers = 18,
                Image = @"http://cf.geekdo-images.com/images/pic510856.jpg"
            };

            demodata.Comments.Add(new CommentDataItem()
            {
                Rating = 0,
                Username = "******",
                Text = "I expected so much and instead we got an average LCG. Simple for newcomers but if you own AGoT LCG don't even bother with this one. I give this a 4 as they could have done so much more both mechanically and it is Star Wars! An average card game I just don't want to play (some neat art though)."
            });
            demodata.Comments.Add(new CommentDataItem()
            {
                Rating = 8,
                Username = "******",
                Text = "eh.."
            });

            demodata.PlayerPollResults.Add(new PlayerPollResultDataItem()
            {
                NumPlayers = 1,
                Best = 10,
                Recommended = 20,
                NotRecommended = 5,
                NumPlayersIsAndHigher = false
            });
            demodata.PlayerPollResults.Add(new PlayerPollResultDataItem()
            {
                NumPlayers = 2,
                Best = 10,
                Recommended = 20,
                NotRecommended = 5,
                NumPlayersIsAndHigher = false
            });
            demodata.PlayerPollResults.Add(new PlayerPollResultDataItem()
            {
                NumPlayers = 3,
                Best = 15,
                Recommended = 28,
                NotRecommended = 5,
                NumPlayersIsAndHigher = false
            });
            demodata.PlayerPollResults.Add(new PlayerPollResultDataItem()
            {
                NumPlayers = 4,
                Best = 10,
                Recommended = 120,
                NotRecommended = 5,
                NumPlayersIsAndHigher = false
            });
            demodata.PlayerPollResults.Add(new PlayerPollResultDataItem()
            {
                NumPlayers = 4,
                Best = 0,
                Recommended = 0,
                NotRecommended = 132,
                NumPlayersIsAndHigher = true
            });

            return demodata;
        }
Пример #15
0
        public async void LoadCollection()
        {
            UserCollection.Clear();


            if (string.IsNullOrEmpty(_Username))
            {
                return;
            }

            LoadCollectionFromCache();

            Messenger.Default.Send<CollectionLoadingMessage>(new CollectionLoadingMessage() { isQuick = true });

            IEnumerable<Boardgame> items = await Client.LoadCollection(_Username);
            foreach (Boardgame item in items)
            {
                BoardGameDataItem cdi = BoardGameStorage.LoadGame(item.GameId);
                if (cdi == null)// Add to main store
                {
                    cdi = new BoardGameDataItem();
                    cdi.IsFullyLoaded = false; // Indicate Loadgame should get individual results from API
                    BoardGameStorage.AddGame(cdi);
                }

                cdi.Name = item.Name;
                cdi.NumPlays = item.NumPlays;
                cdi.Thumbnail = item.Thumbnail;
                cdi.YearPublished = item.YearPublished;
                cdi.GameId = item.GameId;
                cdi.ForTrade = item.ForTrade;
                cdi.Owned = item.Owned;
                cdi.PreOrdered = item.PreOrdered;
                cdi.Want = item.Want;
                cdi.PreviouslyOwned = item.PreviousOwned;
                cdi.WantToBuy = item.WantToBuy;
                cdi.WantToPlay = item.WantToPlay;
                cdi.Wishlist = item.WishList;
                cdi.Rating = item.Rating;
                cdi.AverageRating = item.AverageRating;
                cdi.BGGRating = item.BGGRating;
                cdi.Image = item.Image;
                cdi.MaxPlayers = item.MaxPlayers;
                cdi.MinPlayers = item.MinPlayers;
                cdi.PlayingTime = item.PlayingTime;
                cdi.IsExpansion = item.IsExpansion;
                cdi.Rank = item.Rank;
                cdi.UserComment = item.UserComment;

                if (cdi.IsValidCollectionMember)
                {
                    cdi.IsCollectionItem = true;
                    if (UserCollection.Contains(cdi))
                        UserCollection.Remove(cdi);

                    UserCollection.Add(cdi);
                }
            }

            UpdateCollectionForHub();

            Messenger.Default.Send<CollectionLoadedMessage>(new CollectionLoadedMessage() { isQuick = true });

            LoadCollectionFully();
        }
Пример #16
0
        public bool Matches(BoardGameDataItem game)
        {
            bool match = true;
            if (game == null)
                match = false;

            switch (RequestedStatus)
            {
                case ExpansionStatus.All:
                    match = true;
                    break;
                case ExpansionStatus.BaseGame:
                    match = game.IsExpansion == false;
                    break;
                case ExpansionStatus.Expansion:
                    match = game.IsExpansion;
                    break;
                default:
                    match = false;
                    break;
            }
            return match;
        }
Пример #17
0
 public static void AddGame(BoardGameDataItem Game)
 {
     StorageManager.AddGame(Game);
     // await StorageManager.Save<BoardGameDataItem>();
 }