Beispiel #1
0
 void LateUpdate()
 {
     if (didAbort)
     {
         return;
     }
     didAbort = true;
     client.Reset();
     SkillzCrossPlatform.AbortMatch();
 }
Beispiel #2
0
 public void OnQuitButton()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
     {
         //
         SkillzCrossPlatform.ReportFinalScore(Random.Range(1, 53021));
     }
     else
     {
         SceneManager.LoadScene("StartScene");
     }
 }
    public void EndGame(int _friendlyScore, int _enemyScore, bool _wasDisconnect)
    {
        if (gameIsOver)
        {
            return;
        }

        gameIsOver = true;

        //SetNextButtonActive(false);


        originalBoardPos     = gameBoard.transform.position;
        originalKeyboardPos  = keyboard.transform.position;
        originalCluePanelPos = clueHolder.transform.position;
        originalPausePos     = pauseButton.transform.position;
        originalScorePos     = scoreHolder.transform.position;


        int timeBonus = Mathf.Max(0, GetTimeBonus());

        finalScore = _friendlyScore + timeBonus;

        if (HomeLogic.isUsingSkillz)
        {
            if (SkillzCrossPlatform.IsMatchInProgress())
            {
                SkillzCrossPlatform.UpdatePlayersCurrentScore(finalScore);
            }
        }

        int highscore = 0;

        if (PlayerPrefs.HasKey("highscore"))
        {
            highscore = PlayerPrefs.GetInt("highscore");
        }

        if (finalScore >= highscore) // for a new highscore
        {
            highscore = finalScore;
            PlayerPrefs.SetInt("highscore", highscore);
            highScoreText.color = friendlyScoreText.color;
        }

        timeBonusText.text     = timeBonus.ToString();
        friendlyScoreText.text = finalScore.ToString();
        bestWordScoreText.text = gameplayLogic.bestWordScore.ToString();
        numCluesText.text      = gameplayLogic.numClues.ToString();
        highScoreText.text     = highscore.ToString();

        StartCoroutine(EndGameCoroutine());
    }
        private static void InitializeSkillz()
        {
            Debug.Log(string.Format(LogFormat, $"Initializing Skillz:"));
            Debug.Log(string.Format(LogFormat, $"Game ID={SkillzSettings.Instance.GameID}"));
            Debug.Log(string.Format(LogFormat, $"Environment={SkillzSettings.Instance.Environment}"));
            Debug.Log(string.Format(LogFormat, $"Orientation={SkillzSettings.Instance.Orientation}"));

            SkillzCrossPlatform.Initialize(
                SkillzSettings.Instance.GameID,
                SkillzSettings.Instance.Environment,
                SkillzSettings.Instance.Orientation
                );
        }
Beispiel #5
0
 public void OnPlayButton()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
     {
         Debug.Log("OnPlayButton call SkillzCrossPlatform.LaunchSkillz");
         GameDelegate gameDelegate = GameDelegate.getInstance();
         SkillzCrossPlatform.LaunchSkillz(gameDelegate);
     }
     else
     {
         SceneManager.LoadScene("GameScene");
     }
 }
    public void PlayGame()
    {
        //isUsingSkillz = false;

        if (isUsingSkillz)
        {
            SkillzCrossPlatform.LaunchSkillz();
        }
        else
        {
            SceneManager.LoadScene("GameScene");
        }
    }
 public void LeaveGame(int finalScore)
 {
     if (HomeLogic.isUsingSkillz)
     {
         if (SkillzCrossPlatform.IsMatchInProgress())
         {
             SkillzCrossPlatform.ReportFinalScore(finalScore);
         }
     }
     else
     {
         SceneManager.LoadScene("HomeScene");
     }
 }
        private void Update()
        {
            if (timeRemaining < 0f)
            {
                return;
            }

            timeRemaining   -= Time.deltaTime;
            secondsText.text = timeRemaining.ToString("0");

            if (timeRemaining < 0f)
            {
                var matchInfoJson = MatchInfoJson.Build(SkillzSettings.Instance.GameID);
                SkillzCrossPlatform.InitializeSimulatedMatch(matchInfoJson);
                SkillzState.NotifyMatchWillBegin(matchInfoJson);
            }
        }
Beispiel #9
0
    public void scoreUpdate()
    {
        if (gameOver)
        {
            return;
        }

        uiScore += collector.GetComponent <Collect>().catcherScore;
        catchText.GetComponent <Text>().text = "+ " + collector.GetComponent <Collect>().catcherScore;
        catchText.SetActive(true);
        catchTextActive = true;
        previousTime    = Time.time;
        ballColor       = collector.GetComponent <Collect>().ballColor;

        if (SkillzCrossPlatform.IsMatchInProgress())
        {
            SkillzCrossPlatform.UpdatePlayersCurrentScore(uiScore);
        }
    }
