コード例 #1
0
 public void ShowAnimalInfo(bool instant = false, TileElement.ElementType type = TileElement.ElementType.None)
 {
     animalType = type;
     RefreshView(type, GameController.I.SoftCurrency);
     mainCanvasGroup.interactable = mainCanvasGroup.blocksRaycasts = true;
     if (instant)
     {
         mainCanvasGroup.alpha = 1f;
         return;
     }
     Go.to(mainCanvasGroup, fadeDuration, new GoTweenConfig().floatProp("alpha", 1f));
 }
コード例 #2
0
    public static void TrackAnimalUpgrade(TileElement.ElementType elementType, int level)
    {
        var request = new WriteClientPlayerEventRequest
        {
            EventName = AnimalUpgradeKey,
            Body      = new Dictionary <string, object>
            {
                { AnimalUpgradeTypeKey, elementType.ToString() },
                { AnimalUpgradeLevelKey, level.ToString() },
            }
        };

        PlayFabClientAPI.WritePlayerEvent(request, null, null);
    }
コード例 #3
0
    private IEnumerator DoSwapSpriteAnimation(Image elementImage, TileElement.ElementType newElement)
    {
        Go.to(elementImage.rectTransform, swapAnimationTime / 2f,
              new GoTweenConfig().vector3Prop("localScale", Vector3.zero).setEaseType(swapEaseType)
              );

        yield return(new WaitForSecondsRealtime(swapAnimationTime / 2f));

        elementImage.sprite = GameSettings.I.GetSpriteForElement(newElement);

        Go.to(elementImage.rectTransform, swapAnimationTime / 2f,
              new GoTweenConfig().vector3Prop("localScale", Vector3.one).setEaseType(swapEaseType)
              );
    }
コード例 #4
0
    private void RefreshView(TileElement.ElementType type, int softCurrency)
    {
        if (type == TileElement.ElementType.None)
        {
            return;
        }

        animalImage.sprite  = GameSettings.I.GetSpriteForElement(type);
        animalNameText.text = type.ToString().ToUpper();

        var currLevel = AnimalData.AnimalLevel(type);

        currentLevelText.text = "Lvl " + (currLevel + 1);

        var nextLevel = currLevel + 1;

        nextLevelText.text = "Lvl " + (nextLevel + 1);

        var currLevelBasePoints = GameSettings.I.GetBasePointsForElementOfLevel(currLevel);
        var nextLevelBasePoints = GameSettings.I.GetBasePointsForElementOfLevel(nextLevel);

        for (int i = 0; i < currentLevelPointTexts.Count; i++)
        {
            var currLevelPoints = (4 + i) * currLevelBasePoints * (i + 1);
            var nextLevelPoints = (4 + i) * nextLevelBasePoints * (i + 1);
            currentLevelPointTexts[i].text = (4 + i) + " line: " + currLevelPoints + "pts";
            nextLevelPointTexts[i].text    = "+ " + (nextLevelPoints - currLevelPoints);
        }

        var cost = GameSettings.I.GetSoftCurrencyForUpgrade(currLevel);

        levelUpCostText.text = softCurrency + "/" + cost;
        var canLevelUp = softCurrency >= cost;

        levelUpCostText.color      = canLevelUp ? canLevelUpColor : missingSoftCurrencyColor;
        levelUpButton.interactable = canLevelUp;
        levelUpButtonText.color    = levelUpButtonText.color.GetWithAlpha(canLevelUp ? 1f : 0.3f);
    }
コード例 #5
0
    public static void IncreaseAnimalLevel(TileElement.ElementType type)
    {
        var level = AnimalLevel(type);
        var key   = AnimalLevelData + type;

        PlayerPrefs.SetInt(key, level + 1);

        var request = new UpdateUserDataRequest()
        {
            Data = new Dictionary <string, string>
            {
                { key, (level + 1).ToString() }
            }
        };

        PlayFabClientAPI.UpdateUserData(request, null, error =>
        {
            Debug.LogWarning("Something went wrong with IncreaseAnimalLevel :(");
            Debug.LogError(error.GenerateErrorReport());
        });

        AnalyticsData.TrackAnimalUpgrade(type, level);
    }
コード例 #6
0
 public static int AnimalLevel(TileElement.ElementType type)
 {
     return(PlayerPrefs.GetInt(AnimalLevelData + type, 0));
 }
コード例 #7
0
 public Sprite GetSpriteForElement(TileElement.ElementType type)
 {
     return(elementSprites[(int)type - 1]);
 }
コード例 #8
0
 public void Refresh(TileElement.ElementType type)
 {
     animalType = type;
     RefreshState(GameController.I.SoftCurrency);
 }