Inheritance: MonoBehaviour
	void			Awake () {
		if (INSTANCE == null)
			INSTANCE = this;
		else if (INSTANCE != this)
			Destroy (this.gameObject);
		this.AI = false;
		this.BreakableFive = false;
		this.ThreeDouble = false;
		DontDestroyOnLoad (this.gameObject);
	}
Exemple #2
0
    private IEnumerator WaitForInit()
    {
        UUI.UnlockMouse(true);
        TutorialController.movementAllowed = false;

        GamePreferences.Set(Preferences.CommsRadioSpawnMode, false);
        GamePreferences.RegisterToPreferenceUpdated(Preferences.CommsRadioSpawnMode, DisableSpawnMode);

        if (!NetworkManager.IsHost())
        {
            // Create offline save
            Main.Log($"[CLIENT] Creating offline save");
            SingletonBehaviour <NetworkSaveGameManager> .Instance.CreateOfflineBackup();

            CustomUI.OpenPopup("Connecting", "Loading savegame");
            Main.Log($"[CLIENT] Receiving savegame");
            AppUtil.Instance.PauseGame();
            // Check if host is connected if so the savegame should be available to receive
            SingletonBehaviour <NetworkJobsManager> .Instance.PlayerConnect();

            yield return(new WaitUntil(() => networkPlayers.ContainsKey(0) || modMismatched));

            if (modMismatched)
            {
                UUI.UnlockMouse(false);
                TutorialController.movementAllowed = true;
                Main.Log($"Mods Mismatched so disconnecting player");
                CustomUI.Open(CustomUI.ModMismatchScreen, false, false);
                NetworkManager.Disconnect();
                yield break;
            }

            // Wait till spawn is set
            yield return(new WaitUntil(() => spawnData != null));

            AppUtil.Instance.UnpauseGame();
            yield return(new WaitUntil(() => !AppUtil.IsPaused));

            yield return(new WaitForEndOfFrame());

            PlayerManager.TeleportPlayer(spawnData.Position + WorldMover.currentMove, PlayerManager.PlayerTransform.rotation, null, false);
            UUI.UnlockMouse(true);

            // Wait till world is loaded
            yield return(new WaitUntil(() => SingletonBehaviour <TerrainGrid> .Instance.IsInLoadedRegion(PlayerManager.PlayerTransform.position)));

            AppUtil.Instance.PauseGame();
            yield return(new WaitUntil(() => AppUtil.IsPaused));

            // Remove all Cars
            SingletonBehaviour <CarsSaveManager> .Instance.DeleteAllExistingCars();

            // Load Junction data from server that changed since uptime
            Main.Log($"Syncing Junctions");
            SingletonBehaviour <NetworkJunctionManager> .Instance.SyncJunction();

            yield return(new WaitUntil(() => SingletonBehaviour <NetworkJunctionManager> .Instance.IsSynced));

            // Load Turntable data from server that changed since uptime
            Main.Log($"Syncing Turntables");
            SingletonBehaviour <NetworkTurntableManager> .Instance.SyncTurntables();

            yield return(new WaitUntil(() => SingletonBehaviour <NetworkTurntableManager> .Instance.IsSynced));

            // Load Train data from server that changed since uptime
            Main.Log($"Syncing traincars");
            SingletonBehaviour <NetworkTrainManager> .Instance.SendInitCarsRequest();

            yield return(new WaitUntil(() => SingletonBehaviour <NetworkTrainManager> .Instance.IsSynced));

            SingletonBehaviour <NetworkSaveGameManager> .Instance.ResetDebts();

            // Load Job data from server that changed since uptime
            Main.Log($"Syncing jobs");
            SingletonBehaviour <NetworkJobsManager> .Instance.SendJobsRequest();

            yield return(new WaitUntil(() => SingletonBehaviour <NetworkJobsManager> .Instance.IsSynced));

            SingletonBehaviour <NetworkJobsManager> .Instance.OnFinishLoading();

            AppUtil.Instance.UnpauseGame();
            yield return(new WaitUntil(() => !AppUtil.IsPaused));

            yield return(new WaitForEndOfFrame());

            CustomUI.Close();
        }
        else
        {
            Main.Log($"Save should be loaded. Run OnFinishedLoading in NetworkTrainManager");
            SingletonBehaviour <NetworkTrainManager> .Instance.OnFinishedLoading();

            yield return(new WaitUntil(() => SingletonBehaviour <NetworkTrainManager> .Instance.SaveCarsLoaded));

            Main.Log($"Run OnFinishedLoading in NetworkJobsManager");
            SingletonBehaviour <NetworkJobsManager> .Instance.OnFinishLoading();
        }

        SendIsLoaded();
        Main.Log($"Finished loading everything. Unlocking mouse and allow movement");
        UUI.UnlockMouse(false);
        TutorialController.movementAllowed = true;
        IsSynced = true;
        // Move to spawn
    }
    //GetPlayerAttackCooldown
    public float GetPlayerAttackCooldownFromCharSelection()
    {
        string name = CharSelectionController.instance.GetAttackCoolDownFromIndex(GamePreferences.GetCharacterIndex());

        return(PlayerPrefs.GetFloat(name));
    }
 public void SetReviveRubyCount()
 {
     reviveRubyText.text = "" + GamePreferences.GetSpecialCoinCoint();
 }