Beispiel #10
0
    public void gameOverActivate()
    {
        gameOver = true;

        gameOverScoreText.text = "YOUR SCORE" + "\r\n" + uiScore;
        gameOverComboText.text = "YOUR COMBO" + "\r\n" + combos;
        gameOverScoreText.gameObject.SetActive(true);
        gameOverComboText.gameObject.SetActive(true);

        if (PlayerPrefs.GetInt("HighScore") < uiScore)
        {
            PlayerPrefs.SetInt("HighScore", uiScore);
        }

        if (SkillzCrossPlatform.IsMatchInProgress())
        {
            SkillzCrossPlatform.ReportFinalScore(uiScore);
        }
    }
    void LateUpdate()
    {
        if (didSubmit)
        {
            return;
        }
        didSubmit = true;

        client.Reset();

        if (UserData.Instance != null)
        {
            UserData.Instance.IsGameOver       = false;
            UserData.Instance.IsGameStarted    = false;
            UserData.Instance.IsUnityAppPaused = false;
        }
        Debug.Log("Submitting score: " + client.Score);
        SkillzCrossPlatform.ReportFinalScore(client.Score);
    }
        public Match(JSONDict jsonData)
        {
            Description   = jsonData.SafeGetStringValue("matchDescription");
            EntryCash     = (float)jsonData.SafeGetDoubleValue("entryCash");
            EntryPoints   = jsonData.SafeGetIntValue("entryPoints");
            ID            = jsonData.SafeGetUlongValue("id");
            TemplateID    = jsonData.SafeGetIntValue("templateId");
            Name          = jsonData.SafeGetStringValue("name");
            IsCash        = jsonData.SafeGetBoolValue("isCash");
            IsSynchronous = (bool)jsonData.SafeGetBoolValue("isSynchronous");

            object players = jsonData.SafeGetValue("players");

            Players = new List <Player>();

            List <object> playerArray = (List <object>)players;

            foreach (object player in playerArray)
            {
                Players.Add(new Player((Dictionary <string, object>)player));
            }

            var connectionInfoJson = jsonData.SafeGetValue("connectionInfo") as JSONDict;

            CustomServerConnectionInfo = connectionInfoJson != null
                ? new CustomServerConnectionInfo(connectionInfoJson)
                : null;

            if (Application.isEditor)
            {
                GameParams = LoadSimulatedMatchParameters();
            }

#if UNITY_IOS
            GameParams = new Dictionary <string, string>();
            object parameters = jsonData.SafeGetValue("gameParameters");
            if (parameters != null && parameters.GetType() == typeof(JSONDict))
            {
                foreach (KeyValuePair <string, object> kvp in (JSONDict)parameters)
                {
                    if (kvp.Value == null)
                    {
                        continue;
                    }

                    string val = kvp.Value.ToString();
                    if (kvp.Key == "skillz_difficulty")
                    {
                        SkillzDifficulty = Helpers.SafeUintParse(val);
                    }
                    else
                    {
                        GameParams.Add(kvp.Key, val);
                    }
                }
            }
#elif UNITY_ANDROID
            GameParams       = HashtableToDictionary(SkillzCrossPlatform.GetMatchRules());
            SkillzDifficulty = jsonData.SafeGetUintValue("skillzDifficulty");
#endif
        }
 public void Abort()
 {
     SkillzCrossPlatform.AbortMatch();
 }
 public void PlusOne()
 {
     score += 1;
     SkillzCrossPlatform.UpdatePlayersCurrentScore(score);
 }
Beispiel #15
0
    private IEnumerator ReportFinalScore(int finalScore)
    {
        yield return(new WaitForSeconds(3));

        SkillzCrossPlatform.ReportFinalScore(finalScore);
    }
 // Start is called before the first frame update
 void Start()
 {
     SkillzCrossPlatform.LaunchSkillz(new GameController());
 }
Beispiel #17
0
    public int UpdateScore()
    {
        int s1 = 0;
        int s2 = 0;

        for (int i = 0; i < tiles.Length; i++)
        {
            if (localPlayerGrid[i] != "")
            {
                s1 += tiles[i].scoreMult * scoreMultiplier;
            }

            if (enemyPlayerGrid[i] != "")
            {
                s2 += tiles[i].scoreMult * scoreMultiplier;
            }
        }

        int scoreDelta = s1 - oldScore;

        scoreLogic.AddScore(scoreDelta, true, scoreText, s1);

        if (scoreDelta > bestWordScore)
        {
            bestWordScore = scoreDelta;
        }

        if (scoreDelta > 0)
        {
            numClues++;
            gameAudio.PlayOneShot(gameAudio.solvedClueAudio, 1.0f);
        }

        scoreDelta = s2 - oldEnemyScore;
        scoreLogic.AddScore(scoreDelta, false, enemyScoreText, s2);

        if (scoreDelta > bestWordScoreEnemy)
        {
            bestWordScoreEnemy = scoreDelta;
        }

        if (scoreDelta > 0)
        {
            numCluesEnemy++;
            gameAudio.PlayOneShot(gameAudio.enemySolvedClueAudio, 1.0f);
        }

        //scoreText.text = "ME: " + s1;
        //enemyScoreText.text = "YOU: " + s2;
        oldScore      = s1;
        oldEnemyScore = s2;


        if (HomeLogic.isUsingSkillz)
        {
            if (SkillzCrossPlatform.IsMatchInProgress())
            {
                SkillzCrossPlatform.UpdatePlayersCurrentScore(s1);
            }
        }

        return(s1);
    }
Beispiel #18
0
 public void Launch()
 {
     SkillzCrossPlatform.LaunchSkillz(this);
 }
Beispiel #19
0
 public void LaunchSkillz()
 {
     SkillzCrossPlatform.LaunchSkillz(new GameController());
 }