雑用担当の備忘録

技術的な話のみになります。翻訳データそのものはありません。 カテゴリ>その他>注意事項を必ず参照してください

カテゴリ: 解析

Localization data:

LocalizationUtils にてロードしているのでキャストしている LocalizationTagBundle に注目する。
LocalizationTagBundle は単なる LocalizationTag のコンテナなので LocalizationTag に注目する。

public class LocalizationTag
{
    public int m_Id;
    public string m_Tag;
    public string m_E; // english
    public string m_F;   // french
    public string m_I;    // Italian
    public string m_G;  // German
    public string m_S;  // Spanish
    public string m_P;  // Portuguese
}

なのでこれっぽい。コンテナの方の LocalizationTagBundle で GameObjectID を検索する。
GameObjectID = 1780

resource.assets の MonoBehaviour (type:114) で 1780 にマッチするデータを抽出すると拡張子 -20 のデータだとわかる。(現時点のバージョン。この部分は更新により変動があります。)
-20 の中身を見ると、LocalizationTag があるのがわかります。
文字コードは UTF-8
で上記の情報より編集しやすいようにバイナリ<>テキストツールを作成するとよい。

オリジナル
SotD_01
Localization data 書き換え後
SotD_01e
オリジナル
SotD_02
Localization data 書き換え後
SotD_02e
オリジナル
SotD_03
Localization data 書き換え後
SotD_03e

はい、文字化けしています(表示されていない)。
bitmap フォントを使用しているのですがこれを dynamic フォントに変換すると正常に表示されるようになります。
フォントの話は次回

SotD_01
概要:
  • Unity 5.3.4p5
  • Localization data: resources.assets (LocalizationTagBundle, LocalizationTag)
  • Font: bitmap, sharedassets0.assets

SotD_01j

a147

lblActivateInGame
01876.1 → 0x754
file name: level1_00503.-15
mTrueTypeFont: 0x1984 → font_body.ttf
mFont: 0xA9AE → resources_00002.-15 (UIFont: AgencyB_32p)

lblTooltipLine
00612.1 → 0x264
file name: level1_00167.-15
mTrueTypeFont: 0x0 → null
mFont: 0xA9AE → resources_00002.-15 (UIFont: AgencyB_32p)

lblStealthIndicator
00045.1 → 0x2D
file name: level1_00009.-15
mTrueTypeFont: 0x0 → null
mFont: 0xA9AE → resources_00002.-15 (UIFont: AgencyB_32p)

lblCriticalHitText
00520.1 → 0x208
file name: level1_00143.-15
mTrueTypeFont: 0x0 → null
mFont: 0xA9AE → resources_00002.-15 (UIFont: AgencyB_32p)

a146 との違いは lblActivateInGame のファイル名が変更になったのと mTrueTypeFont の font_body.ttf の値が変わっているので注意する。

何のこと?という感じだろうからこの辺りの解析を自動化してパッチをあてるツールを作成しました。
こちら
pass:zt

動作確認は a147 ですけど、自動解析するので多少のバージョンアップには耐えれると思います。
 
追記: a15e でも動作しているっぽい。この調子だと何もいじらずに a15 でも行けそうな感じですなー
a15正式版でも大丈夫です。

Par〇d〇x の S〇〇〇〇〇〇〇〇 を解析してた時の話で主題は DDS の見方について
(Sのフォントは BitMap フォントで BMFont 出力しただけで使えるというお手軽な構成です。)

オリジナルの DDS を見ます
PS01
0xC: height (画像の高さ)
0x10: width (画像の幅)
そして
0x50: PfFlags = 0x41
ここをまず見ます
DDPF_RGB: 0x00000040
DDPF_ALPHAPIXELS: 0x00000001
より ARGB フォーマットだと判明します。

0x58: RGBBitCount = 0x20(32)
したがってARGB32になる。
この時点ではARGBなのかRGBAなのか等はまだ確定してない。

つぎに
0x5C: RBitMask
0x60: GBitMask
0x64: BBitMask
0x68: AlphaBitMask
を見る。Little endian に注意
ここより ARGB が確定する。