Exemple #5
0
 void SetScoreOnGP()
 {
     SetScore(GamePreferences.GetHighscore());
 }
Exemple #6
0
 private void MusicObjectLogic()
 {
     musicSlider.value = GamePreferences.getMusicState();
     // look at the sliderListerner for further logic
 }
Exemple #7
0
 public void SetTheButtons()
 {
     ChangeMusicStateAid(GamePreferences.GetMusicState());
     ChangeSoundStateAid(GamePreferences.GetSoundState());
 }
Exemple #8
0
    }      // ontrigger enter

    void CheckGameStatus()
    {
        // remove the player from scene by changing his x y position, and then decrement lifes
        Vector3 temp = transform.position;

        temp.x             = 100;
        temp.y             = 100;
        transform.position = temp;
        lifeCount--;

        // if lifes are less than 0 end the game, get the coins and score and check it with the highscore
        if (lifeCount < 0)
        {
            if (easyDifficulty == 1)
            {
                int currentHighscore     = GamePreferences.GetEasyDifficultyHighscore();
                int currentCoinHighscore = GamePreferences.GetEasyDifficultyCoinScore();

                if (currentHighscore < scoreCount)
                {
                    GamePreferences.SetEasyDifficultyHighscore(scoreCount);
                }

                if (currentCoinHighscore < coinCount)
                {
                    GamePreferences.SetEasyDifficultyCoinScore(coinCount);
                }
            }               // easy difficulty

            if (mediumDifficulty == 1)
            {
                int currentHighscore     = GamePreferences.GetMediumDifficultyHighscore();
                int currentCoinHighscore = GamePreferences.GetMediumDifficultyCoinScore();

                if (currentHighscore < scoreCount)
                {
                    GamePreferences.SetMediumDifficultyHighscore(scoreCount);
                }

                if (currentCoinHighscore < coinCount)
                {
                    GamePreferences.SetMediumDifficultyCoinScore(coinCount);
                }
            }               // mediumDifficulty

            if (hardDifficulty == 1)
            {
                int currentHighscore     = GamePreferences.GetHardDifficultyHighscore();
                int currentCoinHighscore = GamePreferences.GetHardDifficultyCoinScore();

                if (currentHighscore < scoreCount)
                {
                    GamePreferences.SetHardDifficultyHighscore(scoreCount);
                }

                if (currentCoinHighscore < coinCount)
                {
                    GamePreferences.SetHardDifficultyCoinScore(coinCount);
                }
            }               // hard difficulty

            // set the life count to be zero so that it wont display -1 on screen
            lifeCount = 0;

            StartCoroutine(ReloadMainMenuAfterPlayerHasNoMoreLifesLeft());


            // the player has still lifes left to continue the game
        }
        else
        {
            PlayerPrefs.SetInt(GamePreferences.CurrentScore, scoreCount);
            PlayerPrefs.SetInt(GamePreferences.CurrentCoinScore, coinCount);
            PlayerPrefs.SetInt(GamePreferences.CurrentLifes, lifeCount);

            PlayerPrefs.SetInt(GamePreferences.GameResumedAfterPlayerDied, 1);

            StartCoroutine(ReloadGame());
        }
    }
Exemple #9
0
 public void SetCount()
 {
     dumplingText.text = "" + GamePreferences.GetDumplingCount();
     rubyText.text     = "" + GamePreferences.GetSpecialCoinCoint();
 }
