From 59b4165136f6fb4bf53ba71de627f7bf1bde1c89 Mon Sep 17 00:00:00 2001 From: Jan Hohenheim Date: Thu, 16 Feb 2023 19:59:26 +0100 Subject: [PATCH 1/6] Implement dialog appear one letter at a time --- Cargo.lock | 7 +++++ Cargo.toml | 1 + src/world_interaction/dialog.rs | 51 ++++++++++++++++++++++++--------- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5cd3e862..c0101592 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2001,6 +2001,7 @@ dependencies = [ "serde", "strum", "strum_macros", + "unicode-segmentation", "winit", ] @@ -4137,6 +4138,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.10" diff --git a/Cargo.toml b/Cargo.toml index 56745350..2cc5d3af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,7 @@ polyanya = "0.2.0" bevy_pathmesh = "0.3.0" bitflags = "1.3.2" iyes_progress = "0.7.1" +unicode-segmentation = "1.10.1" # keep the following in sync with Bevy's dependencies winit = { version = "0.27", default-features = false } diff --git a/src/world_interaction/dialog.rs b/src/world_interaction/dialog.rs index 960d0a97..d9d66ee3 100644 --- a/src/world_interaction/dialog.rs +++ b/src/world_interaction/dialog.rs @@ -11,6 +11,7 @@ use bevy::prelude::*; use bevy_egui::egui::Color32; use bevy_egui::{egui, EguiContext, EguiPlugin}; use serde::{Deserialize, Serialize}; +use unicode_segmentation::UnicodeSegmentation; mod resources; @@ -93,13 +94,27 @@ fn show_dialog( mut egui_context: ResMut, mut actions_frozen: ResMut, actions: Res, + time: Res