Steam
Steam 是由 Valve 公司开发的数字发行平台,用于购买和游玩视频游戏。Protocol Launcher 允许你生成深度链接以与 Steam 客户端交互,例如启动游戏、打开商店页面、管理好友等。
使用方式
有两种使用此库的方式:
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
打开 Steam
ts
import { open } from 'protocol-launcher/steam'
const url = open()打开 URL
在系统默认浏览器中打开 URL。
ts
import { openUrl } from 'protocol-launcher/steam'
const url = openUrl({
url: 'https://store.steampowered.com/',
})打开商店页面
打开应用的商店页面。
ts
import { store } from 'protocol-launcher/steam'
const url = store({
id: 730,
})启动游戏
运行应用程序。如果需要会自动安装。
ts
import { launch } from 'protocol-launcher/steam'
const url = launch({
id: 730,
args: '-windowed',
})安装应用
安装应用程序。
ts
import { install } from 'protocol-launcher/steam'
const url = install({
id: 8230,
})卸载应用
删除指定应用的缓存文件。
ts
import { uninstall } from 'protocol-launcher/steam'
const url = uninstall({
id: 8230,
})验证本地文件
验证应用的本地文件。
ts
import { validate } from 'protocol-launcher/steam'
const url = validate({
id: 730,
})好友操作
打开好友窗口并执行可选操作。
ts
import { friends } from 'protocol-launcher/steam'
// 添加好友
const url = friends({
action: 'add',
id: '12345678',
})ts
import { friends } from 'protocol-launcher/steam'
// 发送消息
const url = friends({
action: 'message',
id: '12345678',
})ts
import { friends } from 'protocol-launcher/steam'
// 设置状态为在线
const url = friends({
action: 'status/online',
})打开设置
打开 Steam 设置页面。
ts
import { settings } from 'protocol-launcher/steam'
const url = settings({
page: 'downloads',
})打开组件
打开 Steam 窗口/组件。
ts
import { openComponent } from 'protocol-launcher/steam'
const url = openComponent({
component: 'bigpicture',
})ts
import { openComponent } from 'protocol-launcher/steam'
const url = openComponent({
component: 'console',
})导航
打开 Steam 导航窗口但不使其活动。
ts
import { nav } from 'protocol-launcher/steam'
const url = nav({
component: 'downloads',
})ts
import { nav } from 'protocol-launcher/steam'
const url = nav({
component: 'games/details',
param: '730',
})连接服务器
连接到 IP 指定的服务器。
ts
import { connect } from 'protocol-launcher/steam'
const url = connect({
ip: '192.0.2.1',
port: 27015,
})ts
import { connect } from 'protocol-launcher/steam'
const url = connect({
ip: '192.0.2.1',
port: 27015,
password: 'secret',
})退出 Steam
退出 Steam 应用程序。
ts
import { exit } from 'protocol-launcher/steam'
const url = exit()应用新闻
打开应用的新闻页面。
ts
import { appNews } from 'protocol-launcher/steam'
const url = appNews({
id: 730,
})游戏属性
打开指定游戏的属性。
ts
import { gameProperties } from 'protocol-launcher/steam'
const url = gameProperties({
id: 730,
})控制器配置
打开指定游戏的控制器配置器(Steam Input)。
ts
import { controllerConfig } from 'protocol-launcher/steam'
const url = controllerConfig({
id: 730,
})备份
打开备份向导并检查指定的应用程序。
ts
import { backup } from 'protocol-launcher/steam'
const url = backup({
id: 730,
})支持
启动 Steam 支持工具。
ts
import { support } from 'protocol-launcher/steam'
const url = support({
params: '730',
})命名页面
打开 Steam 中的特殊命名网页。
ts
import { url } from 'protocol-launcher/steam'
const url = url({
page: 'Store',
})ts
import { url } from 'protocol-launcher/steam'
const url = url({
page: 'SteamWorkshop',
})ts
import { url } from 'protocol-launcher/steam'
const url = url({
page: 'StoreAppPage',
param: '730',
})