private void ShowOnlyIntro()
 {
     LoadingScreenManager.ShowIntro();
     LoadingScreenManager.HideLoading();
     PauseMenuManager.Disable();
     PauseMenuManager.Close();
     GameOverManager.Close();
 }
Exemple #2
0
    private void GenerateLevelHolder(LevelData levelData)
    {
        GameObject item = Instantiate(listItems, listHolder);

        item.GetComponent <LoadOnlineLevel>().SetLevelData(levelData);
        _loadingScreenManager.HideLoading();
    }
    public void RateLevel()
    {
        LevelData thisLevelData = CurrentLevelData.instance.thisLevelData;

        string ownerId           = thisLevelData.OwnerPlayFabId;
        string levelRateKey      = thisLevelData.levelRateKey;
        string levelRateCountKey = thisLevelData.RatingCountKey;

        Debug.Log("thisLevelData.RateCount: " + thisLevelData.RateCount
                  + " | thisLevelData.Rating): " + thisLevelData.Rating);

        int.TryParse(thisLevelData.RateCount, out int levelRatingAmount);
        int.TryParse(thisLevelData.Rating, out int levelRatingValue);
        int.TryParse(m_inputField.text, out int newRate);

        // calculate average of rating
        int finalLevelRate = ((levelRatingValue * levelRatingAmount) + newRate) / (levelRatingAmount + 1);

        _loadingScreenManager.ShowLoading();
        // send the rating and rate count for the level to the server
        PlayFabController.instance.UpdateUserReadOnlyData(ownerId, levelRateKey, finalLevelRate.ToString(), () =>
        {
            PlayFabController.instance.UpdateUserReadOnlyData(ownerId, levelRateCountKey, (levelRatingAmount + 1).ToString(),
                                                              () =>
            {
                // clear scene
                CurrentLevelData.instance.ChangeRateButtonVisibility(false);
                _deleteLevel.DeleteTheLevel();
                _loadingScreenManager.HideLoading();
            });
        });
    }
Exemple #4
0
    private void OnShare()
    {
        if (sharedLevelsAmount == -1)
        {
            return;
        }

        m_loadingManager.ShowLoading();

        string newLevelKey   = "sharedLevelNo" + (sharedLevelsAmount + 1);
        string newLevelValue = SaveLevel.instance.GetCurrentLevelCode();

        // Set the key for the new shared level and its code as value
        PlayFabController.instance.UpdateUserReadOnlyData(PlayFabController.instance.currentPlayerPlayfabID, newLevelKey, newLevelValue);

        // Increment the SharedLevelAmountKey value by one in players data and in statistics
        PlayFabController.instance.UpdateUserReadOnlyData(PlayFabController.instance.currentPlayerPlayfabID, SharedLevelAmountKey, (sharedLevelsAmount + 1).ToString());
        PlayFabController.instance.StartCloudUpdateSharedLevelsAmount(sharedLevelsAmount + 1);

        // Save another key/value for the rating of the level with the initial value of zero
        string newLevelRatingKey = "sharedLevelNo" + (sharedLevelsAmount + 1) + "Rating";

        PlayFabController.instance.UpdateUserReadOnlyData(PlayFabController.instance.currentPlayerPlayfabID, newLevelRatingKey, "0",
                                                          () =>
        {
            string newLevelRatingCountKey = "sharedLevelNo" + (sharedLevelsAmount + 1) + "RatingCountKey";
            PlayFabController.instance.UpdateUserReadOnlyData(PlayFabController.instance.currentPlayerPlayfabID, newLevelRatingCountKey, "0",
                                                              () =>
            {
                m_setlogText.ShowMessage("Shared Level");
                m_loadingManager.HideLoading();
            });
        });
    }