Skip to content

Commit

Permalink
Chinesization the character page
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxudong.mxudong committed May 31, 2022
1 parent 4caf9a4 commit 09bf348
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 100 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Borderlands 3 Save Editor

[Origin repo: https://github.com/ZakisM/bl3_save_edit](https://github.com/ZakisM/bl3_save_edit)

[中文版](./docs/README_ZHCN.md)

A tool to help you modify your Borderlands 3 Saves and Profiles.
Expand Down
83 changes: 43 additions & 40 deletions bl3_save_edit_ui/src/views/manage_save/character/ammo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ use crate::widgets::text_margin::TextMargin;
pub struct AmmoSetterField {
name: String,
text_margin: usize,
view_name: String,
pub ammo_pool: AmmoPool,
pub input: i32,
input_state: text_input::State,
#[derivative(
Debug = "ignore",
Default(value = "Rc::new(CharacterAmmoMessage::Grenade)")
Debug = "ignore",
Default(value = "Rc::new(CharacterAmmoMessage::Grenade)")
)]
on_changed: Rc<dyn Fn(i32) -> CharacterAmmoMessage>,
}

impl AmmoSetterField {
pub fn new<F>(text_margin: usize, ammo_pool: AmmoPool, on_changed: F) -> Self
where
F: 'static + Fn(i32) -> CharacterAmmoMessage,
pub fn new<F>(text_margin: usize, ammo_pool: AmmoPool, on_changed: F, vn: String) -> Self
where
F: 'static + Fn(i32) -> CharacterAmmoMessage,
{
AmmoSetterField {
view_name: vn,
name: ammo_pool.to_string(),
text_margin,
ammo_pool,
Expand All @@ -54,7 +56,7 @@ impl AmmoSetterField {

Row::new()
.push(
TextMargin::new(&self.name, self.text_margin)
TextMargin::new(&self.view_name, self.text_margin)
.0
.font(ST_HEI_TI_LIGHT)
.size(17)
Expand All @@ -76,21 +78,21 @@ impl AmmoSetterField {
)
},
)
.0
.width(Length::FillPortion(3))
.font(ST_HEI_TI_LIGHT)
.padding(10)
.size(17)
.style(Bl3UiStyle)
.into_element(),
format!("弹药数需要在 {} 和 {} 之间", minimum, maximum),
.0
.width(Length::FillPortion(3))
.font(ST_HEI_TI_LIGHT)
.padding(10)
.size(17)
.style(Bl3UiStyle)
.into_element(),
format!("弹药数必需在 {} 和 {} 之间", minimum, maximum),
tooltip::Position::Top,
)
.gap(10)
.padding(10)
.font(ST_HEI_TI_LIGHT)
.size(17)
.style(Bl3UiTooltipStyle),
.gap(10)
.padding(10)
.font(ST_HEI_TI_LIGHT)
.size(17)
.style(Bl3UiTooltipStyle),
)
.width(Length::Fill)
.align_items(Alignment::Center)
Expand All @@ -112,17 +114,18 @@ pub struct AmmoSetter {
impl std::default::Default for AmmoSetter {
fn default() -> Self {
Self {
sniper: AmmoSetterField::new(0, AmmoPool::Sniper, CharacterAmmoMessage::Sniper),
heavy: AmmoSetterField::new(4, AmmoPool::Heavy, CharacterAmmoMessage::Heavy),
shotgun: AmmoSetterField::new(0, AmmoPool::Shotgun, CharacterAmmoMessage::Shotgun),
grenade: AmmoSetterField::new(4, AmmoPool::Grenade, CharacterAmmoMessage::Grenade),
smg: AmmoSetterField::new(0, AmmoPool::Smg, CharacterAmmoMessage::Smg),
sniper: AmmoSetterField::new(0, AmmoPool::Sniper, CharacterAmmoMessage::Sniper, String::from("狙击枪")),
heavy: AmmoSetterField::new(4, AmmoPool::Heavy, CharacterAmmoMessage::Heavy, String::from("Heavy")),
shotgun: AmmoSetterField::new(0, AmmoPool::Shotgun, CharacterAmmoMessage::Shotgun, String::from("霰弹枪")),
grenade: AmmoSetterField::new(4, AmmoPool::Grenade, CharacterAmmoMessage::Grenade, String::from("手榴弹")),
smg: AmmoSetterField::new(0, AmmoPool::Smg, CharacterAmmoMessage::Smg, String::from("Smg")),
assault_rifle: AmmoSetterField::new(
4,
AmmoPool::Ar,
CharacterAmmoMessage::AssaultRifle,
String::from("步枪"),
),
pistol: AmmoSetterField::new(0, AmmoPool::Pistol, CharacterAmmoMessage::Pistol),
pistol: AmmoSetterField::new(0, AmmoPool::Pistol, CharacterAmmoMessage::Pistol, String::from("手枪")),
max_all_button_state: button::State::default(),
}
}
Expand All @@ -139,10 +142,10 @@ impl AmmoSetter {
.size(17)
.color(Color::from_rgb8(242, 203, 5)),
)
.padding(10)
.align_x(Horizontal::Center)
.width(Length::Fill)
.style(Bl3UiStyle),
.padding(10)
.align_x(Horizontal::Center)
.width(Length::Fill)
.style(Bl3UiStyle),
)
.push(
Container::new(
Expand Down Expand Up @@ -171,22 +174,22 @@ impl AmmoSetter {
.font(ST_HEI_TI_LIGHT)
.size(17),
)
.on_press(InteractionMessage::ManageSaveInteraction(
ManageSaveInteractionMessage::Character(
SaveCharacterInteractionMessage::MaxAmmoAmountsPressed,
),
))
.padding(10)
.style(Bl3UiStyle)
.into_element(),
.on_press(InteractionMessage::ManageSaveInteraction(
ManageSaveInteractionMessage::Character(
SaveCharacterInteractionMessage::MaxAmmoAmountsPressed,
),
))
.padding(10)
.style(Bl3UiStyle)
.into_element(),
)
.padding(5),
.padding(5),
)
.align_items(Alignment::Center)
.spacing(15),
)
.padding(20)
.style(Bl3UiStyle),
.padding(20)
.style(Bl3UiStyle),
),
)
}
Expand Down
18 changes: 9 additions & 9 deletions bl3_save_edit_ui/src/views/manage_save/character/gear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,26 @@ pub struct GearUnlocker {
impl std::default::Default for GearUnlocker {
fn default() -> Self {
Self {
grenade: GearUnlockCheckbox::new("Grenade", CharacterGearUnlockedMessage::Grenade),
shield: GearUnlockCheckbox::new("Shield", CharacterGearUnlockedMessage::Shield),
grenade: GearUnlockCheckbox::new("手榴弹", CharacterGearUnlockedMessage::Grenade),
shield: GearUnlockCheckbox::new("盾牌", CharacterGearUnlockedMessage::Shield),
weapon_1: GearUnlockCheckbox::new(
"Weapon Slot 1",
"武器槽 1",
CharacterGearUnlockedMessage::Weapon1,
),
weapon_2: GearUnlockCheckbox::new(
"Weapon Slot 2",
"武器槽 2",
CharacterGearUnlockedMessage::Weapon2,
),
weapon_3: GearUnlockCheckbox::new(
"Weapon Slot 3",
"武器槽 3",
CharacterGearUnlockedMessage::Weapon3,
),
weapon_4: GearUnlockCheckbox::new(
"Weapon Slot 4",
"武器槽 4",
CharacterGearUnlockedMessage::Weapon4,
),
artifact: GearUnlockCheckbox::new("Artifact", CharacterGearUnlockedMessage::Artifact),
class_mod: GearUnlockCheckbox::new("Class Mod", CharacterGearUnlockedMessage::ClassMod),
artifact: GearUnlockCheckbox::new("神器", CharacterGearUnlockedMessage::Artifact),
class_mod: GearUnlockCheckbox::new("模组", CharacterGearUnlockedMessage::ClassMod),
}
}
}
Expand All @@ -104,7 +104,7 @@ impl GearUnlocker {
Column::new()
.push(
Container::new(
Text::new("Gear Management")
Text::new("背包管理")
.font(ST_HEI_TI_LIGHT)
.size(17)
.color(Color::from_rgb8(242, 203, 5)),
Expand Down
2 changes: 1 addition & 1 deletion bl3_save_edit_ui/src/views/manage_save/character/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn view(character_state: &mut CharacterState) -> Container<Bl3Message> {
Length::Units(75),
TextInputLimited::new(
&mut character_state.name_input_state,
"FL4K, 赞恩",
"FL4K,赞恩,阿玛拉,莫泽",
&character_state.name_input,
500,
|c| {
Expand Down
87 changes: 45 additions & 42 deletions bl3_save_edit_ui/src/views/manage_save/character/sdu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@ use crate::widgets::text_margin::TextMargin;
#[derivative(Debug, Default)]
pub struct SduUnlockField {
name: String,
view_name: String,
text_margin: usize,
pub sdu_slot: SaveSduSlot,
pub input: i32,
input_state: text_input::State,
#[derivative(
Debug = "ignore",
Default(value = "Rc::new(CharacterSduMessage::Backpack)")
Debug = "ignore",
Default(value = "Rc::new(CharacterSduMessage::Backpack)")
)]
on_changed: Rc<dyn Fn(i32) -> CharacterSduMessage>,
}

impl SduUnlockField {
pub fn new<F>(text_margin: usize, sdu_slot: SaveSduSlot, on_changed: F) -> Self
where
F: 'static + Fn(i32) -> CharacterSduMessage,
pub fn new<F>(text_margin: usize, sdu_slot: SaveSduSlot, on_changed: F, vn: String) -> Self
where
F: 'static + Fn(i32) -> CharacterSduMessage,
{
SduUnlockField {
view_name: vn,
name: sdu_slot.to_string(),
text_margin,
sdu_slot,
Expand All @@ -54,7 +56,7 @@ impl SduUnlockField {

Row::new()
.push(
TextMargin::new(&self.name, self.text_margin)
TextMargin::new(&self.view_name, self.text_margin)
.0
.font(ST_HEI_TI_LIGHT)
.size(17)
Expand All @@ -76,21 +78,21 @@ impl SduUnlockField {
)
},
)
.0
.width(Length::FillPortion(3))
.font(ST_HEI_TI_LIGHT)
.padding(10)
.size(17)
.style(Bl3UiStyle)
.into_element(),
.0
.width(Length::FillPortion(3))
.font(ST_HEI_TI_LIGHT)
.padding(10)
.size(17)
.style(Bl3UiStyle)
.into_element(),
format!("等级必须在 {} 和 {} 之间", minimum, maximum),
tooltip::Position::Top,
)
.gap(10)
.padding(10)
.font(ST_HEI_TI_LIGHT)
.size(17)
.style(Bl3UiTooltipStyle),
.gap(10)
.padding(10)
.font(ST_HEI_TI_LIGHT)
.size(17)
.style(Bl3UiTooltipStyle),
)
.width(Length::Fill)
.align_items(Alignment::Center)
Expand All @@ -113,18 +115,19 @@ pub struct SduUnlocker {
impl std::default::Default for SduUnlocker {
fn default() -> Self {
Self {
backpack: SduUnlockField::new(0, SaveSduSlot::Backpack, CharacterSduMessage::Backpack),
sniper: SduUnlockField::new(4, SaveSduSlot::Sniper, CharacterSduMessage::Sniper),
heavy: SduUnlockField::new(0, SaveSduSlot::Heavy, CharacterSduMessage::Heavy),
shotgun: SduUnlockField::new(4, SaveSduSlot::Shotgun, CharacterSduMessage::Shotgun),
grenade: SduUnlockField::new(0, SaveSduSlot::Grenade, CharacterSduMessage::Grenade),
smg: SduUnlockField::new(4, SaveSduSlot::Smg, CharacterSduMessage::Smg),
backpack: SduUnlockField::new(0, SaveSduSlot::Backpack, CharacterSduMessage::Backpack, String::from("背包")),
sniper: SduUnlockField::new(4, SaveSduSlot::Sniper, CharacterSduMessage::Sniper, String::from("狙击枪")),
heavy: SduUnlockField::new(0, SaveSduSlot::Heavy, CharacterSduMessage::Heavy, String::from("Heavy")),
shotgun: SduUnlockField::new(4, SaveSduSlot::Shotgun, CharacterSduMessage::Shotgun, String::from("霰弹枪")),
grenade: SduUnlockField::new(0, SaveSduSlot::Grenade, CharacterSduMessage::Grenade, String::from("手榴弹")),
smg: SduUnlockField::new(4, SaveSduSlot::Smg, CharacterSduMessage::Smg, String::from("smg")),
assault_rifle: SduUnlockField::new(
0,
SaveSduSlot::Ar,
CharacterSduMessage::AssaultRifle,
String::from("步枪"),
),
pistol: SduUnlockField::new(4, SaveSduSlot::Pistol, CharacterSduMessage::Pistol),
pistol: SduUnlockField::new(4, SaveSduSlot::Pistol, CharacterSduMessage::Pistol, String::from("手枪")),
unlock_all_button_state: button::State::default(),
}
}
Expand All @@ -136,15 +139,15 @@ impl SduUnlocker {
Column::new()
.push(
Container::new(
Text::new("SDU Management")
Text::new("弹药升级管理")
.font(ST_HEI_TI_LIGHT)
.size(17)
.color(Color::from_rgb8(242, 203, 5)),
)
.padding(10)
.align_x(Horizontal::Center)
.width(Length::Fill)
.style(Bl3UiStyle),
.padding(10)
.align_x(Horizontal::Center)
.width(Length::Fill)
.style(Bl3UiStyle),
)
.push(
Container::new(
Expand All @@ -165,26 +168,26 @@ impl SduUnlocker {
Container::new(
Button::new(
&mut self.unlock_all_button_state,
Text::new("Max All SDU Levels")
Text::new("将所有升级置为最高")
.font(ST_HEI_TI_LIGHT)
.size(17),
)
.on_press(InteractionMessage::ManageSaveInteraction(
ManageSaveInteractionMessage::Character(
SaveCharacterInteractionMessage::MaxSduSlotsPressed,
),
))
.padding(10)
.style(Bl3UiStyle)
.into_element(),
.on_press(InteractionMessage::ManageSaveInteraction(
ManageSaveInteractionMessage::Character(
SaveCharacterInteractionMessage::MaxSduSlotsPressed,
),
))
.padding(10)
.style(Bl3UiStyle)
.into_element(),
)
.padding(5),
.padding(5),
)
.align_items(Alignment::Center)
.spacing(15),
)
.padding(20)
.style(Bl3UiStyle),
.padding(20)
.style(Bl3UiStyle),
),
)
}
Expand Down
Loading

0 comments on commit 09bf348

Please sign in to comment.