示例#1
0
        public StatsViewModel(IMvxSqliteConnectionFactory factory)
        {
            popup = new Popup() { isVisible = false };

            try
            {
                database = new DatabaseContext(factory);
            }
            catch (SQLiteException)
            {
                //to-do
                //Error message here
            }

            Setup();
        }
        public ScoreboardViewModel(IMvxSqliteConnectionFactory factory)
        {
            game = new SixNimmtGame();
            displayOverview = false;
            popup = new Popup() { isVisible = false };

            try
            {
                _database = new DatabaseContext(factory);
            }
            catch (SQLiteException)
            {
                //to-do
                //Error message here
            }
        }
        public SetupGameViewModel(IMvxSqliteConnectionFactory factory)
        {
            creatingPlayer = false;
            gameSettings = false;
            commandBarEnabled = true;
            error = new Error();
            popup = new Popup() { isVisible = false };
            playerUnderAction = new SixNimmtPlayer();

            length = Settings.gameLengthSetting;
            gameType = Settings.gameTypeSetting;

            try
            {
                _database = new DatabaseContext(factory);
            }
            catch (SQLiteException)
            {
                error.text = "Oops. Something went wrong. Please try again";
                error.isVisible = true;
            }

            GetAllPlayers();
        }
示例#4
0
        public DesignData()
        {
            displayOverview = true;

            game = new SixNimmtGame();

            game.round = 1;

            game.players = new ObservableCollection<SixNimmtPlayer>
            {
                new SixNimmtPlayer() { name = "Dan", index = 0, roundScore = 23, totalScore = 66, achievements = new ObservableCollection<SixNimmtPlayerAchievement>
                {
                    new SixNimmtPlayerAchievement { title = "New Personal Best Score", image = "../SixNimmt.Core/Assets/personalUp.png" },
                    new SixNimmtPlayerAchievement { title = "New Personal Worst Score", image = "../SixNimmt.Core/Assets/personalDown.png" },
                    new SixNimmtPlayerAchievement { title = "10th Win", image = "../SixNimmt.Core/Assets/milestoneWin.png" },
                    new SixNimmtPlayerAchievement { title = "100th Loss", image = "../SixNimmt.Core/Assets/milestoneLoss.png" },
                    new SixNimmtPlayerAchievement { title = "50th Game", image = "../SixNimmt.Core/Assets/milestoneGame.png" }
                }},
                new SixNimmtPlayer() { name = "Jack", index = 0, roundScore = 23, totalScore = 66 }
            };

            game.currentPlayer = game.players[0];

            allPlayers = new List<SixNimmtPlayer>
            {
                new SixNimmtPlayer { name = "Dan" },
                new SixNimmtPlayer { name = "Jack" },
                new SixNimmtPlayer { name = "Ben" },
                new SixNimmtPlayer { name = "Tom" }
            };

            ruleCategories = new List<RulesCategory>
            {
                new RulesCategory
                {
                    header = "Setup",
                    instructions = new ObservableCollection<string>
                    {
                        "10 cards to each player",
                        "4 cards to make rows"
                    }
                },
                new RulesCategory
                {
                    header = "Turn",
                    instructions = new ObservableCollection<string>
                    {
                        "10 cards to each player",
                        "4 cards to make rows"
                    }
                },
                new RulesCategory
                {
                    header = "Scoring",
                    instructions = new ObservableCollection<string>
                    {
                        "10 cards to each player",
                        "4 cards to make rows"
                    }
                },
                new RulesCategory
                {
                    header = "Variants",
                    instructions = new ObservableCollection<string>
                    {
                        "10 cards to each player",
                        "4 cards to make rows"
                    }
                },
            };

            playerStats = new List<PlayerStat>
            {
                new PlayerStat
                {
                    name = "Dan",
                    averageScore = 30,
                    bestScore = 66,
                    worstScore = 4,
                    numberOfGames = 100,
                    numberOfLoses = 0,
                    numberOfWins = 50,
                    winPercentage = 50
                }
            };

            popup = new Popup
            {
                message = "You are part way through a game. Stop here and save the results?",
                isVisible = true
            };
        }