コード例 #1
0
 private void Start()
 {
     membershipController = GetComponentInParent <MembershipController>();
     LegalPriceText.text  = membershipController.GetLegalText();
     membershipController.OnProductsReady += updateLegalText;
     membershipController.GetProduct(hasTrialAvailable: true);
 }
コード例 #2
0
    public void updateLegalText(Product product, List <Product> productsToOffer)
    {
        membershipController.OnProductsReady -= updateLegalText;
        string token            = "Membership.MembershipTerms.TermsTitle." + product.sku_duration;
        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation(token);

        LegalPriceText.text = membershipController.GetLegalText(product.price, tokenTranslation);
    }
コード例 #3
0
    private void showProduct(Product productToShow)
    {
        product = productToShow;
        membershipController.CurrentProduct = productToShow;
        string text        = "";
        string text2       = "";
        string text3       = "";
        string text4       = "";
        bool   flag        = true;
        string formatToken = "Membership.MembershipTerms.LegalText";
        string text5       = "Membership.MembershipTerms.TermsTitle." + product.sku_duration;

        text3 = Service.Get <Localizer>().GetTokenTranslation(text5);
        if (product.IsTrial())
        {
            text  = Service.Get <Localizer>().GetTokenTranslationFormatted(formatToken, text5, product.price, "Membership.MembershipTerms.ConfirmButtonFreeTrial");
            text2 = Service.Get <Localizer>().GetTokenTranslation("Membership.MembershipTerms.ConfirmButtonFreeTrial");
            text4 = Service.Get <Localizer>().GetTokenTranslation("Membership.MembershipTerms.TrialText");
            flag  = true;
        }
        else
        {
            text  = Service.Get <Localizer>().GetTokenTranslationFormatted(formatToken, text5, product.price, "Membership.MembershipTerms.ConfirmButtonFreeTrial");
            text2 = Service.Get <Localizer>().GetTokenTranslation("Membership.MembershipTerms.ConfirmButtonRegular");
            text4 = "";
            flag  = false;
        }
        Terms.text             = text;
        ConfirmButtonText.text = text2;
        CurrencyCode.text      = product.currencyCode;
        LegalText.gameObject.SetActive(flag);
        LegalText.text = membershipController.GetLegalText(product.price, text3);
        CarrierBillingPanel.SetActive(showCarrierBilling);
        CostTitleText.text = text3;
        CostTrialText.text = text4;
        CostText.text      = product.price;
        DurationText.text  = "/" + text3;
    }