Exemple #10
0
        public int CreateGame(string username, List <KeyValuePair <string, int> > preferenceList)
        {
            User            user = userController.GetUserByName(username);
            GamePreferences pref = new GamePreferences();
            IGame           game = new Game(currentID++, pref);

            foreach (var pair in preferenceList)
            {
                if (pair.Key == "buyIn")
                {
                    if (pair.Value < 0)  //real money and has to be equal or greater than zero
                    {
                        throw new illegalbuyInException(pair.Value.ToString());
                    }
                    game = new BuyInDecorator(game, pair.Value);
                }
                if (pair.Key == "minBet")
                {
                    if (pair.Value <= 0 || (pair.Value > game.Pref.ChipPolicy && game.Pref.ChipPolicy != 0))
                    {
                        throw new illegalMinBetException(pair.Value.ToString());
                    }
                    game = new MinBetDecorator(game, pair.Value);
                }
                if (pair.Key == "minPlayers")
                {
                    if (pair.Value > game.Pref.MaxPlayers)
                    {
                        throw new illegalGapPlayersException(pair.Value.ToString(), game.Pref.MaxPlayers.ToString());
                    }
                    if (pair.Value < 2)
                    {
                        throw new illegalMinPlayersException(pair.Value.ToString());
                    }
                    game = new MinPlayersDecorator(game, pair.Value);
                }
                if (pair.Key == "maxPlayers")
                {
                    if (pair.Value > 9)
                    {
                        throw new illegalMaxPlayersException(pair.Value.ToString());
                    }
                    if (pair.Value < game.Pref.MinPlayers)
                    {
                        throw new illegalGapPlayersException(game.Pref.MinPlayers.ToString(), pair.Value.ToString());
                    }
                    game = new MaxPlayersDecorator(game, pair.Value);
                }
                if (pair.Key == "chipPolicy")
                {
                    if (pair.Value < 0 || (pair.Value < game.Pref.MinBet && pair.Value != 0))
                    {
                        throw new illegalChipPolicyException(pair.Value.ToString());
                    }
                    game = new ChipPolicyDecorator(game, pair.Value);
                }
                if (pair.Key == "spectateGame")
                {
                    bool spectateGame = pair.Value == 1;
                    game = new SpectateGameDecorator(game, spectateGame);
                }
                if (pair.Key == "gameType" && pair.Value == 0)
                {
                    game = new LimitHoldemDecorator(game);
                }
                if (pair.Key == "gameType" && pair.Value == 2)
                {
                    game = new PotLimitHoldemDecorator(game);
                }
                if (pair.Key == "gameType" && (pair.Value < 0 || pair.Value > 2))
                {
                    throw new illegalGameTypeException(pair.Value.ToString());
                }

                // can be extended....
            }
            if (user.MoneyBalance < game.Pref.BuyIn)
            {
                throw new notEnoughMoneyException(user.MoneyBalance.ToString(), game.Pref.BuyIn.ToString());
            }
            game.AddPlayer(user, new Player(game, 0, username));
            game.League = user.League;
            games.Add(game.Id, game);
            return(game.Id);
        }
Exemple #11
0
 public static void Flush(string filename)
 {
     SwapPre();
     GamePreferences.Flush(filename);
     SwapPost();
 }
Exemple #12
0
    public void CheckGameStatus(int score, int coinCount, int lifeCount)
    {
        if (lifeCount < 0)         // player is gameOver

        // update higscores if necessary
        // for easy
        {
            if (GamePreferences.GetEasyDifficulty() == 1)
            {
                int highScore     = GamePreferences.GetEasyDifficultyHighScore();
                int coinHighScore = GamePreferences.GetEasyDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetEasyDifficultyHighScore(score);
                }
                if (coinHighScore < coinCount)
                {
                    GamePreferences.SetEasyDifficultyCoinScore(coinCount);
                }
            }

            // for medium
            if (GamePreferences.GetMediumDifficulty() == 1)
            {
                int highScore     = GamePreferences.GetMediumDifficultyHighScore();
                int coinHighScore = GamePreferences.GetMediumDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetMediumDifficultyHighScore(score);
                }
                if (coinHighScore < coinCount)
                {
                    GamePreferences.SetMediumDifficultyCoinScore(coinCount);
                }
            }

            // for hard
            if (GamePreferences.GetHardDifficulty() == 1)
            {
                int highScore     = GamePreferences.GetHardDifficultyHighScore();
                int coinHighScore = GamePreferences.GetHardDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetHardDifficultyHighScore(score);
                }
                if (coinHighScore < coinCount)
                {
                    GamePreferences.SetHardDifficultyCoinScore(coinCount);
                }
            }


            gameStartedFromMainMenu = false;
            gameStartedAfterDeath   = false;

            GameplayController.gameplayController.GameOverShowPanel(score, coinCount);
        }
        else         // we still have lifes left
        {
            this.score     = score;
            this.coinCount = coinCount;
            this.lifeCount = lifeCount;

            gameStartedFromMainMenu = false;
            gameStartedAfterDeath   = true;

            GameplayController.gameplayController.PlayerDiedRestartGame();
        }
    }
