#valve #gsi #cs-go #tokio #api-bindings

csgo-gsi2

Rust库,用于CS:GO游戏状态集成API

2个版本

0.3.4 2022年10月5日
0.3.3 2022年9月1日
0.3.2 2022年9月1日
0.3.1 2022年9月1日

#304游戏

自定义许可

36KB
702

csgo-gsi2

Crates.io version Crates.io downloads Crates.io license

CS:GO游戏状态集成(GSI)API的辅助库。

最佳搭配tokio异步生态系统使用。

https://github.com/rosefromthedead/csgo-gsi分支而来

使用方法

将以下内容添加到你的Cargo.toml

[dependencies]
csgo-gsi2 = "0.3.4"
tokio = { version = "1.20.1", features = ["full"] }

简单示例

examples/simple.rs 可以通过以下命令运行:cargo run --example simple.

use csgo_gsi2::{GSIConfigBuilder, GSIServer, Subscription};

#[tokio::main]
async fn main() {
    let config = GSIConfigBuilder::new("csgo-gsi")
        .subscribe_multiple(Subscription::UNRESTRICTED)
        .build();

    let mut server = GSIServer::new(config, 3000);
    server.add_listener(|update| println!("Got an update {:#?}", update));

    server
        .run()
        .await
        .expect("server didn't start");
}

查看详细示例examples/verbose.rs。可以通过以下命令运行:cargo run --example verbose.

特性

  • autoinstall - 自动安装csgo文件夹中的gamestate_integration_NAME.cfg

许可

许可协议为Anti-Capitalist Software License版本1.4。

贡献

除非你明确声明,否则你提交的贡献也应受Anti-Capitalist Software License版本1.4的约束,没有任何额外的条款或条件。

依赖

~11–25MB
~322K SLoC