7ce3347e-1fcc-4701-8050-abdbad2355cb.json 22 KB

1234567
  1. {
  2. "__type__": "cc.TextAsset",
  3. "_name": "fbinstant.d",
  4. "_objFlags": 0,
  5. "_native": "",
  6. "text": "\n\n//Copyright (c) 2014-present, Egret Technology.\n//for fbinstant.6.1.js\ndeclare class FBInstant {\n /**\n * 获取用户信息.\n * Contains functions and properties related to the current player.\n */\n static player: FBInstant.FBPlayer;\n /**\n * 当前游戏的来源信息\n * Contains functions and properties related to the current game context.\n */\n static context: FBInstant.Context;\n /**\n * 获取用户的语言设置,例如:zh_CN en_US\n * The current locale\n */\n static getLocale(): string;\n /**\n * 获取运行的平台信息: IOS | ANDROID | WEB | MOBILE_WEB\n * The platform on which the game is currently running\n */\n static getPlatform(): FBPlatform;\n /**\n * SDK 的版本号,例如: '4.1'\n * The string representation of this SDK version.\n */\n static getSDKVersion(): string;\n /**\n * SDK 初始化结束会返回一个 Promise 方法,应当在其他 API 使用前调用\n * Initializes the SDK library.\n */\n static initializeAsync(): Promise<void>;\n /**\n * 通知平台资源加载的百分比\n * Report the game's initial loading progress.\n * @param percentage 0-100\n */\n static setLoadingProgress(percentage: number): void;\n /**\n * 获取平台支持的 api 列表\n * Provides a list of API functions that are supported by the client.\n */\n static getSupportedAPIs(): string[];\n /**\n * 获取入口点数据\n * Returns any data object associated with the entry point that the game was launched from.\n */\n static getEntryPointData(): Object;\n /**\n * 用户从哪个入口进入的游戏\n * Returns the entry point that the game was launched from\n */\n static getEntryPointAsync(): string;\n /**\n * 设置会话数据\n * Sets the data associated with the individual gameplay session for the current context.\n */\n static setSessionData(sessionData: Object): void;\n /**\n * 游戏已完成加载资源,用户点击了开始游戏的按钮\n * 返回一个 Promise 方法\n * This indicates that the game has finished initial loading and is ready to start. Context information will be up-to-date when the returned promise resolves.\n */\n static startGameAsync(): Promise<void>;\n /**\n * 分享游戏\n * This invokes a dialog to let the user share specified content, either as a message in Messenger or as a post on the user's timeline. \n */\n static shareAsync(payload: FBInstant.SharePayload): Promise<void>;\n /**\n * 通知 Facebook 在游戏中发生的更新\n * Informs Facebook of an update that occurred in the game. \n */\n static updateAsync(payload: FBInstant.CustomUpdatePayload | FBInstant.LeaderboardUpdatePayload): Promise<void>;\n /**\n * 请求客户端切换到另一个小游戏\n * Request that the client switch to a different Instant Game. \n */\n static switchGameAsync(appID: string, data?): Promise<void>;\n /**\n * 用户是否有资格创建快捷方式。\n * Returns whether or not the user is eligible to have shortcut creation requested.\n */\n static canCreateShortcutAsync(): Promise<Boolean>;\n /**\n * 如果用户有资格,提示用户创建游戏的快捷方式。\n * Prompts the user to create a shortcut to the game if they are eligible to Can only be called once per session. \n */\n static createShortcutAsync(): Promise<void>;\n /**\n * 退出游戏\n * Quits the game.\n */\n static quit(): void;\n /**\n * 使用 Facebook 的分析功能来分析应用。\n * Log an app event with FB Analytics\n * @param eventName 要分析的事件名称\n * @param valueToSum 可选,FB分析可以计算它。\n * @param parameters 可选,它可以包含多达25个 key-value,以记录事件。key 必须是2-40个字符,只能包含'_', '-', ' '和字母数字的字符。 Value 必须少于100个字符。\n */\n static logEvent(eventName: string, valueToSum?: number, parameters?: Object): FBInstant.APIError;\n /**\n * 设置一个暂停触发的方法\n * Set a callback to be fired when a pause event is triggered.\n */\n static onPause(func: Function): void;\n /**\n * 创建交互广告\n * Attempt to create an instance of interstitial ad. This instance can then be preloaded and presented.\n * @param placementID 在 Audience Network 设置的位置ID\n */\n static getInterstitialAdAsync(placementID: String): Promise<FBInstant.AdInstance>;\n /**\n * 创建激励视频广告\n * Attempt to create an instance of rewarded video. This instance can then be preloaded and presented.\n * @param placementID 在 Audience Network 设置的位置ID\n */\n static getRewardedVideoAsync(placementID: String): Promise<FBInstant.AdInstance>;\n /**\n * 尝试将当前玩家与等待他人加入游戏的其他玩家进行匹配\n * Attempts to match the current player with other users looking for people to play with\n */\n static matchPlayerAsync(matchTag: string, switchContextWhenMatched: boolean): Promise<void>;\n /**\n * 检查当前玩家是否符合 matchPlayerAsync API 的条件。\n * Checks if the current player is eligible for the matchPlayerAsync API.\n */\n static checkCanPlayerMatchAsync(): Promise<boolean>;\n /**\n * 获取这款小游戏中的特有排行榜。\n * An Instant Game leaderboard\n */\n static getLeaderboardAsync(name: string): Promise<FBInstant.Leaderboard>;\n}\ndeclare namespace FBInstant {\n interface AdInstance {\n /**\n * 获取广告位id\n */\n getPlacementID(): string;\n /**\n * 加载广告资源\n */\n loadAsync(): Promise<void>;\n /**\n * 播放广告\n */\n showAsync(): Promise<void>;\n }\n interface FBPlayer {\n /**\n * 玩家的唯一标识ID.\n * A unique identifier for the player.\n */\n getID(): string;\n /**\n * 获取玩家的唯一ID和一个签名,签名用来验证该 ID 来自 Facebook ,没有被篡改。\n * Fetch the player's unique identifier along with a signature that verifies that the identifier indeed comes from Facebook without being tampered with\n */\n getSignedPlayerInfoAsync(requestPayload?: string): Promise<SignedPlayerInfo>;\n /**\n * 返回一个 promise,表示玩家是否可以与游戏机器人对战。\n * Returns a promise that resolves with whether the player can subscribe to the game bot or not.\n */\n canSubscribeBotAsync(): Promise<Boolean>;\n /**\n * 请求玩家订阅游戏机器人。\n * Request that the player subscribe the bot associated to the game. \n */\n subscribeBotAsync(): Promise<void>;\n /**\n * 获取用户在Facebook上的的名字,使用用户的语言种类显示\n * The player's localized display name.\n */\n getName(): string;\n /**\n * 获取用户在Facebook上的头像的url,头像为正方形,最小尺寸为200x200.\n * A url to the player's public profile photo.\n */\n getPhoto(): string;\n /**\n * 取回在FB平台储存的当前用户的数据\n * Retrieve data from the designated cloud storage of the current player\n * @param keys 数据的 key 的数组\n */\n getDataAsync(keys: string[]): Promise<Object>;\n /**\n * 把当前用户的数据储存在FB平台上。\n * Set data to be saved to the designated cloud storage of the current player. \n * @param data 包含key-value的数据对象.\n */\n setDataAsync(data: Object): Promise<void>;\n /**\n * 立刻保存数据\n * Immediately flushes any changes to the player data to the designated cloud storage. \n */\n flushDataAsync(): Promise<void>;\n /**\n * 获取当前玩家数据\n * Retrieve stats from the designated cloud storage of the current player.\n * @param keys 数据的 key 的数组\n */\n getStatsAsync(keys: string[]): Promise<void>;\n /**\n * 把当前用户的数据储存在FB平台上。\n * Set stats to be saved to the designated cloud storage of the current player.\n * @param data 包含key-value的数据对象.\n */\n setStatsAsync(stats: Object): Promise<void>;\n /**\n * 把当前玩家数据增量更新储存到FB平台上。\n * Increment stats saved in the designated cloud storage of the current player.\n * @param data 包含key-value的数据对象.\n */\n incrementStatsAsync(increments: Object): Promise<void>;\n /**\n * 获取玩家好友的信息\n * Fetches an array of ConnectedPlayer objects containing information about players that are connected to the current player.\n */\n getConnectedPlayersAsync(): Promise<ConnectedPlayer[]>;\n }\n\n /**\n * 当前游戏的来源信息\n */\n interface Context {\n /**\n * 当前游戏来源的唯一id\n * A unique identifier for the current game context. \n */\n getID(): string;\n /**\n * 游戏的来源类型:\"POST\" | \"THREAD\" | \"GROUP\" | \"SOLO\"\n * The type of the current game context.\n */\n getType(): string;\n /**\n * 用这个方法来判断当前游戏环境中游戏参与者的数量是否介于指定的最小值和最大值之间。\n * This function determines whether the number of participants in the current game context is between a given minimum and maximum, inclusive.\n */\n isSizeBetween(minSize: number, maxSize: number): { answer: boolean, minSize: number, maxSize: number };\n /**\n * 切换游戏场景\n * Request a switch into a specific context. \n */\n switchAsync(id: string): Promise<void>;\n /**\n * 选择游戏场景\n * Opens a context selection dialog for the player. \n */\n chooseAsync(options?: { filter?: FBContextFilter[], maxSize?: number, minSize?: number }): Promise<void>;\n /**\n * 创建游戏场景\n * Attempts to create or switch into a context between a specified player and the current player. \n */\n createAsync(playerID: string): Promise<void>;\n /**\n * 获取当前环境中正在玩游戏的玩家列表,它可能包含当前玩家的信息。\n * Gets an array of #contextplayer objects containing information about active players\n */\n getPlayersAsync(): Promise<ContextPlayer[]>;\n }\n /**\n * 支付\n */\n interface payments {\n /**\n * 获取游戏的产品目录。\n * Fetches the game's product catalog.\n */\n getCatalogAsync(): Promise<Product[]>;\n /**\n * 开始特定产品的购买流程。\n * Begins the purchase flow for a specific product. \n */\n purchaseAsync(purchaseConfig: PurchaseConfig): Promise<Purchase>;\n /**\n * 获取玩家未消费的所有购买商品\n * Fetches all of the player's unconsumed purchases. \n */\n getPurchasesAsync(): Promise<Purchase[]>;\n /**\n * 消费当前玩家拥有的特定购买商品\n * Consumes a specific purchase belonging to the current player. \n */\n consumePurchaseAsync(purchaseToken: string): Promise<void>;\n /**\n * 设置一个回调,在支付操作可进行时触发。\n * Sets a callback to be triggered when Payments operations are available.\n */\n onReady(callBack: Function): void;\n }\n /**\n * 游戏好友的信息\n */\n interface ConnectedPlayer {\n /**\n * 关联用户的ID\n * Get the id of the connected player.\n */\n getID(): string;\n /**\n * 关联用户的名字\n * Get the player's full name.\n */\n getName(): string;\n /**\n * Get the player's public profile photo.\n * 关联用户的头像 ulr 地址\n */\n getPhoto(): string;\n }\n /**\n * 游戏环境中的玩家\n */\n interface ContextPlayer {\n /**\n * 关联用户的ID\n * Get the id of the context player.\n */\n getID(): string;\n /**\n * 关联用户的名字\n * Get the player's localized display name.\n */\n getName(): string;\n /**\n * 关联用户的头像 ulr 地址\n * Get the player's public profile photo.\n */\n getPhoto(): string;\n }\n /**\n * 玩家的签名信息\n */\n interface SignedPlayerInfo {\n /**\n * 玩家的id\n * Get the id of the player.\n */\n getPlayerID(): string;\n /**\n * 验证这个对象的签名确实来自Facebook。该字符串是base64url编码的,使用 HMAC 对您应用的 Sccret 进行签名,基于 OAuth 2.0 规范,\n * A signature to verify this object indeed comes from Facebook.\n */\n getSignature(): string;\n\n }\n /**\n * 要分享的内容\n */\n interface SharePayload {\n /**\n * 表示共享的目标\n * Indicates the intent of the share.\n * \"INVITE\" | \"REQUEST\" | \"CHALLENGE\" | \"SHARE\"\n */\n intent: string;\n /**\n * 要分享的图像,使用 base64 编码\n * A base64 encoded image to be shared.\n */\n image: string;\n /**\n * 要分享的文字\n * A text message to be shared.\n */\n text: string;\n /**\n * 一个附加到分享上的数据。\n * 所有从这个分享启动的游戏都可以通过 FBInstant.getEntryPointData() 方法获取到该数据。\n * A blob of data to attach to the share.\n */\n data?: Object;\n }\n /**\n * 自定义更新内容\n */\n interface CustomUpdatePayload {\n /**\n * 对于自定义更新来说,该值应该为 'CUSTOM'.\n * For custom updates, this should be 'CUSTOM'.\n */\n action: string;\n /**\n * 自定义更新使用的模板的ID,模板应该在 fbapp-config.json 中预定义。\n * 查看配置文件说明:https://developers.facebook.com/docs/games/instant-games/bundle-config\n * ID of the template this custom update is using. \n */\n template: string;\n /**\n * 可选,按钮文字。默认情况下,我们本地化的 'Play' 作为按钮文字。\n * Optional call-to-action button text. \n */\n cta?: string;\n /**\n * base64 编码的图像信息\n * Data URL of a base64 encoded image.\n */\n image: string;\n /**\n * 文本信息\n * A text message, or an object with the default text as the value of 'default' and another object mapping locale keys to translations as the value of 'localizations'.\n */\n text: string;\n /**\n * 附加到更新上的数据。当游戏通过分享启动时,可以通过 FBInstant.getEntryPointData() 方法获取。\n * 该数据必须少于1000个字符。\n * A blob of data to attach to the update. \n */\n data?: Object;\n /**\n * 指定更新的方式。\n * Specifies how the update should be delivered. \n * 'IMMEDIATE' - 默认值,立即发布更新\n * 'LAST' - 当游戏结束时,发布更新\n * 'IMMEDIATE_CLEAR' - 立即发布更新,并清除任何其他正在等待的更新\n */\n strategy?: string;\n /**\n * 指定自定义更新的通知设置。可以是“NO_PUSH”或“PUSH”,默认为“NO_PUSH”。\n * Specifies notification setting for the custom update.\n */\n notification?: string;\n }\n /**\n * 表示 FBInstant.updateAsync 的一项排行榜更新\n * Represents a leaderboard update for FBInstant.updateAsync.\n */\n interface LeaderboardUpdatePayload {\n /**\n * 对于排行榜更新,此属性应为 “LEADERBOARD”\n * For a leaderboard update, this should be 'LEADERBOARD'. text. \n */\n action: string;\n /**\n * 更新排行榜的名称。\n * The name of the leaderboard to feature in the update.\n */\n name: string;\n /**\n * 可选的文本消息\n * Optional text message\n */\n text?: string;\n }\n interface APIError {\n /**\n * 错误码\n * The relevant error code\n */\n code: string;\n /**\n * 错误信息\n * A message describing the error\n */\n message: string;\n }\n interface Product {\n /**\n * 产品的名称\n * The title of the product\n */\n title: string,\n /**\n * 产品的游戏指定id\n * The product's game-specified identifier\n */\n productID: string,\n /**\n * 产品的描述\n * The product description\n */\n description: string,\n /**\n * 产品相关图片的链接\n * A link to the product's associated image\n */\n imageURI: string,\n /**\n * 产品的价格\n * The price of the product\n */\n price: string,\n /**\n * 产品的货币代码\n * The currency code for the product\n */\n priceCurrencyCode: string,\n }\n interface PurchaseConfig {\n /**\n * 产品id\n * The identifier of the product to purchase\n */\n productID: string,\n /**\n * 可选参数,开发人员指定的内容,将包含在返回的购买签名请求里。\n * An optional developer-specified payload, to be included in the returned purchase's signed request.\n */\n developerPayload: string,\n }\n interface Purchase {\n /**\n * 可选参数,开发人员指定的内容,将包含在返回的购买签名请求里。\n * A developer-specified string, provided during the purchase of the product\n */\n developerPayload: string,\n /**\n * 购买交易的标识符\n * The identifier for the purchase transaction\n */\n paymentID: string,\n /**\n * 产品id\n * The product's game-specified identifier\n */\n productID: string,\n /**\n * 发生购买时的Unix时间戳\n * Unix timestamp of when the purchase occurred\n */\n purchaseTime: string,\n /**\n * 代表可用于消费者购买时的token\n * A token representing the purchase that may be used to consume the purchase\n */\n purchaseToken: string,\n /**\n * 购买请求的服务器签名编码\n * Server-signed encoding of the purchase request\n */\n signedRequest: string,\n\n }\n /**\n * 排行榜\n * Leaderboard\n */\n interface Leaderboard {\n /**\n * 排行榜的名称\n * The name of the leaderboard.\n */\n getName(): string,\n /**\n * 排行榜的上下文id\n * The ID of the context that the leaderboard is associated with\n */\n getContextID(): string;\n /**\n * 获取排行榜中玩家总量\n * Fetches the total number of player entries in the leaderboard.\n */\n getEntryCountAsync(): Promise<number>;\n /**\n * 更新玩家的分数\n * Updates the player's score. \n */\n setScoreAsync(score: number, extraData: string): Promise<LeaderboardEntry>;\n /**\n * 获取当前玩家游戏榜单的入口点\n * Retrieves the leaderboard's entry for the current player, or null if the player has not set one yet.\n */\n getPlayerEntryAsync(): Promise<LeaderboardEntry>;\n /**\n * 检索一组排行榜条目, 按排行榜中的评分顺序排序。\n * Retrieves a set of leaderboard entries, ordered by score ranking in the leaderboard.\n */\n getEntriesAsync(count: number, offset: number): Promise<Array<LeaderboardEntry>>;\n /**\n * 检索与当前玩家分数相邻的玩家(包括当前玩家)的排行榜分录,按照玩家的级别排序。\n * Retrieves the leaderboard score entries of the current player's connected players (including the current player), ordered by local rank within the set of connected players.\n */\n getConnectedPlayerEntriesAsync(count: number, offset: number): Promise<Array<LeaderboardEntry>>;\n }\n interface LeaderboardEntry {\n /**\n * 获取与该项关联的分数。\n * Gets the score associated with the entry.\n */\n getScore(): number;\n /**\n * 获取与该项关联的分数, 格式化为与排行榜关联的评分格式。\n * Gets the score associated with the entry, formatted with the score format associated with the leaderboard.\n */\n getFormattedScore(): string;\n /**\n * 获取上次更新排行榜条目的时间戳。\n * Gets the timestamp of when the leaderboard entry was last updated.\n */\n getTimestamp(): number;\n /**\n * 获取排行榜中玩家得分的等级。\n * Gets the rank of the player's score in the leaderboard.\n */\n getRank(): number;\n /**\n * 获取与分数关联的额外数据,由开发者设定\n * Gets the developer-specified payload associated with the score, or null if one was not set.\n */\n getExtraData(): string;\n /**\n * 获取有关与该项关联的玩家的信息。\n * Gets information about the player associated with the entry.\n */\n getPlayer(): LeaderboardPlayer\n\n }\n interface LeaderboardPlayer {\n /**\n * 玩家的名字\n * Gets the player's localized display name.\n */\n getName(): string;\n /**\n * 玩家的头像链接\n * Returns a url to the player's public profile photo.\n */\n getPhoto(): string;\n /**\n * 玩家的id\n * Gets the game's unique identifier for the player.\n */\n getID(): string;\n }\n}\ntype FBContextFilter = \"NEW_CONTEXT_ONLY\" | \"INCLUDE_EXISTING_CHALLENGES\";\ntype FBPlatform = \"IOS\" | \"ANDROID\" | \"WEB\" | \"MOBILE_WEB\";"
  7. }