Exemple #13
0
 public ClientGame createGame(GamePreferences preferecnces, string userName)
 {
     return(new ClientGame(gc.createGame(preferecnces, system.getUser(userName))));
 }
Exemple #14
0
 private PreferencesManager()
 {
     //TODO: PropertyGrid for editing this
     RenderPreferences = new RenderPreferences();
     GamePreferences   = new GamePreferences();
 }
Exemple #15
0
    public void CheckGameStatus(int score, int coinScore, int lifeScore)
    {
        //Debug.Log("lifeScore = " + lifeScore);

        if (lifeScore < 0)
        {
            if (GamePreferences.GetEasyDifficultyState() == 1)
            {
                int highScore     = GamePreferences.GetEasyDifficultyHighScore();
                int coinHighScore = GamePreferences.GetEasyDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetEasyDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    GamePreferences.SetEasyDifficultyCoinScore(coinScore);
                }
            }

            if (GamePreferences.GetMediumDifficultyState() == 1)
            {
                int highScore     = GamePreferences.GetMediumDifficultyHighScore();
                int coinHighScore = GamePreferences.GetMediumDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetMediumDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    GamePreferences.SetMediumDifficultyCoinScore(coinScore);
                }
            }

            if (GamePreferences.GetHardDifficultyState() == 1)
            {
                int highScore     = GamePreferences.GetHardDifficultyHighScore();
                int coinHighScore = GamePreferences.GetHardDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetHardDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    GamePreferences.SetHardDifficultyCoinScore(coinScore);
                }
            }

            gameStartedFormMainMenu    = false;
            gameStartedAfterPlayerDied = false;

            GamePlayController.instance.gameOvershowPanel(score, coinScore);
        }
        else
        {
            this.score     = score;
            this.coinScore = coinScore;
            this.lifeScore = lifeScore;

            /* GamePlayController.instance.setScore(score);
             * GamePlayController.instance.setCoinScore(coinScore);
             * GamePlayController.instance.setLifeScore(lifeScore); */

            gameStartedFormMainMenu    = false;
            gameStartedAfterPlayerDied = true;

            GamePlayController.instance.RestartTheGame();
        }
    }
Exemple #16
0
 public void SetStartHighScore()
 {
     score           = GamePreferences.GetHighScore();
     sHighScore.text = "" + score;
 }
    void SetScoreBasedOnDifficulty()
    {
        if (GamePreferences.GetEasyDifficultyState() == 1)
        {
            Debug.Log($"Trying to set the highscore of easy, score : {GamePreferences.GetEasyDifficultyHighScore()} , coin : {GamePreferences.GetEasyDifficultyCoinScore()}");
            SetScore(GamePreferences.GetEasyDifficultyHighScore(), GamePreferences.GetEasyDifficultyCoinScore());
        }

        if (GamePreferences.GetMediumDifficultyState() == 1)
        {
            SetScore(GamePreferences.GetMediumDifficultyHighScore(), GamePreferences.GetMediumDifficultyCoinScore());
        }

        if (GamePreferences.GetHardDifficultyState() == 1)
        {
            SetScore(GamePreferences.GetHardDifficultyHighScore(), GamePreferences.GetHardDifficultyCoinScore());
        }
    }
Exemple #18
0
    public void CheckGameStatus(int score, int coinScore, int lifeScore)
    {
        if (lifeScore < 0)
        {
            if (GamePreferences.GetEasyDifficulty() == 1)
            {
                int highScore     = GamePreferences.GetEasyDifficultyHighScore();
                int coinHighScore = GamePreferences.GetEasyDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetEasyDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    GamePreferences.SetEasyDifficultyCoinScore(coinScore);
                }
            }
            if (GamePreferences.GetMediumDifficulty() == 1)
            {
                int highScore     = GamePreferences.GetMediumDifficultyHighScore();
                int coinHighScore = GamePreferences.GetMediumDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetMediumDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    GamePreferences.SetMediumDifficultyCoinScore(coinScore);
                }
            }
            if (GamePreferences.GetHardDifficulty() == 1)
            {
                int highScore     = GamePreferences.GetHardDifficultyHighScore();
                int coinHighScore = GamePreferences.GetHardDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePreferences.SetHardDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    GamePreferences.SetHardDifficultyCoinScore(coinScore);
                }
            }
            gameStartedFromMainMenu    = false;
            gameStartedAfterPlayerDied = false;

            GameplayController.instance.GameOverShowPanel(score, coinScore);
        }
        else
        {
            this.score     = score;
            this.coinScore = coinScore;
            this.lifeScore = lifeScore;

            gameStartedAfterPlayerDied = true;
            gameStartedFromMainMenu    = false;

            GameplayController.instance.PlayerDiedRestartGame();
        }
    }
    public void HandleRewardBasedVideoRewarded(object sender, Reward args)
    {
        int coinAmount = (int)args.Amount;

        GamePreferences.SetCoinScore(GamePreferences.GetCoinScore() + coinAmount);
    }
