当前位置: 首页>>代码示例>>Java>>正文


Java OfferType类代码示例

本文整理汇总了Java中com.badlogic.gdx.pay.OfferType的典型用法代码示例。如果您正苦于以下问题:Java OfferType类的具体用法?Java OfferType怎么用?Java OfferType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OfferType类属于com.badlogic.gdx.pay包,在下文中一共展示了OfferType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: purchaseRestore

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
@Override
public void purchaseRestore() {

    try {
        List<Transaction> transactions = googleInAppBillingService.getPurchases();
        Array<Transaction> entitlements = new Array<>(Transaction.class);
        for (int i = 0; i < transactions.size(); i++) {
            Transaction transaction = transactions.get(i);
            if (OfferType.CONSUMABLE == getOfferType(transaction.getIdentifier())) {
                googleInAppBillingService.consumePurchase(transaction, observer);
            } else {
                entitlements.add(transaction);
            }
        }


        if (observer != null) {
            observer.handleRestore(entitlements.toArray());
        }
    } catch (GdxPayException e) {
        if (observer != null) {
            observer.handleRestoreError(e);
        }
    }
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:26,代码来源:AndroidGooglePlayPurchaseManager.java

示例2: getPurchaseManagerConfig

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
@Override
protected PurchaseManagerConfig getPurchaseManagerConfig()
{
    PurchaseManagerConfig purchaseManagerConfig = new PurchaseManagerConfig();

    for (LevelPack levelPack : LevelManager.getLevelPacks())
    {
        if (!levelPack.isFree())
        {
            Offer offer = new Offer();
            offer
                .setType(OfferType.ENTITLEMENT)
                .setIdentifier(levelPack.getGoogleSku());
            offer.putIdentifierForStore(
                PurchaseManagerConfig.STORE_NAME_ANDROID_GOOGLE,
                levelPack.getGoogleSku());
            purchaseManagerConfig.addOffer(offer);
        }
    }

    String key = PhysicsComponent.s(com.draga.shape.Circle.s(
        GraphicComponent.s(Circle.s)
            + MenuScreen.s(IngameMenuScreen.s, -3)
            + GraphicComponent.s(HudScreen.s)
            + MenuScreen.s(DeadZoneInputModifier.s, 4)
            + GraphicComponent.s(Joystick.s)));
    purchaseManagerConfig.addStoreParam(
        PurchaseManagerConfig.STORE_NAME_ANDROID_GOOGLE,
        key);

    return purchaseManagerConfig;
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:33,代码来源:AndroidServices.java

示例3: getPurchaseIdsByType

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
private void getPurchaseIdsByType(List<String> inAppPurchasesIds, List<String> subsPurchasesIds) {
    for (int i = 0; i < purchaseManagerConfig.getOfferCount(); i++) {
        Offer offer = purchaseManagerConfig.getOffer(i);
        if (offer.getType().equals(OfferType.SUBSCRIPTION))
            subsPurchasesIds.add(offer.getIdentifier());
        else
            inAppPurchasesIds.add(offer.getIdentifier());
    }
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:10,代码来源:AndroidGooglePlayPurchaseManager.java

示例4: getOfferType

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
private OfferType getOfferType(String identifier) {
    Offer offer = purchaseManagerConfig.getOffer(identifier);
    if (offer == null || offer.getType() == null) {
        throw new IllegalStateException("No offer or offerType configured for identifier: " + identifier + ", offer: " + offer);
    }

    return offer.getType();
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:9,代码来源:AndroidGooglePlayPurchaseManager.java

示例5: getIdsForEntitlementsAndConsumables

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
private List<String> getIdsForEntitlementsAndConsumables() {
	final List<String> result = new ArrayList<String>();
	final int offerCount = config.getOfferCount();
	for (int i = 0; i < offerCount; i++) {
		Offer offer = config.getOffer(i);
		if (offer.getType() == OfferType.ENTITLEMENT || offer.getType() == OfferType.CONSUMABLE) {
			result.add(offer.getIdentifier());
		}
	}
	return result;
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:12,代码来源:PurchaseManagerAndroidOpenIAB.java

示例6: getIdsForSubscriptions

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
private List<String> getIdsForSubscriptions() {
	final List<String> result = new ArrayList<String>();
	final int offerCount = config.getOfferCount();
	for (int i = 0; i < offerCount; i++) {
		Offer offer = config.getOffer(i);
		if (offer.getType() == OfferType.SUBSCRIPTION) {
			result.add(offer.getIdentifier());
		}
	}
	return result;
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:12,代码来源:PurchaseManagerAndroidOpenIAB.java

示例7: purchase

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
@Override
public void purchase(final String identifier) {
    assertInstalled();
    final OfferType offerType = getOfferType(identifier);

    googleInAppBillingService.startPurchaseRequest(identifier, OfferToInAppPurchaseConverter.convertOfferType(offerType), new PurchaseRequestCallback() {
        @Override
        public void purchaseSuccess(Transaction transaction) {
            if (observer != null) {
                switch (offerType) {
                    case CONSUMABLE:
                        // Warning: observer.handlePurchase is called in googleInAppBillingService.consumePurchase.
                        // That is not clean, I would prefer to keep it on one place.
                        // Should be refactored later.
                        googleInAppBillingService.consumePurchase(transaction, observer);
                        break;
                    case ENTITLEMENT:
                    case SUBSCRIPTION:
                        observer.handlePurchase(transaction);
                        break;
                    default:
                        String error = "Unsupported OfferType=" + getOfferType(identifier)
                                + " for identifier=" + identifier;
                        throw new GdxPayException(error);
                }
            }
        }

        @Override
        public void purchaseError(GdxPayException exception) {
            if (observer != null) {
                observer.handlePurchaseError(exception);
            }

        }

        @Override
        public void purchaseCanceled() {
            if (observer != null) {
                observer.handlePurchaseCanceled();
            }
        }
    });
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:45,代码来源:AndroidGooglePlayPurchaseManager.java

示例8: convertOfferType

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
static public  String convertOfferType(OfferType offerType ) {
    if (offerType.equals(OfferType.SUBSCRIPTION))
        return PURCHASE_TYPE_SUBSCRIPTION;

    return PURCHASE_TYPE_IN_APP;
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:7,代码来源:OfferToInAppPurchaseConverter.java

示例9: offerFullEditionEntitlement

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
public static Offer offerFullEditionEntitlement() {
    Offer offer = new Offer();
    offer.setIdentifier(PRODUCT_IDENTIFIER_FULL_EDITION);
    offer.setType(OfferType.ENTITLEMENT);
    return offer;
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:7,代码来源:OfferObjectMother.java

示例10: offerSubscription

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
public static Offer offerSubscription() {
    Offer offer = new Offer();
    offer.setIdentifier("com.appname.subscription");
    offer.setType(OfferType.SUBSCRIPTION);
    return offer;
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:7,代码来源:OfferObjectMother.java

示例11: offerConsumable

import com.badlogic.gdx.pay.OfferType; //导入依赖的package包/类
public static Offer offerConsumable() {
    Offer offer = new Offer();
    offer.setIdentifier("com.appname.consumable.100.coins");
    offer.setType(OfferType.CONSUMABLE);
    return offer;
}
 
开发者ID:libgdx,项目名称:gdx-pay,代码行数:7,代码来源:OfferObjectMother.java


注:本文中的com.badlogic.gdx.pay.OfferType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。