0x80: ここからが実際の pixel データになる。ARGB32 になっています。

今後の version up 対応もあるし難解かもしれませんが書いておきます。
NGUI の部分は変わらないと思うので記述する部分はそう変わらないと思います。

UIlLabel ( : UIWidget : UIRect)
7D2D_04_01
lblActivateInGame
UILabel

UIRect 部分
7D2D_04_02
public abstract class UIRect : MonoBehaviour
{
    public AnchorPoint leftAnchor;
    public AnchorPoint rightAnchor;
    public AnchorPoint bottomAnchor;
    public AnchorPoint topAnchor;
    public AnchorUpdate updateAnchors;
}
public class AnchorPoint
{
    public Transform target;
    public float relative;
    public int absolute;
}
より
leftAnchor.target = null;
leftAnchor.relative = 0f;
leftAnchor.absolute = 0;
rightAnchor.target = null;
rightAnchor.relative = 1f;
rightAnchor.absolute = 0;
bottomAnchor.target = null;
bottomAnchor.relative = 0f;
bottomAnchor.absolute = 0;
topAnchor.target = null;
topAnchor.relative = 1f;
topAnchor.absolute = 0;
updateAnchors = AnchorUpdate.OnUpdate

UIWidget 部分
7D2D_04_03
public class UIWidget : UIRect
{
    protected Color mColor;
    protected Pivot mPivot;
    protected int mWidth;
    protected int mHeight;
    protected int mDepth;
    public bool autoResizeBoxCollider;
    public bool hideIfOffScreen;
    public AspectRatioSource keepAspectRatio;
    public float aspectRatio;
}
より
mColor = Color.white;
mPivot = Pivot.Center;
mWidth = 114;
mHeight = 30;
mDepth = -20;
autoResizeBoxCollider = false;
hideIfOffScreen = false;
keepAspectRatio = AspectRatioSource.Free;
aspectRatio = 3.736842

UILabel 部分
7D2D_04_04
public class UILabel : UIWidget
{
    public Crispness keepCrispWhenShrunk;
    Font mTrueTypeFont;
    UIFont mFont;
    string mText;
    int mFontSize;
    FontStyle mFontStyle;
    Alignment mAlignment;
    bool mEncoding;
    int mMaxLineCount;
    Effect mEffectStyle;
    Color mEffectColor;
    NGUIText.SymbolStyle mSymbols;
    Vector2 mEffectDistance;
    Overflow mOverflow;
    Material mMaterial;
    bool mApplyGradient;
    Color mGradientTop;
    Color mGradientBottom;
    int mSpacingX;
    int mSpacingY;
    bool mUseFloatSpacing;
    float mFloatSpacingX;
    float mFloatSpacingY;
    bool mOverflowEllipsis;
    int mOverflowWidth;
}
より
keepCrispWhenShrunk = Crispness.OnDesktop;
mTrueTypeFont = font_body.ttf;
mFont = resources_00002.-15; (UIFont)
mText = "Pick up Item";
mFontSize = 36;
mFontStyle = FontStyle.Normal;
mAlignment = Alignment.Automatic;
mEncoding = true;
mMaxLineCount = 0;
mEffectStyle = Effect.Outline;
mEffectColor = Color.black;
mSymbols = NGUIText.SymbolStyle.Normal;
mEffectDistance = Vector2.one;
mOverflow = Overflow.ResizeFreely;
mMaterial = null;
mApplyGradient = false;
mGradientTop = Color.white;
mGradientBottom = Color(0.7f, 0.7f, 0.7f);
mSpacingX = 0;
mSpacingY = 0;
mUseFloatSpacing = false;
mFloatSpacingX = 0;
mFloatSpacingY = 0;
mOverflowEllipsis = false;
mOverflowWidth = 1;

となる。
今回いじっているのは UILabel.mTrueTypeFont と UILabel.mFont なのでこのアドレスが理解できると良いです。

↑このページのトップヘ