Exemple #20
0
 // Use this for initialization
 void Start()
 {
     SetSettingsPanel();
     SetTheButtons();
     SetGiftCodeButton(GamePreferences.GetGiftCodeTries());
 }
Exemple #21
0
    void InitializeVariables()
    {
        //Select ninja as default
        if (!PlayerPrefs.HasKey(GamePreferences.player))
        {
            GamePreferences.SetPlayer(GamePreferences.Ninja);
        }

        //Purchased players
        if (!PlayerPrefs.HasKey(GamePreferences.ninjaPurchased))
        {
            GamePreferences.SetCharacterPurchased(1, GamePreferences.ninjaPurchased);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.krotanaPurchased))
        {
            GamePreferences.SetCharacterPurchased(0, GamePreferences.krotanaPurchased);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.gukanPurchased))
        {
            GamePreferences.SetCharacterPurchased(0, GamePreferences.gukanPurchased);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.hoodPurchased))
        {
            GamePreferences.SetCharacterPurchased(0, GamePreferences.hoodPurchased);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.qtowniePurchased))
        {
            GamePreferences.SetCharacterPurchased(0, GamePreferences.qtowniePurchased);
        }

        //Character index
        if (!PlayerPrefs.HasKey(GamePreferences.characterIndex))
        {
            GamePreferences.SetCharacterIndex(0);
        }

        //Life capacity
        if (!PlayerPrefs.HasKey(GamePreferences.ninjaLifeCapacity))
        {
            GamePreferences.SetLifeCapacity(4, GamePreferences.ninjaLifeCapacity);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.krotanaLifeCapacity))
        {
            GamePreferences.SetLifeCapacity(4, GamePreferences.krotanaLifeCapacity);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.gukanLifeCapacity))
        {
            GamePreferences.SetLifeCapacity(4, GamePreferences.gukanLifeCapacity);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.hoodLifeCapacity))
        {
            GamePreferences.SetLifeCapacity(4, GamePreferences.hoodLifeCapacity);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.qtownieLifeCapacity))
        {
            GamePreferences.SetLifeCapacity(4, GamePreferences.qtownieLifeCapacity);
        }

        //AttackCooldown
        if (!PlayerPrefs.HasKey(GamePreferences.ninjaAttackCooldown))
        {
            GamePreferences.SetAttackCooldown(attackCooldown, GamePreferences.ninjaAttackCooldown);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.krotanaAttackCooldown))
        {
            GamePreferences.SetAttackCooldown(attackCooldown, GamePreferences.krotanaAttackCooldown);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.gukanAttackCooldown))
        {
            GamePreferences.SetAttackCooldown(attackCooldown, GamePreferences.gukanAttackCooldown);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.hoodAttackCooldown))
        {
            GamePreferences.SetAttackCooldown(attackCooldown, GamePreferences.hoodAttackCooldown);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.qtownieAttackCooldown))
        {
            GamePreferences.SetAttackCooldown(attackCooldown, GamePreferences.qtownieAttackCooldown);
        }

        //SuperPower duration
        if (!PlayerPrefs.HasKey(GamePreferences.ninjaSuperDuration))
        {
            GamePreferences.SetSuperDuration(superDuration, GamePreferences.ninjaSuperDuration);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.krotanaSuperDuration))
        {
            GamePreferences.SetSuperDuration(superDuration, GamePreferences.krotanaSuperDuration);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.gukanSuperDuration))
        {
            GamePreferences.SetSuperDuration(superDuration, GamePreferences.gukanSuperDuration);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.hoodSuperDuration))
        {
            GamePreferences.SetSuperDuration(superDuration, GamePreferences.hoodSuperDuration);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.qtownieSuperDuration))
        {
            GamePreferences.SetSuperDuration(superDuration, GamePreferences.qtownieSuperDuration);
        }

        //Character Lives Bar
        if (!PlayerPrefs.HasKey(GamePreferences.ninjaCharLives))
        {
            GamePreferences.SetCharLives(0, GamePreferences.ninjaCharLives);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.krotanaCharLives))
        {
            GamePreferences.SetCharLives(0, GamePreferences.krotanaCharLives);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.gukanCharLives))
        {
            GamePreferences.SetCharLives(0, GamePreferences.gukanCharLives);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.hoodCharLives))
        {
            GamePreferences.SetCharLives(0, GamePreferences.hoodCharLives);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.qtownieCharLives))
        {
            GamePreferences.SetCharLives(0, GamePreferences.qtownieCharLives);
        }

        //Character Attack Bar
        if (!PlayerPrefs.HasKey(GamePreferences.ninjaCharAttack))
        {
            GamePreferences.SetCharAttack(0, GamePreferences.ninjaCharAttack);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.krotanaCharAttack))
        {
            GamePreferences.SetCharAttack(0, GamePreferences.krotanaCharAttack);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.gukanCharAttack))
        {
            GamePreferences.SetCharAttack(0, GamePreferences.gukanCharAttack);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.hoodCharAttack))
        {
            GamePreferences.SetCharAttack(0, GamePreferences.hoodCharAttack);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.qtownieCharAttack))
        {
            GamePreferences.SetCharAttack(0, GamePreferences.qtownieCharAttack);
        }

        //Character SuperPower Bar
        if (!PlayerPrefs.HasKey(GamePreferences.ninjaCharSuper))
        {
            GamePreferences.SetCharSuper(0, GamePreferences.ninjaCharSuper);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.krotanaCharSuper))
        {
            GamePreferences.SetCharSuper(0, GamePreferences.krotanaCharSuper);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.gukanCharSuper))
        {
            GamePreferences.SetCharSuper(0, GamePreferences.gukanCharSuper);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.hoodCharSuper))
        {
            GamePreferences.SetCharSuper(0, GamePreferences.hoodCharSuper);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.qtownieCharSuper))
        {
            GamePreferences.SetCharSuper(0, GamePreferences.qtownieCharSuper);
        }

        //HighScore
        if (!PlayerPrefs.HasKey(GamePreferences.highScore))
        {
            GamePreferences.SetHighScore(0);
        }

        //Dumpling Count
        if (!PlayerPrefs.HasKey(GamePreferences.dumplingCount))
        {
            GamePreferences.SetDumplingCount(0);
        }

        //Special Coin Count
        if (!PlayerPrefs.HasKey(GamePreferences.specialCoinCount))
        {
            GamePreferences.SetSpecialCoinCount(0);
        }

        //Music State
        if (!PlayerPrefs.HasKey(GamePreferences.musicState))
        {
            GamePreferences.SetMusicState(1);
        }
        //Sound State
        if (!PlayerPrefs.HasKey(GamePreferences.soundState))
        {
            GamePreferences.SetSoundState(1);
        }

        //GiftCode Tries
        if (!PlayerPrefs.HasKey(GamePreferences.giftCodeTries))
        {
            GamePreferences.SetGiftCodeTries(0);
        }
        if (!PlayerPrefs.HasKey(GamePreferences.rightGiftCode))
        {
            GamePreferences.SetRightGiftCode(0);
        }

        //Background
        if (!PlayerPrefs.HasKey(GamePreferences.background))
        {
            GamePreferences.SetBackground(0);
        }

        //Times Played
        if (!PlayerPrefs.HasKey(GamePreferences.timesPlayed))
        {
            GamePreferences.SetTimesPlayed(0);
        }
    }
