引入一个脚本,调用几个函数,你的游戏即可接入平台排行榜、评分、成绩分享与游戏跳转。无需后端、无需密钥。Add one script, call a few functions, and your game gains leaderboards, ratings, score sharing and game navigation. No backend, no API key.
在你的游戏页面里加入下面这一行,就可以调用全部能力:Add this one line to your game page to use all capabilities:
结算时上报分数:Report a score when a round ends:
上报分数到本游戏的全服榜。可选昵称,未填写时平台自动生成。Submit a score to this game's global leaderboard. Nickname is optional; one is generated if omitted.
参数Params: score 非负数字non-negative number; options.name 可选昵称optional nickname
上报玩家对游戏的评分,范围为 0.5 到 5。Submit a player rating for the game, from 0.5 to 5.
参数Params: rating 0.5–5
读取本游戏全服榜前十,返回 [{ name, score }]。可用于在你的游戏里自绘榜单。Read this game's global top 10 as [{ name, score }], so you can draw your own leaderboard.
获取当前玩家昵称,可用于游戏内问候语。未取得时返回 null。Get the current player's nickname for in-game greeting. Returns null if unavailable.
判断游戏是否正在平台播放器内运行。可用它让同一份游戏代码在平台内外表现不同。Check whether the game is running inside the platform player, so one codebase can behave differently inside and outside.
玩完一局后调用,带玩家去玩一款相似游戏。可传 category 限定分类。Call after a round ends to take the player to a similar game. Pass category to limit the genre.
生成一条平台格式的成绩分享链接,可直接复制或发给好友。可选自定义文案。无上下文时返回 null。Generate a platform-formatted score share link to copy or send to friends. Optional custom text. Returns null without context.
从游戏内打开本游戏的详情页,查看简介与更新日志。Open this game's detail page from inside the game for its description and update log.
Promise,取不到时解析为 null 或空数组。
The SDK only takes effect when your game runs inside the platform player. Calling any function on a standalone game page is safe and silent. Context-dependent functions return a Promise that resolves to null or an empty array when unavailable.
不需要。引入脚本后直接调用函数即可。No. Just add the script and call the functions.
登录玩家使用其显示名;未登录时平台生成一个本地随机昵称。Signed-in players use their display name; others get a local random nickname.
提交后不可由开发者修改。如需更正,请让玩家重新提交。Developers cannot edit a submitted score. Ask the player to resubmit instead.
是的,提交成绩后刷新榜单即可看到更新。Yes. Refresh the leaderboard after a score is submitted to see updates.