Skip to content

Commit

Permalink
implement font size changing for select ui elements
Browse files Browse the repository at this point in the history
  • Loading branch information
wchristian committed Jul 25, 2019
1 parent 794c010 commit 17af20f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 8 deletions.
4 changes: 2 additions & 2 deletions kc.po
Original file line number Diff line number Diff line change
Expand Up @@ -35382,7 +35382,7 @@ msgstr "Admiral Cmds"
# button explainer popup main screen
msgctxt "level4_00110.-15|-1"
msgid "提督コマンド"
msgstr "Admiral Cmds"
msgstr "----------"

# left hand admiral commands popup menu title
msgctxt "level4_00210.-15|-1"
Expand Down Expand Up @@ -35441,7 +35441,7 @@ msgstr "----------"
# button explainer popup main screen from office
msgctxt "sharedassets5_01354.-4|-1"
msgid "提督コマンド"
msgstr "Admiral Cmds"
msgstr "----------"

msgctxt "Assembly-CSharp.dll|4595039"
msgid "提督レベル:"
Expand Down
17 changes: 11 additions & 6 deletions label.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ use strictures 2;
use parent 'Parse::Binary';
use parsehelper qw' string ';
use constant FORMAT => (
magic => 'a136',
width => 'L',
height => 'L',
eh => 'a48',
text => string(),
tail => 'a*',
magic => 'a136',
width => 'L',
height => 'L',
eh => 'a48',
text => string(),
font_size => 'L',
font_style => 'L',
eh2 => 'a116',
shrink_to_fit => 'L',
eh3 => 'a12',
multi_line => 'L',
);
1;
42 changes: 42 additions & 0 deletions labelprop_mods.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/level4/level4_00110.-15" :
{ "font_size" : 15 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_01354.-4" :
{ "font_size" : 15 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00900.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00948.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00762.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00672.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00886.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00725.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00835.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00061.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00636.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00171.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_01051.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00802.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00178.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00264.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00688.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00987.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00983.-4" :
{ "font_size" : 10 },
"../kc_original_unpack/repatch/PCSG00684/Media/Unity_Assets_Files/sharedassets5/sharedassets5_00533.-4" :
{ "font_size" : 10 }
}
20 changes: 20 additions & 0 deletions translate_utf8_binary.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ =head1 DESCRIPTION
my $carriagereturn_file = "carriagereturn.cache";
my $jp_qr = qr/[\p{Hiragana}\p{Katakana}\p{Han}]/;
my $generic_ctxt = "███ generic translation ███";
my $label_prop_file = "labelprops.cache";
my $label_properties;
my $label_prop_mods;
my $label_prop_mods_file = "labelprop_mods.cache";

run();

Expand Down Expand Up @@ -433,6 +437,18 @@ sub presetdeck_meths {
sub value_pairs_for_type {
my ( $type, $file ) = @_;
my $obj = $file->{obj} ||= $type->new( $file->{file} );
if ( $type eq "label" ) {
my @props = qw( width height font_size font_style text shrink_to_fit multi_line );
$label_properties->{ $file->{file} } ||= { map +( $_, $_ eq "text" ? decode "UTF-8", $obj->$_ : $obj->$_ ), @props };
if ( $label_prop_mods->{ $file->{file} } ) {
for my $prop (@props) {
next unless #
my $val = $label_prop_mods->{ $file->{file} }{$prop};
$obj->${ \"Set$prop" }($val);
store_file_as_modded $file, 1, $file->{obj}->dump;
}
}
}
return
$type eq "motionlist" ? map [ name => $_ ], $obj->field_children("motionship")
: $type eq "presetdata" ? map [ "preset_${_}_name" => $obj ], 1 .. $obj->obj_count
Expand Down Expand Up @@ -812,6 +828,8 @@ sub run {
duplicate_check;
my %tr = binary_translations->data;
delete $_->{tr} for values %tr;
$label_properties = { load_cache $label_prop_file};
$label_prop_mods = { load_cache $label_prop_mods_file};

say "loading po file";
my ( $pofile, $unused_ctxt_marker ) = qw( kc.po ---------- );
Expand Down Expand Up @@ -1040,6 +1058,8 @@ sub run {
$po_contents =~ s/\r?\n$//;
io($pofile)->print($po_contents);

store_cache $label_prop_file, $label_properties;

say "preparing reports";
my @maybe = map sprintf( " %-" . ( 30 - length $_ ) . "s %-30s hit x %3s, nomatch x %3s, match x %3s", $_, $tr{$_}{ctxt_tr}{""}, $hit{$_}, $unmatched{$_}, $hit{$_} - $unmatched{$_} ),
reverse sort { length $a <=> length $b } sort keys %unmatched;
Expand Down

0 comments on commit 17af20f

Please sign in to comment.