Exemple #1
0
 public void OnSubscriptionStoreItemClicked(int subscriptionIndex)
 {
     _subscriptionToSubscribe = SubscriptionList.GetSubscriptionByIndex(subscriptionIndex);
     confirmPanel.SetActive(true);
     confirmText.text = "Would you like to subscribe to " + _subscriptionToSubscribe.Name + " with " +
                        _subscriptionToSubscribe.Price + "/month ?";
 }
Exemple #2
0
    private static void SetSubscribeButton(SubscriptionList.Subscription targetSubscription, string targetButtonText,
                                           bool isButtonInteractive)
    {
        // Do nothing if the player has not subscribed to any plan.
        if (targetSubscription.Type == SubscriptionType.NoSubscription)
        {
            return;
        }

        var targetButton = targetSubscription.SubscribeButtonGameObj;

        targetButton.transform.Find("Text").gameObject.GetComponent <Text>().text = targetButtonText;
        targetButton.GetComponent <Button>().interactable = isButtonInteractive;
    }
Exemple #3
0
    // Update current subscription to target subscription.
    public void UpdateSubscription(SubscriptionList.Subscription targetSubscription)
    {
        subscriptionType = targetSubscription.Type;
        if (subscriptionType == SubscriptionType.NoSubscription)
        {
            backgroundNameToOwnership[(int)BackgroundName.Mushroom] = Ownership.NotOwned;
            UpdateBackgroundInUse(BackgroundList.BlueGrassBackground);
        }
        else
        {
            backgroundNameToOwnership[(int)BackgroundName.Mushroom] = Ownership.Owned;
            UpdateBackgroundInUse(BackgroundList.MushroomBackground);
        }

        Object.FindObjectOfType <SubscriptionStorePageController>()?.RefreshPage();
    }
Exemple #4
0
 public static void PurchaseASubscription(SubscriptionList.Subscription oldSubscription,
                                          SubscriptionList.Subscription newSubscription)
 {
     // If the player is subscribe to a new subscription from no subscription,
     // go through the purchase IAP follow.
     if (oldSubscription.Type == SubscriptionType.NoSubscription)
     {
         BuyProductId(newSubscription.ProductId);
     }
     // If the player wants to update or downgrade the subscription,
     // use the upgrade and downgrade flow.
     else
     {
         var oldProduct = m_StoreController.products.WithID(oldSubscription.ProductId);
         var newProduct = m_StoreController.products.WithID(newSubscription.ProductId);
         _playStoreExtensions.UpdateSubscription(oldProduct, newProduct);
     }
 }