hgame 0.26.4

CG production management structs, e.g. of assets, personnels, progress, etc.
Documentation
#[allow(unused_imports)]
use super::*;

#[derive(PartialEq, Debug, Clone, Default, strum::AsRefStr, strum::EnumIter)]
#[cfg_attr(feature = "mongo", derive(Serialize, Deserialize))]
pub enum Locale {
    #[default]
    EN,
    VI,
    ZH,
    FR,
}

impl From<&str> for Locale {
    fn from(locale: &str) -> Self {
        match locale {
            "EN" => Self::EN,
            "VI" => Self::VI,
            "ZH" => Self::ZH,
            "FR" => Self::FR,
            _ => Self::default(),
        }
    }
}

#[cfg(feature = "gui")]
/// Locale option radio buttons with simple mut argument.
pub fn locale_options_ui(ui: &mut egui::Ui, locale: &mut Locale) {
    if let Ok(settings) = ClientCfgCel::settings() {
        ui.horizontal(|ui| {
            ui.label("Language:");
            for l in Locale::iter() {
                if settings.locales().contains(&l.as_ref().to_string()) {
                    ui.radio_value(locale, l.clone(), l.as_ref());
                };
            }
        });
    };
}

// pub fn locale_options_callback_ui(
//     ui: &mut egui::Ui,
//     locale: &mut Locale,
//     callback: impl Fn(Locale),
// ) {
//     if let Ok(settings) = ClientCfgCel::settings() {
//         ui.horizontal(|ui| {
//             for l in Locale::iter() {
//                 if settings.locales().contains(&l.as_ref().to_owned()) {
//                     if ui
//                         .add(egui::RadioButton::new(*locale == l, locale.as_ref()))
//                         .clicked()
//                     {
//                         callback(l);
//                     };
//                 };
//             }
//         });
//     };
// }

#[cfg(feature = "easy_mark")]
pub const EASYMARK_SYNTAX_HELP: &str = "
EasyMark Syntax:

# header
*bold*
_underline_
/italics/
~strikethrough~
^raised^
$small$
--- horizontal line
`code`
- bullet list
1. numbered list
> quote
[hyperlink](https://hunter.rusty)
";

#[cfg(all(feature = "easy_mark", feature = "gui"))]
pub fn easy_mark_syntax_help(ui: &mut egui::Ui) {
    ui.monospace("🔰 Help").on_hover_text(EASYMARK_SYNTAX_HELP);
}