Esempio n. 1
0
    /// <summary>
    /// Save the player's options.
    /// </summary>
    /// <param name="quality"></param>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="fullscreen"></param>
    public void SaveSettings(int quality, int width, int height, bool fullscreen)
    {
        var settings = new UserGameOptions()
        {
            quality    = quality,
            fullScreen = fullscreen,
            height     = height,
            width      = width
        };

        string fullPath = Path.Combine(Application.persistentDataPath, SETTINGS_FILE);

        if (File.Exists(fullPath))
        {
            File.Delete(fullPath);
        }

        // Write the contents of the settings to the disk
        File.WriteAllText(fullPath, JsonUtility.ToJson(settings));

        // Apply the settings for this session
        ApplySettings(settings);

        // Remember the settings for the next time this is called
        UserOptions = settings;
    }
Esempio n. 2
0
    /// <summary>
    /// Awaken the object!
    /// </summary>
    void Awake()
    {
        QualityNames = new List <string>(QualitySettings.names);
        Resolutions  = new List <Resolution>(Screen.resolutions);

        UserOptions = LoadOptions();

        IsReady = true;
    }
Esempio n. 3
0
    public void SaveSettings(int quality, int width, int height, bool fullscreen)
    {
        var settings = new UserGameOptions()
        {
            quality    = quality,
            fullScreen = fullscreen,
            height     = height,
            width      = width,
        };

        string fullPath = Path.Combine(Application.persistentDataPath, SETTINGS_FILE);

        if (File.Exists(fullPath))
        {
            File.Delete(fullPath);
        }

        File.WriteAllText(fullPath, JsonUtility.ToJson(settings));
        ApplySettings(settings);

        UserOptions = settings;
    }
Esempio n. 4
0
        // Registers players depending on user input
        public void RegisterPlayers(UserGameOptions userGameOptions)
        {
            roundId = 0;

            _database.Players.RemoveAllPlayers();

            var botNames = new List <string>()
            {
                "Bill", "John", "Trevor", "Mike", "Frank"
            };

            var user = new Player()
            {
                Name   = userGameOptions.PlayerName,
                Status = "Player"
            };

            var dealer = new Player()
            {
                Name   = "Jack",
                Status = "Dealer"
            };

            _database.Players.Create(user);
            _database.Players.Create(dealer);

            for (int i = 0; i < userGameOptions.NumberOfPlayers; i++)
            {
                var bot = new Player()
                {
                    Name   = botNames[i],
                    Status = "Bot"
                };

                _database.Players.Create(bot);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Apply quality and resolution settings for the game.
 /// </summary>
 /// <param name="settings">User options</param>
 void ApplySettings(UserGameOptions settings)
 {
     QualitySettings.SetQualityLevel(settings.quality);
     Screen.SetResolution(settings.width, settings.height, settings.fullScreen);
 }
        public ActionResult Index(UserGameOptions gameOptions)
        {
            _gameSession.RegisterPlayers(gameOptions);

            return(RedirectToAction("StartNewRound"));
        }
 public ActionResult GameStartMenu(UserGameOptions gameOptions)
 {
     game = new GameModel(gameOptions);
     return(RedirectToAction("GameSession"));
 }
        public ActionResult GameStartMenu()
        {
            UserGameOptions userGameOptions = new UserGameOptions();

            return(View(userGameOptions));
        }