Exemple #22
0
        public void createGameTest()
        {
            GamePreferences preferecnces = new GamePreferences(8, 2, 10, 20, 1, 20, 6, true);

            Assert.AreNotEqual(gameCenter.createGame(preferecnces, user1), null);
        }
Exemple #23
0
        /*************************************/

        /// <summary>
        /// Allow the user to find an existing room according to different criteria and enter the room as a spectator.
        /// </summary>
        /// <remarks>UC004: Find an Existing Room</remarks>
        /// <returns>Collection of rooms</returns>
        /// <see cref="https://docs.google.com/document/d/1OTee6BGDWK2usL53jdoeBOI-1Jh8wyNejbQ0ZroUhcA/edit#heading=h.tvbd8487o8xd"/>
        public ICollection <Room> FindRoomsByCriteria(int level = -1, Player player = null, GamePreferences preferences = null, double minimumBet = -1.0)
        {
            var result = new List <Room>();

            if (level > 0)
            {
                var collections = (from league in leagues
                                   where league.MinLevel <= level & league.MaxLevel >= level
                                   select league.Rooms);

                var flat =
                    collections.Aggregate(new List <Room>(), (acc, x) => acc.Concat(x).ToList())
                    .Distinct(new Utility.AddressComparer <Room>());
                result.AddRange(flat);
            }

            if (player != null)
            {
                Room room = null;
                if (!playersManager.TryGetValue(player, out room))
                {
                    throw new RoomNotFoundException("room not found for player: " + player.GetHashCode().ToString());
                }

                if (result.Count == 0)
                {
                    result.Add(room);
                }
                else
                {
                    result = (from item in result where item == room select item).ToList();
                    if (result.Count != 1)
                    {
                        throw new RoomNotFoundException("mismatch of searching room. only 1 occurrence didn't returned");
                    }
                }
            }

            if (preferences != null)
            {
                result.AddRange(
                    from room in Rooms
                    where
                    (room.Preferences.AntesValue == preferences.AntesValue & preferences.AntesValue != DEFAULT_SEARCH_ANTE) |
                    (room.Preferences.BuyInCost == preferences.BuyInCost & preferences.BuyInCost != DEFAULT_SEARCH_BUYIN) |
                    (room.Preferences.MaxNumberOfPlayers == preferences.MaxNumberOfPlayers & preferences.MaxNumberOfPlayers != DEFAULT_SEARCH_MAX_PLAYERS) |
                    (room.Preferences.MinimumBet == preferences.MinimumBet & preferences.MinimumBet != DEFAULT_SEARCH_MIN_BET) |
                    (room.Preferences.MinNumberOfPlayers == preferences.MinNumberOfPlayers & preferences.MinNumberOfPlayers != DEFAULT_SEARCH_MIN_PLAEYRS) |
                    (room.Preferences.Name.Equals(preferences.Name) & !preferences.Name.Equals(DEFAULT_SEARCH_NAME))
                    select room
                    );
            }

            if (minimumBet > 0)
            {
                result.AddRange(
                    from room in Rooms
                    where room.Preferences.MinimumBet == minimumBet
                    select room
                    );
            }

            // finishing - removing duplicates
            result = result.Distinct().ToList();

            if (result.Count == 0)
            {
                throw new RoomNotFoundException(
                          "no rooms are find by the criteria: "
                          + (level > -1 ? "level: " + level : "")
                          + (player != null ? "player id: " + player.GetHashCode() : "")
                          + (minimumBet > -1.0 ? "bet size: " + minimumBet : "")
                          );
            }

            return(result);
        }
    //fb button listener
    public void ShareFBListener()
    {
        string fb_share_description = "Best kind of game, easy to learn and hard to master.\nEasy highscore: " + GamePreferences.GetEasyDifficultyHighscore() +
                                      "\nMedium highscore: " + GamePreferences.GetMediumDifficultyHighscore() + "\nHard highscore: " + GamePreferences.GetHardDifficultyHighscore();

        FB.ShareLink(
            contentURL: new Uri("https://1drv.ms/u/s!AucxQZ6OBPB75QtSFuwFbaUHUb-a"),
            contentTitle: FB_SHARE_TITLE,
            contentDescription: fb_share_description,
            callback: ShareCallback
            );


        // the contentTitle and contentDescription are not working, sdk broken
    }
 /// <summary>
 /// Allow the user to find an existing room according to different criteria and enter the room as a spectator.
 /// </summary>
 /// <remarks>UC004: Find an Existing Room</remarks>
 /// <returns>Collection of rooms</returns>
 /// <see cref="https://docs.google.com/document/d/1OTee6BGDWK2usL53jdoeBOI-1Jh8wyNejbQ0ZroUhcA/edit#heading=h.tvbd8487o8xd"/>
 public ICollection <Room> FindRoomsByCriteria(int level = -1, Player player = null, GamePreferences preferences = null, double betSize = -1.0)
 {
     return(gameCenter.FindRoomsByCriteria(level, player, preferences, betSize));
 }
    IEnumerator ReviveToGameOver(Text theText)
    {
        float temp;

        if (timesRevived >= 2)
        {
            temp = 0;
        }
        else
        {
            temp = 5;
        }

        while (temp > 0 && !reviveButtonPressed)
        {
            //if (pauseCountdown)
            //    temp = 5;
            theText.text = "" + temp;
            //temp--;
            yield return(new WaitForSecondsRealtime(1));

            temp--;
            if (pauseCountdown)
            {
                temp = 5;
            }
        }

        reviveButtonPressed = false;

        if (temp == 0)
        {
            DisableColliders();

            SetGameOverPanel();
            SetGameOverScores(PlayerScore.score, PlayerScore.enemiesKilledPS, PlayerScore.dumplingScore);
            int dumplingsTemp;
            int scoreTemp = PlayerScore.score + PlayerScore.enemiesKilledPS + PlayerScore.dumplingScore;

            dumplingsTemp = GamePreferences.GetDumplingCount() + PlayerScore.dumplingScore;
            GamePreferences.SetDumplingCount(dumplingsTemp);


            newHighText.gameObject.SetActive(false);
            if (scoreTemp > GamePreferences.GetHighScore())
            {
                GamePreferences.SetHighScore(scoreTemp);
                newHighText.gameObject.SetActive(true);

                Social.ReportScore(scoreTemp, "CgkItryzx64UEAIQAQ", (bool success) =>
                {
                    if (success)
                    {
                        Debug.Log("Score uploaded successfully");
                    }
                    else
                    {
                        Debug.Log("Score failed to upload");
                    }
                });
                //long scoreLong = scoreTemp;
                //Social.ReportScore(scoreLong, "leaderboardsID", HighScoreCheck);
            }
        }
    }
