-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate the Google Play Billing Library into engine #17918
Conversation
2. Adjust the file name
2. add vendor module 3. Fix some problems of google play.
✅ Package size is not changedInterface Check Report! WARNING this pull request has changed these public interfaces:
@@ -35339,9 +35339,11 @@
* @see https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga1055f6c8d5910a1904162bea75807314
*/
export const adpf: {
/**
- * @en Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling. The value range is a non-negative float, where 0.0 represents a fixed distance from overheating, 1.0 indicates the device will be severely throttled, and values greater than 1.0 may imply even heavier throttling.
+ * @en Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling.
+ * The value range is a non-negative float, where 0.0 represents a fixed distance from overheating, 1.0 indicates
+ * the device will be severely throttled, and values greater than 1.0 may imply even heavier throttling.
* @zh 提供设备在达到严重节流之前当前有多少热余量的估计值。值的范围是非负浮点数,其中0.0表示距离过热的固定距离,1.0表示设备将被严重限制,而大于1.0的值可能表示更重的限制。
* @see https://developer.android.com/ndk/reference/group/thermal#group___thermal_1ga1055f6c8d5910a1904162bea75807314
*/
readonly thermalHeadroom: number;
@@ -58460,8 +58462,503 @@
*/
export class UIReorderComponent {
constructor();
}
+ export namespace google {
+ /**
+ * @en Google Play Billing event type
+ * @zh Google Play Billing事件类型
+ */
+ export enum BillingEventType {
+ /**
+ * @en
+ * Called to notify that setup is complete.
+ *
+ * @zh
+ * 当安装已经完成时触发。
+ */
+ BILLING_SETUP_FINISHED = "billing_setup_finished",
+ /**
+ * @en
+ * Called to notify that the connection to the billing service was lost.
+ *
+ * @zh
+ * 当Billing服务连接断开时触发。
+ */
+ BILLING_SERVICE_DISCONNECTED = "billing_service_disconnected",
+ /**
+ * @en
+ * Listen to this event to get notifications of purchase updates.
+ *
+ * @zh
+ * 监听这个事件可以获取购买更新。
+ */
+ PURCHASES_UPDATED = "purchases_updated",
+ /**
+ * @en
+ * Called to notify that query product details operation has finished.
+ *
+ * @zh
+ * 查询产品详细信息操作完成时触发。
+ */
+ PRODUCT_DETAILS_RESPONSE = "product_details_response",
+ /**
+ * @en
+ * Called to notify that the query purchases operation has finished.
+ *
+ * @zh
+ * 查询购买操作完成时触发。
+ */
+ QUERY_PURCHASES_RESPONSE = "query_purchases_response",
+ /**
+ * @en
+ * Called to notify that a consume operation has finished.
+ *
+ * @zh
+ * 消费操作完成时触发。
+ */
+ CONSUME_RESPONSE = "consume_response",
+ /**
+ * @en
+ * Called to notify that an acknowledge purchase operation has finished.
+ *
+ * @zh
+ * 确认购买操作完成时触发。
+ */
+ ACKNOWLEDGE_PURCHASES_RESPONSE = "acknowledge_purchases_response",
+ /**
+ * @en
+ * Called to notify when the get billing config flow has finished.
+ *
+ * @zh
+ * 获取Billing配置流程完成时触发。
+ */
+ BILLING_CONFIG_RESPONSE = "billing_config_response",
+ /**
+ * @en
+ * Called to receive the results from createAlternativeBillingOnlyReportingDetailsAsync when it is finished.
+ *
+ * @zh
+ * 当调用createAlternativeBillingOnlyReportingDetailsAsync接口完成时触发,可以接收调用结果。
+ */
+ ALTERNATIVE_BILLING_ONLY_TOKEN_RESPONSE = "alternative_billing_only_token_response",
+ /**
+ * @en
+ * Called to receive the results from createExternalOfferReportingDetailsAsync when it is finished.
+ *
+ * @zh
+ * 当调用createExternalOfferReportingDetailsAsync接口完成时触发,可以接收调用结果。
+ */
+ EXTERNAL_OFFER_REPORTING_DETAILS_RESPONSE = "external_offer_reporting_details_response",
+ /**
+ * @en
+ * Called to receive the results from BillingClient#isAlternativeBillingOnlyAvailableAsync when it is finished.
+ *
+ * @zh
+ * 当调用BillingClient#isAlternativeBillingOnlyAvailableAsync接口完成时触发,可以接收调用结果。
+ */
+ ALTERNATIVE_BILLING_ONLY_AVAILABILITY_RESPONSE = "alternative_billing_only_availability_response",
+ /**
+ * @en
+ * Called to receive the results from BillingClient#isExternalOfferAvailableAsync when it is finished.
+ *
+ * @zh
+ * 当调用BillingClient#isExternalOfferAvailableAsync接口完成时触发,可以接收调用结果。
+ */
+ EXTERNAL_OFFER_AVAILABILITY_RESPONSE = "external_offer_availability_response",
+ /**
+ * @en
+ * Called to notify that the alternative billing only dialog flow is finished.
+ *
+ * @zh
+ * 当仅替代Billing对话流程已完成时触发。
+ */
+ ALTERNATIVE_BILLING_ONLY_INFORMATION_DIALOG_RESPONSE = "alternative_billing_only_information_dialog_response",
+ /**
+ * @en
+ * Called to notify that the external offer information dialog flow is finished.
+ *
+ * @zh
+ * 当外部报价信息对话流程已完成时触发。
+ */
+ EXTERNAL_OFFER_INFORMATION_DIALOG_RESPONSE = "external_offer_information_dialog_response",
+ /**
+ * @en
+ * Called to notify when the in-app messaging flow has finished.
+ *
+ * @zh
+ * 当应用内消息流程完成时触发。
+ */
+ IN_APP_MESSAGE_RESPONSE = "in_app_message_response"
+ }
+ /**
+ * @en
+ * Supported Product types.
+ *
+ * @zh
+ * 支持的产品类型。
+ */
+ export enum ProductType {
+ /**
+ * @en
+ * A Product type for Android apps in-app products.
+ *
+ * @zh
+ * Android 应用内产品的产品类型。
+ */
+ INAPP = "inapp",
+ /**
+ * @en
+ * A Product type for Android apps subscriptions.
+ *
+ * @zh
+ * Android 应用程序订阅的产品类型。
+ */
+ SUBS = "subs"
+ }
+ /**
+ * @en
+ * Possible response codes.
+ *
+ * @zh
+ * 可能的响应代码。
+ */
+ export enum BillingResponseCode {
+ /**
+ * @en
+ * This field is deprecated.
+ * See SERVICE_UNAVAILABLE which will be used instead of this code.
+ *
+ * @zh
+ * 这个字段已经废弃。
+ * 看看SERVICE_UNAVAILABLE将使用哪一个来代替此代码。
+ */
+ SERVICE_TIMEOUT = "Bad expression <-3>",
+ /**
+ * @en
+ * The requested feature is not supported by the Play Store on the current device.
+ *
+ * @zh
+ * 当前设备上的 Play Store 不支持所请求的功能。
+ */
+ FEATURE_NOT_SUPPORTED = "Bad expression <-2>",
+ /**
+ * @en
+ * The app is not connected to the Play Store service via the Google Play Billing Library.
+ *
+ * @zh
+ * 该应用未通过 Google Play Billing库连接到 Play Store 服务。
+ */
+ SERVICE_DISCONNECTED = "Bad expression <-1>",
+ /**
+ * @en
+ * Success.
+ *
+ * @zh
+ * 成功。
+ */
+ OK = 0,
+ /**
+ * @en
+ * Transaction was canceled by the user.
+ *
+ * @zh
+ * 交易已被用户取消。
+ */
+ USER_CANCELED = 1,
+ /**
+ * @en
+ * The service is currently unavailable.
+ *
+ * @zh
+ * 当前设备上的 Play Store 不支持所请求的功能。
+ */
+ SERVICE_UNAVAILABLE = 2,
+ /**
+ * @en
+ * A user billing error occurred during processing.
+ *
+ * @zh
+ * 处理过程中出现用户billing错误。
+ */
+ BILLING_UNAVAILABLE = 3,
+ /**
+ * @en
+ * The requested product is not available for purchase.
+ *
+ * @zh
+ * 所请求的产品无法购买。
+ */
+ ITEM_UNAVAILABLE = 4,
+ /**
+ * @en
+ * Error resulting from incorrect usage of the API.
+ *
+ * @zh
+ * 由于错误使用 API 而导致的错误。
+ */
+ DEVELOPER_ERROR = 5,
+ /**
+ * @en
+ * Fatal error during the API action.
+ *
+ * @zh
+ * API 操作期间发生致命错误。
+ */
+ ERROR = 6,
+ /**
+ * @en
+ * The purchase failed because the item is already owned.
+ *
+ * @zh
+ * 购买失败,因为该物品已被拥有。
+ */
+ ITEM_ALREADY_OWNED = 7,
+ /**
+ * @en
+ * Requested action on the item failed since it is not owned by the user.
+ *
+ * @zh
+ * 由于该项目不属于用户,因此对该项目请求的操作失败。
+ */
+ ITEM_NOT_OWNED = 8,
+ /**
+ * @en
+ * A network error occurred during the operation.
+ *
+ * @zh
+ * 操作期间发生网络错误。
+ */
+ NETWORK_ERROR = 12
+ }
+ /**
+ * @en
+ * Recurrence mode of the pricing phase.
+ *
+ * @zh
+ * 定价阶段的复现模式。
+ */
+ export enum RecurrenceMode {
+ /**
+ * @en
+ * The billing plan payment recurs for infinite billing periods unless cancelled.
+ *
+ * @zh
+ * 除非取消,否则billing计划付款将无限期地重复。
+ */
+ INFINITE_RECURRING = 1,
+ /**
+ * @en
+ * The billing plan payment recurs for a fixed number of billing period set in billingCycleCount.
+ *
+ * @zh
+ * Billing计划付款将在 billingCycleCount 中设置的固定计费周期内重复发生。
+ */
+ FINITE_RECURRING = 2,
+ /**
+ * @en
+ * The billing plan payment is a one time charge that does not repeat.
+ *
+ * @zh
+ * Billing计划付款是一次性费用,不会重复。
+ */
+ NON_RECURRING = 3
+ }
+ /**
+ * @en
+ * Connection state of billing client.
+ *
+ * @zh
+ * Billing client的连接状态
+ */
+ export enum ConnectionState {
+ /**
+ * @en
+ * This client was not yet connected to billing service or was already closed.
+ *
+ * @zh
+ * 此客户端尚未连接到Billing服务或已关闭。
+ */
+ DISCONNECTED = 0,
+ /**
+ * @en
+ * This client is currently in process of connecting to billing service.
+ *
+ * @zh
+ * 此客户端目前正在连接到Billing服务。
+ */
+ CONNECTING = 1,
+ /**
+ * @en
+ * This client is currently connected to billing service.
+ *
+ * @zh
+ * 此客户端当前已连接到Billing服务。
+ */
+ CONNECTED = 2,
+ /**
+ * @en
+ * This client was already closed and shouldn't be used again.
+ *
+ * @zh
+ * 该客户端已关闭,不应再次使用。
+ */
+ CLOSED = 3
+ }
+ /**
+ * @en
+ * Features/capabilities supported by isFeatureSupported.
+ *
+ * @zh
+ * 支持的特性/能力isFeatureSupported。
+ */
+ export enum FeatureType {
+ /**
+ * @en
+ * Alternative billing only.
+ *
+ * @zh
+ * 仅限替代Billing。
+ */
+ ALTERNATIVE_BILLING_ONLY = "jjj",
+ /**
+ * @en
+ * Get billing config.
+ *
+ * @zh
+ * 获取计费配置。
+ */
+ BILLING_CONFIG = "ggg",
+ /**
+ * @en
+ * Play billing library support for external offer.
+ *
+ * @zh
+ * Play billing库支持外部报价。
+ */
+ EXTERNAL_OFFER = "kkk",
+ /**
+ * @en
+ * Show in-app messages.
+ *
+ * @zh
+ * 显示应用内消息。
+ */
+ IN_APP_MESSAGING = "bbb",
+ /**
+ * @en
+ * Launch a price change confirmation flow.
+ *
+ * @zh
+ * 启动价格变动确认流程。
+ */
+ PRICE_CHANGE_CONFIRMATION = "priceChangeConfirmation",
+ /**
+ * @en
+ * Play billing library support for querying and purchasing.
+ *
+ * @zh
+ * Play Billing库支持查询、购买。
+ */
+ PRODUCT_DETAILS = "fff",
+ /**
+ * @en
+ * Purchase/query for subscriptions.
+ *
+ * @zh
+ * 购买/查询订阅。
+ */
+ SUBSCRIPTIONS = "subscriptions",
+ /**
+ * @en
+ * Subscriptions update/replace.
+ *
+ * @zh
+ * 订阅更新/替换。
+ */
+ UBSCRIPTIONS_UPDATE = "subscriptionsUpdate"
+ }
+ /**
+ * @en
+ * Possible purchase states.
+ *
+ * @zh
+ * 可能的购买状态。
+ */
+ export enum PurchaseState {
+ /**
+ * @en
+ * Purchase is pending and not yet completed to be processed by your app.
+ *
+ * @zh
+ * 购买处于待处理状态且尚未完成,无法由您的应用程序处理。
+ */
+ PENDING = 2,
+ /**
+ * @en
+ * Purchase is completed..
+ *
+ * @zh
+ * 购买完成。
+ */
+ PURCHASED = 1,
+ /**
+ * @en
+ * Purchase with unknown state.
+ *
+ * @zh
+ * 未知状态
+ */
+ UNSPECIFIED_STATE = 0
+ }
+ /**
+ * @en
+ * Possible response codes.
+ *
+ * @zh
+ * InAppMessage可能的影响代码。
+ */
+ export enum InAppMessageResponseCode {
+ /**
+ * @en
+ * The flow has finished and there is no action needed from developers.
+ *
+ * @zh
+ * 流程已完成,开发人员无需采取任何行动。
+ */
+ NO_ACTION_NEEDED = 0,
+ /**
+ * @en
+ * The subscription status changed.
+ *
+ * @zh
+ * 订阅状态已改变。
+ */
+ SUBSCRIPTION_STATUS_UPDATED = 1
+ }
+ export type BillingResult = __private.__types_jsb__jsb.BillingResult;
+ export type OneTimePurchaseOfferDetails = __private.__types_jsb__jsb.OneTimePurchaseOfferDetails;
+ export type InstallmentPlanDetails = __private.__types_jsb__jsb.InstallmentPlanDetails;
+ export type PricingPhase = __private.__types_jsb__jsb.PricingPhase;
+ export type SubscriptionOfferDetails = __private.__types_jsb__jsb.SubscriptionOfferDetails;
+ export type ProductDetails = __private.__types_jsb__jsb.ProductDetails;
+ export type AccountIdentifiers = __private.__types_jsb__jsb.AccountIdentifiers;
+ export type PendingPurchaseUpdate = __private.__types_jsb__jsb.PendingPurchaseUpdate;
+ export type Purchase = __private.__types_jsb__jsb.Purchase;
+ export type BillingConfig = __private.__types_jsb__jsb.BillingConfig;
+ export type AlternativeBillingOnlyReportingDetails = __private.__types_jsb__jsb.AlternativeBillingOnlyReportingDetails;
+ export type ExternalOfferReportingDetails = __private.__types_jsb__jsb.ExternalOfferReportingDetails;
+ export type InAppMessageResult = __private.__types_jsb__jsb.InAppMessageResult;
+ /**
+ * @en
+ * Interface for Google Play blling module.
+ *
+ * @zh
+ * Google Play blling模块的接口。
+ *
+ */
+ export const billing: __private._vendor_google_billing_billing__Billing;
+ }
/**
* @en
* The video clip asset.
* @zh
@@ -71757,8 +72254,1374 @@
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_buildResult(containerW: number, containerH: number, contentW: number, contentH: number, scaleX: number, scaleY: number): _cocos_ui_view__AdaptResult;
}
+ export type __types_jsb_jsb__AccelerationXYZ = number;
+ export type __types_jsb_jsb__AccelerationIncludingGravityXYZ = number;
+ export type __types_jsb_jsb__RotationRateAlpha = number;
+ export type __types_jsb_jsb__RotationRateBeta = number;
+ export type __types_jsb_jsb__RotationRateGamma = number;
+ export interface __types_jsb_jsb__MouseEvent {
+ x: number;
+ y: number;
+ xDelta: number | undefined;
+ yDelta: number | undefined;
+ button: number;
+ windowId: number;
+ }
+ export interface __types_jsb_jsb__MouseWheelEvent extends __types_jsb_jsb__MouseEvent {
+ wheelDeltaX: number;
+ wheelDeltaY: number;
+ }
+ export type __types_jsb_jsb__MouseEventCallback = (mouseEvent: __types_jsb_jsb__MouseEvent) => void;
+ export type __types_jsb_jsb__MouseWheelEventCallback = (mouseEvent: __types_jsb_jsb__MouseWheelEvent) => void;
+ export type __types_jsb_jsb__TouchEventCallback = (touchList: TouchList, windowId?: number) => void;
+ export interface __types_jsb_jsb__AxisInfo {
+ code: number;
+ value: number;
+ }
+ export interface __types_jsb_jsb__ButtonInfo {
+ code: number;
+ isPressed: boolean;
+ }
+ export interface __types_jsb_jsb__TouchInfo {
+ code: number;
+ value: number;
+ }
+ export interface __types_jsb_jsb__ControllerInfo {
+ id: number;
+ axisInfoList: __types_jsb_jsb__AxisInfo[];
+ buttonInfoList: __types_jsb_jsb__ButtonInfo[];
+ touchInfoList: __types_jsb_jsb__TouchInfo[];
+ }
+ export interface __types_jsb_jsb__PoseInfo {
+ code: number;
+ x: number;
+ y: number;
+ z: number;
+ quaternionX: number;
+ quaternionY: number;
+ quaternionZ: number;
+ quaternionW: number;
+ }
+ export interface __types_jsb_jsb__KeyboardEvent {
+ altKey: boolean;
+ ctrlKey: boolean;
+ metaKey: boolean;
+ shiftKey: boolean;
+ repeat: boolean;
+ keyCode: number;
+ windowId: number;
+ code: string;
+ }
+ export type __types_jsb_jsb__KeyboardEventCallback = (keyboardEvent: __types_jsb_jsb__KeyboardEvent) => void;
+ export interface __types_jsb_jsb__WindowEvent {
+ windowId: number;
+ width: number;
+ height: number;
+ }
+ export enum __types_jsb_jsb__AudioFormat {
+ UNKNOWN,
+ SIGNED_8,
+ UNSIGNED_8,
+ SIGNED_16,
+ UNSIGNED_16,
+ SIGNED_32,
+ UNSIGNED_32,
+ FLOAT_32,
+ FLOAT_64
+ }
+ export class __types_jsb_jsb__NativePOD {
+ underlyingData(): ArrayBuffer;
+ _data(): __types_globals__TypedArray;
+ __data: __types_globals__TypedArray;
+ }
+ export class __types_jsb_jsb__Manifest {
+ constructor(manifestUrl: string);
+ constructor(content: string, manifestRoot: string);
+ parseFile(manifestUrl: string): void;
+ parseJSONString(content: string, manifestRoot: string): void;
+ getManifestRoot(): string;
+ getManifestFileUrl(): string;
+ getVersionFileUrl(): string;
+ getSearchPaths(): [
+ string
+ ];
+ getVersion(): string;
+ getPackageUrl(): boolean;
+ setUpdating(isUpdating: boolean): void;
+ isUpdating(): boolean;
+ isVersionLoaded(): boolean;
+ isLoaded(): boolean;
+ }
+ export interface __types_jsb_jsb__ManifestAsset {
+ md5: string;
+ path: string;
+ compressed: boolean;
+ size: number;
+ downloadState: number;
+ }
+ export class __types_jsb_jsb__EventAssetsManager {
+ // EventCode
+ static ERROR_NO_LOCAL_MANIFEST: number;
+ static ERROR_DOWNLOAD_MANIFEST: number;
+ static ERROR_PARSE_MANIFEST: number;
+ static NEW_VERSION_FOUND: number;
+ static ALREADY_UP_TO_DATE: number;
+ static UPDATE_PROGRESSION: number;
+ static ASSET_UPDATED: number;
+ static ERROR_UPDATING: number;
+ static UPDATE_FINISHED: number;
+ static UPDATE_FAILED: number;
+ static ERROR_DECOMPRESS: number;
+ constructor(eventName: string, manager: __types_jsb_jsb__AssetsManager, eventCode: number, assetId?: string, message?: string, curleCode?: number, curlmCode?: number);
+ getAssetsManagerEx(): __types_jsb_jsb__AssetsManager;
+ isResuming(): boolean;
+ getDownloadedFiles(): number;
+ getDownloadedBytes(): number;
+ getTotalFiles(): number;
+ getTotalBytes(): number;
+ getPercent(): number;
+ getPercentByFile(): number;
+ getEventCode(): number;
+ getMessage(): string;
+ getAssetId(): string;
+ getCURLECode(): number;
+ getCURLMCode(): number;
+ }
+ export namespace __types_jsb_jsb__AssetsManager {
+ export enum State {
+ UNINITED,
+ UNCHECKED,
+ PREDOWNLOAD_VERSION,
+ DOWNLOADING_VERSION,
+ VERSION_LOADED,
+ PREDOWNLOAD_MANIFEST,
+ DOWNLOADING_MANIFEST,
+ MANIFEST_LOADED,
+ NEED_UPDATE,
+ READY_TO_UPDATE,
+ UPDATING,
+ UNZIPPING,
+ UP_TO_DATE,
+ FAIL_TO_UPDATE
+ }
+ }
+ export class __types_jsb_jsb__AssetsManager {
+ constructor(manifestUrl: string, storagePath: string, versionCompareHandle?: (versionA: string, versionB: string) => number);
+ static create(manifestUrl: string, storagePath: string): __types_jsb_jsb__AssetsManager;
+ getState(): __types_jsb_jsb__AssetsManager.State;
+ getStoragePath(): string;
+ getMaxConcurrentTask(): number;
+ // setMaxConcurrentTask (max: number): void; // actually not supported
+ checkUpdate(): void;
+ prepareUpdate(): void;
+ update(): void;
+ isResuming(): boolean;
+ getDownloadedFiles(): number;
+ getDownloadedBytes(): number;
+ getTotalFiles(): number;
+ getTotalBytes(): number;
+ downloadFailedAssets(): void;
+ getLocalManifest(): __types_jsb_jsb__Manifest;
+ loadLocalManifest(manifestUrl: string): boolean;
+ loadLocalManifest(localManifest: __types_jsb_jsb__Manifest, storagePath: string): boolean;
+ getRemoteManifest(): __types_jsb_jsb__Manifest;
+ loadRemoteManifest(remoteManifest: __types_jsb_jsb__Manifest): boolean;
+ /**
+ * Setup your own version compare handler, versionA and B is versions in string.
+ * if the return value greater than 0, versionA is greater than B,
+ * if the return value equals 0, versionA equals to B,
+ * if the return value smaller than 0, versionA is smaller than B.
+ */
+ setVersionCompareHandle(versionCompareHandle?: (versionA: string, versionB: string) => number): void;
+ /**
+ * Setup the verification callback, Return true if the verification passed, otherwise return false
+ */
+ setVerifyCallback(verifyCallback: (path: string, asset: __types_jsb_jsb__ManifestAsset) => boolean): void;
+ setEventCallback(eventCallback: (event: __types_jsb_jsb__EventAssetsManager) => void): void;
+ }
+ /**
+ * @en Represents a pricing phase, describing how a user pays at a point in time.
+ * @zh 表示定价阶段,描述用户在某个时间点如何付款。
+ */
+ export interface __types_jsb_jsb__PricingPhase {
+ /**
+ * @en Number of cycles for which the billing period is applied.
+ * @zh 计费周期适用的周期数。
+ */
+ readonly billingCycleCount: number;
+ /**
+ * @en The price for the payment cycle in micro-units, where 1,000,000 micro-units equal one unit of the currency.
+ * @zh 微单位付款周期的价格,其中 1,000,000 个微单位等于 1 个货币单位。
+ */
+ readonly priceAmountMicros: number;
+ /**
+ * @en RecurrenceMode for the pricing phase.
+ * @zh 定价阶段的RecurrenceMode。
+ */
+ readonly recurrenceMode: number;
+ /**
+ * @en Billing period for which the given price applies, specified in ISO 8601 format.
+ * @zh 给定价格适用的计费期,以 ISO 8601 格式指定。
+ */
+ readonly billingPeriod: string;
+ /**
+ * @en Formatted price for the payment cycle, including its currency sign.
+ * @zh 付款周期的格式化价格,包括其货币符号。
+ */
+ readonly formattedPrice: string;
+ /**
+ * @en Returns ISO 4217 currency code for price.
+ * @zh 返回价格的 ISO 4217 货币代码。
+ */
+ readonly priceCurrencyCode: string;
+ }
+ /**
+ * @en Represents additional details of an installment subscription plan.
+ * @zh 表示分期付款订阅计划的附加详细信息。
+ */
+ export interface __types_jsb_jsb__InstallmentPlanDetails {
+ /**
+ * @en Committed payments count after a user signs up for this subscription plan.
+ * @zh 用户注册此订阅计划后承诺的付款数量。
+ */
+ readonly installmentPlanCommitmentPaymentsCount: number;
+ /**
+ * @en Subsequent committed payments count after this subscription plan renews.
+ * @zh 此订阅计划续订后的后续承诺付款数量。
+ */
+ readonly subsequentInstallmentPlanCommitmentPaymentsCount: number;
+ }
+ /**
+ * @en Represents the offer details to buy an one-time purchase product.
+ * @zh 代表一次性购买产品的报价详情。
+ */
+ export interface __types_jsb_jsb__OneTimePurchaseOfferDetails {
+ /**
+ * @en The price for the payment in micro-units, where 1,000,000 micro-units equal one unit of the currency.
+ * @zh 以微单位返回支付价格,其中 1,000,000 个微单位等于 1 个货币单位。
+ */
+ readonly priceAmountMicros: number;
+ /**
+ * @en Formatted price for the payment, including its currency sign.
+ * @zh 支付的格式化价格,包括其货币单位。
+ */
+ readonly formattedPrice: string;
+ /**
+ * @en ISO 4217 currency code for price.
+ * @zh 价格的 ISO 4217 货币代码。
+ */
+ readonly priceCurrencyCode: string;
+ }
+ /**
+ * @en Represents the available purchase plans to buy a subscription product.
+ * @zh 代表一次性购买产品的报价详情。
+ */
+ export interface __types_jsb_jsb__SubscriptionOfferDetails {
+ /**
+ * @en The base plan id associated with the subscription product.
+ * @zh 与订阅产品相关的基本计划 ID。
+ */
+ readonly basePlanId: string;
+ /**
+ * @en The offer id associated with the subscription product.
+ * @zh 与订阅产品相关的优惠 ID。
+ */
+ readonly offerId: string;
+ /**
+ * @en The offer tags associated with this Subscription Offer.
+ * @zh 与此订阅优惠相关的优惠标签。
+ */
+ readonly offerTags: string[];
+ /**
+ * @en The offer token required to pass in launchBillingFlow to purchase the subscription product with these pricing phases.
+ * @zh 在 launchBillingFlow 中传递以使用这些定价阶段购买订阅产品所需的优惠令牌。
+ */
+ readonly offerToken: string;
+ /**
+ * @en The pricing phases for the subscription product.
+ * @zh 订阅产品的定价区间。
+ */
+ readonly pricingPhaseList: __types_jsb_jsb__PricingPhase[];
+ /**
+ * @en The additional details of an installment plan.
+ * @zh 分期付款计划的附加详细信息。
+ */
+ readonly installmentPlanDetails: __types_jsb_jsb__InstallmentPlanDetails;
+ }
+ /**
+ * @en Account identifiers that were specified when the purchase was made.
+ * @zh 购买时指定的帐户标识符。
+ */
+ export interface __types_jsb_jsb__AccountIdentifiers {
+ /**
+ * @en The obfuscated account id specified in setObfuscatedAccountId.
+ * @zh 在setObfuscatedAccountId中设置的混淆账户id
+ */
+ readonly obfuscatedAccountId: string;
+ /**
+ * @en The obfuscated profile id specified in setObfuscatedProfileId.
+ * @zh 在setObfuscatedProfileId中设置的混淆profile id
+ */
+ readonly obfuscatedProfileId: string;
+ }
+ /**
+ * @en Represents a pending change/update to the existing purchase.
+ * @zh 表示对现有购买的待定更改/更新。
+ */
+ export interface __types_jsb_jsb__PendingPurchaseUpdate {
+ /**
+ * @en A token that uniquely identifies this pending transaction.
+ * @zh 唯一标识此待处理交易的令牌。
+ */
+ readonly purchaseToken: string;
+ /**
+ * @en The product ids.
+ * @zh 产品 ID。
+ */
+ readonly products: string[];
+ }
+ /**
+ * @en Represents the details of a one time or subscription product.
+ * @zh 代表一次性或订阅产品的详细信息。
+ */
+ export interface __types_jsb_jsb__ProductDetails {
+ /**
+ * @en Hash code
+ * @zh hash值
+ */
+ readonly hashCode: number;
+ /**
+ * @en The description of the product.
+ * @zh 产品的描述。
+ */
+ readonly description: string;
+ /**
+ * @en The name of the product being sold.
+ * @zh 所售产品的名称。
+ */
+ readonly name: string;
+ /**
+ * @en The product's Id.
+ * @zh 产品的 ID。
+ */
+ readonly productId: string;
+ /**
+ * @en The ProductType of the product.
+ * @zh ProductType产品的。
+ */
+ readonly productType: string;
+ /**
+ * @en The title of the product being sold.
+ * @zh 所售产品的标题。
+ */
+ readonly title: string;
+ /**
+ * @en To string
+ * @zh 转换成字符串
+ */
+ readonly toStr: string;
+ /**
+ * @en The offer details of an one-time purchase product.
+ * @zh 代表一次性购买产品的报价详情。
+ */
+ readonly oneTimePurchaseOfferDetails: __types_jsb_jsb__OneTimePurchaseOfferDetails;
+ /**
+ * @en A list containing all available offers to purchase a subscription product.
+ * @zh 返回包含购买订阅产品的所有可用优惠的列表。
+ */
+ readonly subscriptionOfferDetails: __types_jsb_jsb__SubscriptionOfferDetails[];
+ }
+ /**
+ * @en Represents an in-app billing purchase.
+ * @zh 代表应用内billing购买。
+ */
+ export interface __types_jsb_jsb__Purchase {
+ /**
+ * @en One of PurchaseState indicating the state of the purchase.
+ * @zh PurchaseState表示购买状态的其中一个值。
+ */
+ readonly purchaseState: number;
+ /**
+ * @en The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
+ * @zh 产品购买的时间,以纪元(1970 年 1 月 1 日)以来的毫秒数表示。
+ */
+ readonly purchaseTime: number;
+ /**
+ * @en Indicates whether the purchase has been acknowledged.
+ * @zh 表示是否已确认购买。
+ */
+ readonly isAcknowledged: number;
+ /**
+ * @en Indicates whether the subscription renews automatically.
+ * @zh 指示订阅是否自动续订。
+ */
+ readonly isAutoRenewing: number;
+ /**
+ * @en Hash code
+ * @zh hash值
+ */
+ readonly hashCode: number;
+ /**
+ * @en The quantity of the purchased product.
+ * @zh 购买产品的数量。
+ */
+ readonly quantity: number;
+ /**
+ * @en The payload specified when the purchase was acknowledged or consumed.
+ * @zh 确认或消费购买时指定的有效负载。
+ */
+ readonly developerPayload: string;
+ /**
+ * @en Returns a unique order identifier for the transaction.
+ * @zh 交易的唯一订单标识符。
+ */
+ readonly orderId: string;
+ /**
+ * @en Returns a String in JSON format that contains details about the purchase order.
+ * @zh 包含有关采购订单详细信息的 JSON 格式的字符串。
+ */
+ readonly originalJson: string;
+ /**
+ * @en The application package from which the purchase originated.
+ * @zh 购买来源的应用程序包。
+ */
+ readonly packageName: string;
+ /**
+ * @en A token that uniquely identifies a purchase for a given item and user pair.
+ * @zh 唯一标识给定商品和用户对的购买的令牌。
+ */
+ readonly purchaseToken: string;
+ /**
+ * @en String containing the signature of the purchase data that was signed with the private key of the developer.
+ * @zh 包含使用开发者私钥签名的购买数据签名的字符串。
+ */
+ readonly signature: string;
+ /**
+ * @en To string
+ * @zh 转换成字符串
+ */
+ readonly toStr: string;
+ /**
+ * @en Returns account identifiers that were provided when the purchase was made.
+ * @zh 返回购买时提供的帐户标识符。
+ */
+ readonly accountIdentifiers: __types_jsb_jsb__AccountIdentifiers;
+ /**
+ * @en The PendingPurchaseUpdate for an uncommitted transaction.
+ * @zh 返回PendingPurchaseUpdate未提交的事务。
+ */
+ readonly pendingPurchaseUpdate: __types_jsb_jsb__PendingPurchaseUpdate;
+ /**
+ * @en the product Ids.
+ * @zh 产品 ID。
+ */
+ readonly products: string[];
+ }
+ /**
+ * @en Params containing the response code and the debug message from In-app Billing API response.
+ * @zh 包含应用内结算 API 响应代码和调试信息的参数
+ */
+ export interface __types_jsb_jsb__BillingResult {
+ /**
+ * @en Debug message returned in In-app Billing API calls.
+ * @zh 应用内结算 API 调用中返回的调试消息。
+ */
+ readonly debugMessage: string;
+ /**
+ * @en Code returned in In-app Billing API calls.
+ * @zh 应用内结算 API 调用中返回的响应代码。
+ */
+ readonly responseCode: string;
+ readonly toStr: string;
+ }
+ export interface __types_jsb_jsb__BillingConfig {
+ /**
+ * @en The customer's country code.
+ * @zh 客户的国家代码。
+ */
+ readonly countryCode: string;
+ }
+ /**
+ * @en The details used to report transactions made via alternative billing without user choice to use Google Play Billing.
+ * @zh 用于报告用户未选择使用 Google Play Billing方式而通过替代Billing方式进行的交易的详细信息。
+ */
+ export interface __types_jsb_jsb__AlternativeBillingOnlyReportingDetails {
+ /**
+ * @en An external transaction token that can be used to report a transaction made via alternative billing
+ * without user choice to use Google Play billing.
+ * @zh 返回一个外部交易令牌,该令牌可用于报告通过替代付款方式进行的交易,而无需用户选择使用 Google Play 付款方式。
+ */
+ readonly externalTransactionToken: string;
+ }
+ /**
+ * @en The details used to report transactions made via external offer.
+ * @zh 用于报告通过外部报价进行的交易的详细信息。
+ */
+ export interface __types_jsb_jsb__ExternalOfferReportingDetails {
+ /**
+ * @en An external transaction token that can be used to report a transaction made via external offer.
+ * @zh 可用于报告通过外部报价进行的交易的外部交易令牌。
+ */
+ readonly externalTransactionToken: string;
+ }
+ /**
+ * @en Results related to in-app messaging.
+ * @zh 与应用程序内消息相关的结果。
+ */
+ export interface __types_jsb_jsb__InAppMessageResult {
+ /**
+ * @en Response code for the in-app messaging API call.
+ * @zh 应用内消息传递 API 调用的响应代码。
+ */
+ readonly responseCode: number;
+ /**
+ * @en Token that identifies the purchase to be acknowledged, if any.
+ * @zh 返回标识需要确认的购买的令牌。
+ */
+ readonly purchaseToken: string;
+ }
+ export namespace __types_jsb__jsb {
+ let window: any;
+ type AccelerationXYZ = number;
+ type AccelerationIncludingGravityXYZ = number;
+ type RotationRateAlpha = number;
+ type RotationRateBeta = number;
+ type RotationRateGamma = number;
+ type DeviceMotionValue = [
+ __types_jsb_jsb__AccelerationXYZ,
+ __types_jsb_jsb__AccelerationXYZ,
+ __types_jsb_jsb__AccelerationXYZ,
+ __types_jsb_jsb__AccelerationIncludingGravityXYZ,
+ __types_jsb_jsb__AccelerationIncludingGravityXYZ,
+ __types_jsb_jsb__AccelerationIncludingGravityXYZ,
+ __types_jsb_jsb__RotationRateAlpha,
+ __types_jsb_jsb__RotationRateBeta,
+ __types_jsb_jsb__RotationRateGamma
+ ];
+ export interface NativeSafeAreaEdge {
+ /**
+ * top
+ */
+ x: number;
+ /**
+ * left
+ */
+ y: number;
+ /**
+ * bottom
+ */
+ z: number;
+ /**
+ * right
+ */
+ w: number;
+ }
+ export interface MouseEvent {
+ x: number;
+ y: number;
+ xDelta: number | undefined;
+ yDelta: number | undefined;
+ button: number;
+ windowId: number;
+ }
+ type MouseEventCallback = (mouseEvent: __types_jsb_jsb__MouseEvent) => void;
+ export interface MouseWheelEvent extends __types_jsb_jsb__MouseEvent {
+ wheelDeltaX: number;
+ wheelDeltaY: number;
+ }
+ type MouseWheelEventCallback = (mouseEvent: __types_jsb_jsb__MouseWheelEvent) => void;
+ export let onMouseDown: __types_jsb_jsb__MouseEventCallback | undefined;
+ export let onMouseMove: __types_jsb_jsb__MouseEventCallback | undefined;
+ export let onMouseUp: __types_jsb_jsb__MouseEventCallback | undefined;
+ export let onMouseWheel: __types_jsb_jsb__MouseWheelEventCallback | undefined;
+ type TouchEventCallback = (touchList: TouchList, windowId?: number) => void;
+ export let onTouchStart: __types_jsb_jsb__TouchEventCallback | undefined;
+ export let onTouchMove: __types_jsb_jsb__TouchEventCallback | undefined;
+ export let onTouchEnd: __types_jsb_jsb__TouchEventCallback | undefined;
+ export let onTouchCancel: __types_jsb_jsb__TouchEventCallback | undefined;
+ export interface ControllerInfo {
+ id: number;
+ axisInfoList: __types_jsb_jsb__AxisInfo[];
+ buttonInfoList: __types_jsb_jsb__ButtonInfo[];
+ touchInfoList: __types_jsb_jsb__TouchInfo[];
+ }
+ export interface AxisInfo {
+ code: number;
+ value: number;
+ }
+ export interface ButtonInfo {
+ code: number;
+ isPressed: boolean;
+ }
+ export interface TouchInfo {
+ code: number;
+ value: number;
+ }
+ export let onControllerInput: (infoList: __types_jsb_jsb__ControllerInfo[]) => void | undefined;
+ export let onHandleInput: (infoList: __types_jsb_jsb__ControllerInfo[]) => void | undefined;
+ export let onControllerChange: (controllerIds: number[]) => void | undefined;
+ export interface PoseInfo {
+ code: number;
+ x: number;
+ y: number;
+ z: number;
+ quaternionX: number;
+ quaternionY: number;
+ quaternionZ: number;
+ quaternionW: number;
+ }
+ export let onHandlePoseInput: (infoList: __types_jsb_jsb__PoseInfo[]) => void | undefined;
+ export let onHMDPoseInput: (infoList: __types_jsb_jsb__PoseInfo[]) => void | undefined;
+ export let onHandheldPoseInput: (infoList: __types_jsb_jsb__PoseInfo[]) => void | undefined;
+ export interface KeyboardEvent {
+ altKey: boolean;
+ ctrlKey: boolean;
+ metaKey: boolean;
+ shiftKey: boolean;
+ repeat: boolean;
+ keyCode: number;
+ windowId: number;
+ code: string;
+ }
+ type KeyboardEventCallback = (keyboardEvent: __types_jsb_jsb__KeyboardEvent) => void;
+ export let onKeyDown: __types_jsb_jsb__KeyboardEventCallback | undefined;
+ export let onKeyUp: __types_jsb_jsb__KeyboardEventCallback | undefined;
+ export interface WindowEvent {
+ windowId: number;
+ width: number;
+ height: number;
+ }
+ /**
+ * @en WindowEvent.width and WindowEvent.height have both been multiplied by DPR
+ * @zh WindowEvent.width 和 WindowEvent.height 都已乘以 DPR
+ */
+ export let onResize: (event: __types_jsb_jsb__WindowEvent) => void | undefined;
+ export let onOrientationChanged: (event: {
+ orientation: number;
+ }) => void | undefined;
+ export let onResume: () => void | undefined;
+ export let onPause: () => void | undefined;
+ export let onClose: () => void | undefined;
+ export let onWindowLeave: () => void | undefined;
+ export let onWindowEnter: () => void | undefined;
+ export function openURL(url: string): void;
+ export function garbageCollect(): void;
+ enum AudioFormat {
+ UNKNOWN,
+ SIGNED_8,
+ UNSIGNED_8,
+ SIGNED_16,
+ UNSIGNED_16,
+ SIGNED_32,
+ UNSIGNED_32,
+ FLOAT_32,
+ FLOAT_64
+ }
+ interface PCMHeader {
+ totalFrames: number;
+ sampleRate: number;
+ bytesPerFrame: number;
+ audioFormat: __types_jsb_jsb__AudioFormat;
+ channelCount: number;
+ }
+ class NativePOD {
+ underlyingData(): ArrayBuffer;
+ _data(): __types_globals__TypedArray;
+ __data: __types_globals__TypedArray;
+ }
+ export class Color extends __types_jsb_jsb__NativePOD {
+ }
+ export class Quat extends __types_jsb_jsb__NativePOD {
+ }
+ export class Vec2 extends __types_jsb_jsb__NativePOD {
+ }
+ export class Vec3 extends __types_jsb_jsb__NativePOD {
+ }
+ export class Vec4 extends __types_jsb_jsb__NativePOD {
+ }
+ export class Mat3 extends __types_jsb_jsb__NativePOD {
+ }
+ export class Mat4 extends __types_jsb_jsb__NativePOD {
+ }
+ export interface ManifestAsset {
+ md5: string;
+ path: string;
+ compressed: boolean;
+ size: number;
+ downloadState: number;
+ }
+ export class Manifest {
+ constructor(manifestUrl: string);
+ constructor(content: string, manifestRoot: string);
+ parseFile(manifestUrl: string): void;
+ parseJSONString(content: string, manifestRoot: string): void;
+ getManifestRoot(): string;
+ getManifestFileUrl(): string;
+ getVersionFileUrl(): string;
+ getSearchPaths(): [
+ string
+ ];
+ getVersion(): string;
+ getPackageUrl(): boolean;
+ setUpdating(isUpdating: boolean): void;
+ isUpdating(): boolean;
+ isVersionLoaded(): boolean;
+ isLoaded(): boolean;
+ }
+ export class EventAssetsManager {
+ // EventCode
+ static ERROR_NO_LOCAL_MANIFEST: number;
+ static ERROR_DOWNLOAD_MANIFEST: number;
+ static ERROR_PARSE_MANIFEST: number;
+ static NEW_VERSION_FOUND: number;
+ static ALREADY_UP_TO_DATE: number;
+ static UPDATE_PROGRESSION: number;
+ static ASSET_UPDATED: number;
+ static ERROR_UPDATING: number;
+ static UPDATE_FINISHED: number;
+ static UPDATE_FAILED: number;
+ static ERROR_DECOMPRESS: number;
+ constructor(eventName: string, manager: __types_jsb_jsb__AssetsManager, eventCode: number, assetId?: string, message?: string, curleCode?: number, curlmCode?: number);
+ getAssetsManagerEx(): __types_jsb_jsb__AssetsManager;
+ isResuming(): boolean;
+ getDownloadedFiles(): number;
+ getDownloadedBytes(): number;
+ getTotalFiles(): number;
+ getTotalBytes(): number;
+ getPercent(): number;
+ getPercentByFile(): number;
+ getEventCode(): number;
+ getMessage(): string;
+ getAssetId(): string;
+ getCURLECode(): number;
+ getCURLMCode(): number;
+ }
+ export class AssetsManager {
+ constructor(manifestUrl: string, storagePath: string, versionCompareHandle?: (versionA: string, versionB: string) => number);
+ static create(manifestUrl: string, storagePath: string): __types_jsb_jsb__AssetsManager;
+ getState(): __types_jsb_jsb__AssetsManager.State;
+ getStoragePath(): string;
+ getMaxConcurrentTask(): number;
+ // setMaxConcurrentTask (max: number): void; // actually not supported
+ checkUpdate(): void;
+ prepareUpdate(): void;
+ update(): void;
+ isResuming(): boolean;
+ getDownloadedFiles(): number;
+ getDownloadedBytes(): number;
+ getTotalFiles(): number;
+ getTotalBytes(): number;
+ downloadFailedAssets(): void;
+ getLocalManifest(): __types_jsb_jsb__Manifest;
+ loadLocalManifest(manifestUrl: string): boolean;
+ loadLocalManifest(localManifest: __types_jsb_jsb__Manifest, storagePath: string): boolean;
+ getRemoteManifest(): __types_jsb_jsb__Manifest;
+ loadRemoteManifest(remoteManifest: __types_jsb_jsb__Manifest): boolean;
+ /**
+ * Setup your own version compare handler, versionA and B is versions in string.
+ * if the return value greater than 0, versionA is greater than B,
+ * if the return value equals 0, versionA equals to B,
+ * if the return value smaller than 0, versionA is smaller than B.
+ */
+ setVersionCompareHandle(versionCompareHandle?: (versionA: string, versionB: string) => number): void;
+ /**
+ * Setup the verification callback, Return true if the verification passed, otherwise return false
+ */
+ setVerifyCallback(verifyCallback: (path: string, asset: __types_jsb_jsb__ManifestAsset) => boolean): void;
+ setEventCallback(eventCallback: (event: __types_jsb_jsb__EventAssetsManager) => void): void;
+ }
+ // Android ADPF module
+ const adpf: {
+ readonly thermalHeadroom: number;
+ readonly thermalStatus: number;
+ readonly thermalStatusMin: number;
+ readonly thermalStatusMax: number;
+ readonly thermalStatusNormalized: number;
+ onThermalStatusChanged?: (previousStatus: number, newStatus: number, statusMin: number, statusMax: number) => void;
+ } | undefined;
+ /**
+ * @en Params containing the response code and the debug message from In-app Billing API response.
+ * @zh 包含应用内结算 API 响应代码和调试信息的参数
+ */
+ export interface BillingResult {
+ /**
+ * @en Debug message returned in In-app Billing API calls.
+ * @zh 应用内结算 API 调用中返回的调试消息。
+ */
+ readonly debugMessage: string;
+ /**
+ * @en Code returned in In-app Billing API calls.
+ * @zh 应用内结算 API 调用中返回的响应代码。
+ */
+ readonly responseCode: string;
+ readonly toStr: string;
+ }
+ /**
+ * @en Represents the offer details to buy an one-time purchase product.
+ * @zh 代表一次性购买产品的报价详情。
+ */
+ export interface OneTimePurchaseOfferDetails {
+ /**
+ * @en The price for the payment in micro-units, where 1,000,000 micro-units equal one unit of the currency.
+ * @zh 以微单位返回支付价格,其中 1,000,000 个微单位等于 1 个货币单位。
+ */
+ readonly priceAmountMicros: number;
+ /**
+ * @en Formatted price for the payment, including its currency sign.
+ * @zh 支付的格式化价格,包括其货币单位。
+ */
+ readonly formattedPrice: string;
+ /**
+ * @en ISO 4217 currency code for price.
+ * @zh 价格的 ISO 4217 货币代码。
+ */
+ readonly priceCurrencyCode: string;
+ }
+ /**
+ * @en Represents additional details of an installment subscription plan.
+ * @zh 表示分期付款订阅计划的附加详细信息。
+ */
+ export interface InstallmentPlanDetails {
+ /**
+ * @en Committed payments count after a user signs up for this subscription plan.
+ * @zh 用户注册此订阅计划后承诺的付款数量。
+ */
+ readonly installmentPlanCommitmentPaymentsCount: number;
+ /**
+ * @en Subsequent committed payments count after this subscription plan renews.
+ * @zh 此订阅计划续订后的后续承诺付款数量。
+ */
+ readonly subsequentInstallmentPlanCommitmentPaymentsCount: number;
+ }
+ /**
+ * @en Represents a pricing phase, describing how a user pays at a point in time.
+ * @zh 表示定价阶段,描述用户在某个时间点如何付款。
+ */
+ export interface PricingPhase {
+ /**
+ * @en Number of cycles for which the billing period is applied.
+ * @zh 计费周期适用的周期数。
+ */
+ readonly billingCycleCount: number;
+ /**
+ * @en The price for the payment cycle in micro-units, where 1,000,000 micro-units equal one unit of the currency.
+ * @zh 微单位付款周期的价格,其中 1,000,000 个微单位等于 1 个货币单位。
+ */
+ readonly priceAmountMicros: number;
+ /**
+ * @en RecurrenceMode for the pricing phase.
+ * @zh 定价阶段的RecurrenceMode。
+ */
+ readonly recurrenceMode: number;
+ /**
+ * @en Billing period for which the given price applies, specified in ISO 8601 format.
+ * @zh 给定价格适用的计费期,以 ISO 8601 格式指定。
+ */
+ readonly billingPeriod: string;
+ /**
+ * @en Formatted price for the payment cycle, including its currency sign.
+ * @zh 付款周期的格式化价格,包括其货币符号。
+ */
+ readonly formattedPrice: string;
+ /**
+ * @en Returns ISO 4217 currency code for price.
+ * @zh 返回价格的 ISO 4217 货币代码。
+ */
+ readonly priceCurrencyCode: string;
+ }
+ /**
+ * @en Represents the available purchase plans to buy a subscription product.
+ * @zh 代表一次性购买产品的报价详情。
+ */
+ export interface SubscriptionOfferDetails {
+ /**
+ * @en The base plan id associated with the subscription product.
+ * @zh 与订阅产品相关的基本计划 ID。
+ */
+ readonly basePlanId: string;
+ /**
+ * @en The offer id associated with the subscription product.
+ * @zh 与订阅产品相关的优惠 ID。
+ */
+ readonly offerId: string;
+ /**
+ * @en The offer tags associated with this Subscription Offer.
+ * @zh 与此订阅优惠相关的优惠标签。
+ */
+ readonly offerTags: string[];
+ /**
+ * @en The offer token required to pass in launchBillingFlow to purchase the subscription product with these pricing phases.
+ * @zh 在 launchBillingFlow 中传递以使用这些定价阶段购买订阅产品所需的优惠令牌。
+ */
+ readonly offerToken: string;
+ /**
+ * @en The pricing phases for the subscription product.
+ * @zh 订阅产品的定价区间。
+ */
+ readonly pricingPhaseList: __types_jsb_jsb__PricingPhase[];
+ /**
+ * @en The additional details of an installment plan.
+ * @zh 分期付款计划的附加详细信息。
+ */
+ readonly installmentPlanDetails: __types_jsb_jsb__InstallmentPlanDetails;
+ }
+ /**
+ * @en Represents the details of a one time or subscription product.
+ * @zh 代表一次性或订阅产品的详细信息。
+ */
+ export interface ProductDetails {
+ /**
+ * @en Hash code
+ * @zh hash值
+ */
+ readonly hashCode: number;
+ /**
+ * @en The description of the product.
+ * @zh 产品的描述。
+ */
+ readonly description: string;
+ /**
+ * @en The name of the product being sold.
+ * @zh 所售产品的名称。
+ */
+ readonly name: string;
+ /**
+ * @en The product's Id.
+ * @zh 产品的 ID。
+ */
+ readonly productId: string;
+ /**
+ * @en The ProductType of the product.
+ * @zh ProductType产品的。
+ */
+ readonly productType: string;
+ /**
+ * @en The title of the product being sold.
+ * @zh 所售产品的标题。
+ */
+ readonly title: string;
+ /**
+ * @en To string
+ * @zh 转换成字符串
+ */
+ readonly toStr: string;
+ /**
+ * @en The offer details of an one-time purchase product.
+ * @zh 代表一次性购买产品的报价详情。
+ */
+ readonly oneTimePurchaseOfferDetails: __types_jsb_jsb__OneTimePurchaseOfferDetails;
+ /**
+ * @en A list containing all available offers to purchase a subscription product.
+ * @zh 返回包含购买订阅产品的所有可用优惠的列表。
+ */
+ readonly subscriptionOfferDetails: __types_jsb_jsb__SubscriptionOfferDetails[];
+ }
+ /**
+ * @en Account identifiers that were specified when the purchase was made.
+ * @zh 购买时指定的帐户标识符。
+ */
+ export interface AccountIdentifiers {
+ /**
+ * @en The obfuscated account id specified in setObfuscatedAccountId.
+ * @zh 在setObfuscatedAccountId中设置的混淆账户id
+ */
+ readonly obfuscatedAccountId: string;
+ /**
+ * @en The obfuscated profile id specified in setObfuscatedProfileId.
+ * @zh 在setObfuscatedProfileId中设置的混淆profile id
+ */
+ readonly obfuscatedProfileId: string;
+ }
+ /**
+ * @en Represents a pending change/update to the existing purchase.
+ * @zh 表示对现有购买的待定更改/更新。
+ */
+ export interface PendingPurchaseUpdate {
+ /**
+ * @en A token that uniquely identifies this pending transaction.
+ * @zh 唯一标识此待处理交易的令牌。
+ */
+ readonly purchaseToken: string;
+ /**
+ * @en The product ids.
+ * @zh 产品 ID。
+ */
+ readonly products: string[];
+ }
+ /**
+ * @en Represents an in-app billing purchase.
+ * @zh 代表应用内billing购买。
+ */
+ export interface Purchase {
+ /**
+ * @en One of PurchaseState indicating the state of the purchase.
+ * @zh PurchaseState表示购买状态的其中一个值。
+ */
+ readonly purchaseState: number;
+ /**
+ * @en The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
+ * @zh 产品购买的时间,以纪元(1970 年 1 月 1 日)以来的毫秒数表示。
+ */
+ readonly purchaseTime: number;
+ /**
+ * @en Indicates whether the purchase has been acknowledged.
+ * @zh 表示是否已确认购买。
+ */
+ readonly isAcknowledged: number;
+ /**
+ * @en Indicates whether the subscription renews automatically.
+ * @zh 指示订阅是否自动续订。
+ */
+ readonly isAutoRenewing: number;
+ /**
+ * @en Hash code
+ * @zh hash值
+ */
+ readonly hashCode: number;
+ /**
+ * @en The quantity of the purchased product.
+ * @zh 购买产品的数量。
+ */
+ readonly quantity: number;
+ /**
+ * @en The payload specified when the purchase was acknowledged or consumed.
+ * @zh 确认或消费购买时指定的有效负载。
+ */
+ readonly developerPayload: string;
+ /**
+ * @en Returns a unique order identifier for the transaction.
+ * @zh 交易的唯一订单标识符。
+ */
+ readonly orderId: string;
+ /**
+ * @en Returns a String in JSON format that contains details about the purchase order.
+ * @zh 包含有关采购订单详细信息的 JSON 格式的字符串。
+ */
+ readonly originalJson: string;
+ /**
+ * @en The application package from which the purchase originated.
+ * @zh 购买来源的应用程序包。
+ */
+ readonly packageName: string;
+ /**
+ * @en A token that uniquely identifies a purchase for a given item and user pair.
+ * @zh 唯一标识给定商品和用户对的购买的令牌。
+ */
+ readonly purchaseToken: string;
+ /**
+ * @en String containing the signature of the purchase data that was signed with the private key of the developer.
+ * @zh 包含使用开发者私钥签名的购买数据签名的字符串。
+ */
+ readonly signature: string;
+ /**
+ * @en To string
+ * @zh 转换成字符串
+ */
+ readonly toStr: string;
+ /**
+ * @en Returns account identifiers that were provided when the purchase was made.
+ * @zh 返回购买时提供的帐户标识符。
+ */
+ readonly accountIdentifiers: __types_jsb_jsb__AccountIdentifiers;
+ /**
+ * @en The PendingPurchaseUpdate for an uncommitted transaction.
+ * @zh 返回PendingPurchaseUpdate未提交的事务。
+ */
+ readonly pendingPurchaseUpdate: __types_jsb_jsb__PendingPurchaseUpdate;
+ /**
+ * @en the product Ids.
+ * @zh 产品 ID。
+ */
+ readonly products: string[];
+ }
+ export interface BillingConfig {
+ /**
+ * @en The customer's country code.
+ * @zh 客户的国家代码。
+ */
+ readonly countryCode: string;
+ }
+ /**
+ * @en The details used to report transactions made via alternative billing without user choice to use Google Play Billing.
+ * @zh 用于报告用户未选择使用 Google Play Billing方式而通过替代Billing方式进行的交易的详细信息。
+ */
+ export interface AlternativeBillingOnlyReportingDetails {
+ /**
+ * @en An external transaction token that can be used to report a transaction made via alternative billing
+ * without user choice to use Google Play billing.
+ * @zh 返回一个外部交易令牌,该令牌可用于报告通过替代付款方式进行的交易,而无需用户选择使用 Google Play 付款方式。
+ */
+ readonly externalTransactionToken: string;
+ }
+ /**
+ * @en The details used to report transactions made via external offer.
+ * @zh 用于报告通过外部报价进行的交易的详细信息。
+ */
+ export interface ExternalOfferReportingDetails {
+ /**
+ * @en An external transaction token that can be used to report a transaction made via external offer.
+ * @zh 可用于报告通过外部报价进行的交易的外部交易令牌。
+ */
+ readonly externalTransactionToken: string;
+ }
+ ...*[Comment body truncated]* |
I would prefer to provide it as a plugin package rather than built into the engine. I see that the current version of Google Play Billing is hardcoded. This brings many problems, such as After the new version of Google Play Billing is released, can the engine group immediately adapt to the new version and release it? According to this design, what you want to release is a new engine version, not a plug-in version! |
Yes, we will adapter it immediately. |
And currently plugin doesn't support native codes well. |
There are many SDKs like Google Play Billing, such as AppsFlyer, Adjust, etc. It is impossible to embed them all into the engine I prefer to improve the function of the plug-in package first, so that it can embed the SDK more easily In this way, countless SDKs can be easily embedded, which will improve the native capability ecosystem of cocos It is too difficult now I think this access can actually be postponed. Until when? Until the plug-in package improves its ability to access the native SDK |
native/cocos/platform/android/java/vendor/com/cocos/billing/CocosBillingHelper.java
Outdated
Show resolved
Hide resolved
a047980
to
a33d839
Compare
@cocos-robot run test cases |
* @en Params containing the response code and the debug message from In-app Billing API response. | ||
* @zh 包含应用内结算 API 响应代码和调试信息的参数 | ||
*/ | ||
export interface BillingResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only declare that it is not directly exported to users.
native/cocos/platform/android/java/vendor/com/cocos/billing/CocosBillingHelper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Google Play has a separate build.gradle file, placing it in the template and copying it to overwrite during the build process—would this be a better approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it can be optimized in the future.
@cocos-robot run test cases |
vendor/google/billing/billing.ts
Outdated
* @param purchase @zh 已经购买的产品。 @en Purchased Products. | ||
*/ | ||
public acknowledgePurchase (purchase: google.Purchase[] | google.Purchase): void { | ||
if (purchase instanceof Array) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest use Array.isArray(purchase)
exports/vendor.ts
Outdated
THE SOFTWARE. | ||
*/ | ||
|
||
export * from '../vendor/google'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider to rename exports/vendor.ts
to exports/vendor-google.ts
since there may be other vendors that will be integrated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
native/CMakeLists.txt
Outdated
@@ -3114,6 +3146,8 @@ function(cc_apply_definations target) | |||
$<$<BOOL:${USE_SE_NAPI}>:SCRIPT_ENGINE_TYPE=5> | |||
$<$<BOOL:${USE_SE_JSVM}>:SCRIPT_ENGINE_TYPE=6> | |||
$<$<OR:$<CONFIG:Debug>,$<BOOL:${CC_DEBUG_FORCE}>>:CC_DEBUG=1> | |||
$<IF:$<BOOL:${USE_APDF}>,CC_USE_APDF=1,CC_USE_USE_APDF=0> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: CC_USE_USE_APDF -> CC_USE_APDF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
if (!obj->getProperty("jsb", &nsVal, true)) { | ||
se::HandleObject jsobj(se::Object::createPlainObject()); | ||
nsVal.setObject(jsobj); | ||
obj->setProperty("jsb", nsVal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use google.billing
namespace rather than jsb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a directly exported interface, this is the interface between native and ts
} | ||
|
||
public static void removePurchase(int purchaseID) { | ||
instance.removeProductDetails(purchaseID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use getInstance()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@qiuguohua, Please check the result of
Task Details |
@qiuguohua, Please check the result of
Task Details
|
2. Adjusting the interface to support only arrays
…ogle_play_billing2 # Conflicts: # scripts/native-pack-tool/source/index.ts
Re: #
Changelog
#17836
*
Continuous Integration
This pull request:
Compatibility Check
This pull request: