#bevy-plugin #ios #bevy #swift #mobile #gamedev

bevy_ios_alerts

Bevy插件,用于请求iOS原生UIAlert弹出窗口

5个版本

0.2.0 2024年7月10日
0.1.3 2024年5月11日
0.1.2 2024年4月17日
0.1.1 2024年4月17日
0.1.0 2024年4月17日

游戏开发类别中排名第1032

Download history 352/week @ 2024-04-15 38/week @ 2024-04-22 25/week @ 2024-04-29 284/week @ 2024-05-06 33/week @ 2024-05-13 95/week @ 2024-05-20 1/week @ 2024-05-27 71/week @ 2024-06-03 12/week @ 2024-06-10 37/week @ 2024-06-17 1/week @ 2024-06-24 131/week @ 2024-07-08 3/week @ 2024-07-15 45/week @ 2024-07-29

每月下载量:179次

MIT许可

10KB
192行代码(不包括注释)

bevy_ios_alerts

crates.io

Rust存储库和Swift包,可轻松将iOS的原生UIAlerts API集成到Bevy应用程序中。

demo

该存储库在我们的游戏中使用示例: zoolitaire.com

另请参阅 bevy_ios_iapbevy_ios_notificationsbevy_ios_gamecenterbevy_ios_review 以及 bevy_ios_impact

说明

  1. 添加到XCode:添加SPM(Swift包管理器)依赖
  2. 添加Rust依赖
  3. 设置插件

1. 添加到XCode

转到 文件 -> 添加包依赖 并将 https://github.com/rustunit/bevy_ios_alerts.git 粘贴到右上角的搜索栏中: xcode

2. 添加Rust依赖

cargo add bevy_ios_alerts

bevy_ios_alerts = { version = "0.2" }

3. 设置插件

初始化Bevy插件

app.add_plugins(bevy_ios_alerts::IosAlertsPlugin);

在您的应用程序代码中触发警报

fn system_triggerin_alerts(mut events: EventWriter<IosAlert>) {
     
    events.send(IosAlert::Message {
        title: String::from("title"),
        msg: String::from("msg"),
        button: String::from("ok"),
    });
     
    events.send(IosAlert::Dialog {
        title: String::from("title"),
        msg: String::from("this is a dialog with multiple buttons"),
        button_yes: String::from("absolutely yes"),
        button_no: String::from("no no no"),
    });
                    
    events.send(IosAlert::Input {
        title: String::from("title"),
        msg: String::from("input box"),
        button: String::from("ok"),
        placeholder: String::from("placeholder"),
    });
}

fn process_alert_response(mut events: EventReader<IosAlertResponse>) {
    for e in events.read() {
        info!("incoming alert response: {e:?}");
    }
}

Bevy版本支持

bevy bevy_ios_alerts
0.14 0.2,main
0.13 0.1

许可

本仓库中的所有代码均受以下任一许可的双重许可

您可以选择其中一种。这意味着您可以选择您偏好的许可。

您的贡献

除非您明确表示,否则任何有意提交以包含在本作品中的贡献,根据Apache-2.0许可证的定义,应如上所述双重许可,而不附加任何其他条款或条件。

依赖关系

~23MB
~411K SLoC