Exemple #27
0
 public GameObject getCurrentCircle()
 {
     return(circleModels [GamePreferences.GetCircleIndex()]);
 }
    public void SetCharacterActive()
    {
        string name = GamePreferences.GetPlayer();

        if (name == GamePreferences.Ninja)
        {
            GameObject.Find("Krotana").SetActive(false);
            GameObject.Find("MasterGukan").SetActive(false);
            GameObject.Find("Hood").SetActive(false);
            GameObject.Find("QTownie").SetActive(false);
            //player = GameObject.Find("CNinja");
            player     = GameObject.Find("CNinja");
            playerAnim = player.GetComponent <Animator>();
            playerAnim.SetBool("Grounded", true);
        }

        else if (name == GamePreferences.Krotana)
        {
            GameObject.Find("CNinja").SetActive(false);
            GameObject.Find("MasterGukan").SetActive(false);
            GameObject.Find("Hood").SetActive(false);
            GameObject.Find("QTownie").SetActive(false);
            //player = GameObject.Find("Krotana");
            player     = GameObject.Find("Krotana");
            playerAnim = player.GetComponent <Animator>();
            playerAnim.SetBool("Grounded", true);
        }

        else if (name == GamePreferences.MasterGukan)
        {
            GameObject.Find("CNinja").SetActive(false);
            GameObject.Find("Krotana").SetActive(false);
            GameObject.Find("Hood").SetActive(false);
            GameObject.Find("QTownie").SetActive(false);
            //player = GameObject.Find("MasterGukan");
            player     = GameObject.Find("MasterGukan");
            playerAnim = player.GetComponent <Animator>();
            playerAnim.SetBool("Grounded", true);
        }

        else if (name == GamePreferences.Hood)
        {
            GameObject.Find("CNinja").SetActive(false);
            GameObject.Find("Krotana").SetActive(false);
            GameObject.Find("MasterGukan").SetActive(false);
            GameObject.Find("QTownie").SetActive(false);

            player     = GameObject.Find("Hood");
            playerAnim = player.GetComponent <Animator>();
            playerAnim.SetBool("Grounded", true);
        }

        else if (name == GamePreferences.QTownie)
        {
            GameObject.Find("CNinja").SetActive(false);
            GameObject.Find("Krotana").SetActive(false);
            GameObject.Find("MasterGukan").SetActive(false);
            GameObject.Find("Hood").SetActive(false);

            player     = GameObject.Find("QTownie");
            playerAnim = player.GetComponent <Animator>();
            playerAnim.SetBool("Grounded", true);
        }

        else
        {
            player     = GameObject.Find("CNinja");
            playerAnim = player.GetComponent <Animator>();
            playerAnim.SetBool("Grounded", true);
        }
    }
Exemple #29
0
 public MultiDimensionalObject getCurrentDrops()
 {
     return(dropModels [GamePreferences.GetDropIndex()]);
 }
Exemple #30
0
 private void DisableSpawnMode()
 {
     GamePreferences.Set(Preferences.CommsRadioSpawnMode, false);
 }
Exemple #31
0
 public List <IGame> findGamesByPreference(GamePreferences pref)
 {
     throw new NotImplementedException();
 }