mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-05-06 06:14:29 +00:00
localize difficulty name in save menu (#263)
This commit is contained in:
parent
1f288e2a39
commit
08f086bfc4
|
@ -40,7 +40,9 @@
|
||||||
"title": "Select Difficulty",
|
"title": "Select Difficulty",
|
||||||
"easy": "Easy",
|
"easy": "Easy",
|
||||||
"normal": "Normal",
|
"normal": "Normal",
|
||||||
"hard": "Hard"
|
"hard": "Hard",
|
||||||
|
"difficulty_name": "Difficulty: {difficulty}",
|
||||||
|
"unknown": "(unknown)"
|
||||||
},
|
},
|
||||||
"coop_menu": {
|
"coop_menu": {
|
||||||
"title": "Select Number of Players",
|
"title": "Select Number of Players",
|
||||||
|
|
|
@ -40,7 +40,9 @@
|
||||||
"title": "難易度選択",
|
"title": "難易度選択",
|
||||||
"easy": "簡単",
|
"easy": "簡単",
|
||||||
"normal": "普通",
|
"normal": "普通",
|
||||||
"hard": "難しい"
|
"hard": "難しい",
|
||||||
|
"difficulty_name": "難易度: {difficulty}",
|
||||||
|
"unknown": "(未知)"
|
||||||
},
|
},
|
||||||
"coop_menu": {
|
"coop_menu": {
|
||||||
"title": "プレイヤー数を選択",
|
"title": "プレイヤー数を選択",
|
||||||
|
|
|
@ -17,11 +17,7 @@ impl Default for Locale {
|
||||||
Locale {
|
Locale {
|
||||||
code: "en".to_owned(),
|
code: "en".to_owned(),
|
||||||
name: "English".to_owned(),
|
name: "English".to_owned(),
|
||||||
font: FontData {
|
font: FontData { path: String::new(), scale: 1.0, space_offset: 0.0 },
|
||||||
path: String::new(),
|
|
||||||
scale: 1.0,
|
|
||||||
space_offset: 0.0
|
|
||||||
},
|
|
||||||
strings: HashMap::new(),
|
strings: HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +61,7 @@ impl Locale {
|
||||||
strings
|
strings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// if the key does not exists, return the origin key instead
|
||||||
pub fn t<'a: 'b, 'b>(&'a self, key: &'b str) -> &'b str {
|
pub fn t<'a: 'b, 'b>(&'a self, key: &'b str) -> &'b str {
|
||||||
if let Some(str) = self.strings.get(key) {
|
if let Some(str) = self.strings.get(key) {
|
||||||
str
|
str
|
||||||
|
|
|
@ -597,20 +597,18 @@ impl<T: std::cmp::PartialEq + std::default::Default + Clone> Menu<T> {
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
{
|
{
|
||||||
state
|
state.font.builder().x(self.x as f32 - 25.0).y(y).shadow(true).draw(
|
||||||
.font
|
"<",
|
||||||
.builder()
|
ctx,
|
||||||
.x(self.x as f32 - 25.0)
|
&state.constants,
|
||||||
.y(y)
|
&mut state.texture_set,
|
||||||
.shadow(true)
|
)?;
|
||||||
.draw("<", ctx, &state.constants, &mut state.texture_set)?;
|
state.font.builder().x((self.x + self.width as isize) as f32 + 15.0).y(y).shadow(true).draw(
|
||||||
state
|
">",
|
||||||
.font
|
ctx,
|
||||||
.builder()
|
&state.constants,
|
||||||
.x((self.x + self.width as isize) as f32 + 15.0)
|
&mut state.texture_set,
|
||||||
.y(y)
|
)?;
|
||||||
.shadow(true)
|
|
||||||
.draw(">", ctx, &state.constants, &mut state.texture_set)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuEntry::NewSave => {
|
MenuEntry::NewSave => {
|
||||||
|
@ -677,17 +675,17 @@ impl<T: std::cmp::PartialEq + std::default::Default + Clone> Menu<T> {
|
||||||
);
|
);
|
||||||
batch.draw(ctx)?;
|
batch.draw(ctx)?;
|
||||||
} else {
|
} else {
|
||||||
let mut difficulty_name: String = "Difficulty: ".to_owned();
|
let difficulty = match save.difficulty {
|
||||||
|
0 => state.loc.t("menus.difficulty_menu.normal"),
|
||||||
match save.difficulty {
|
2 => state.loc.t("menus.difficulty_menu.easy"),
|
||||||
0 => difficulty_name.push_str("Normal"),
|
4 => state.loc.t("menus.difficulty_menu.hard"),
|
||||||
2 => difficulty_name.push_str("Easy"),
|
_ => state.loc.t("menus.difficulty_menu.unknown"),
|
||||||
4 => difficulty_name.push_str("Hard"),
|
};
|
||||||
_ => difficulty_name.push_str("(unknown)"),
|
let difficulty_name =
|
||||||
}
|
state.loc.tt("menus.difficulty_menu.difficulty_name", &[("difficulty", &difficulty)]);
|
||||||
|
|
||||||
state.font.builder().position(self.x as f32 + 20.0, y + 10.0).draw(
|
state.font.builder().position(self.x as f32 + 20.0, y + 10.0).draw(
|
||||||
difficulty_name.as_str(),
|
&difficulty_name,
|
||||||
ctx,
|
ctx,
|
||||||
&state.constants,
|
&state.constants,
|
||||||
&mut state.texture_set,
|
&mut state.texture_set,
|
||||||
|
@ -770,11 +768,7 @@ impl<T: std::cmp::PartialEq + std::default::Default + Clone> Menu<T> {
|
||||||
state: &mut SharedGameState,
|
state: &mut SharedGameState,
|
||||||
) -> MenuSelectionResult<T> {
|
) -> MenuSelectionResult<T> {
|
||||||
// the engine does 4 times more ticks during cutscene skipping
|
// the engine does 4 times more ticks during cutscene skipping
|
||||||
let max_anim_wait = if state.textscript_vm.flags.cutscene_skip() {
|
let max_anim_wait = if state.textscript_vm.flags.cutscene_skip() { 32 } else { 8 };
|
||||||
32
|
|
||||||
} else {
|
|
||||||
8
|
|
||||||
};
|
|
||||||
|
|
||||||
self.anim_wait += 1;
|
self.anim_wait += 1;
|
||||||
if self.anim_wait > max_anim_wait {
|
if self.anim_wait > max_anim_wait {
|
||||||
|
|
Loading…
Reference in a new issue