Skip to content

Commit

Permalink
Merge branch 'head_unity2019'
Browse files Browse the repository at this point in the history
  • Loading branch information
whiteflare committed Feb 4, 2023
2 parents 2a415e8 + 0e2e098 commit 6c0f112
Show file tree
Hide file tree
Showing 213 changed files with 24,799 additions and 5,717 deletions.
65 changes: 40 additions & 25 deletions Editor/WF_Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,48 +1202,63 @@ internal static class WFI18N

public static string Translate(string before)
{
before = before ?? "";
TryTranslate(null, before, out var after);
return after;
}

var current = GetDict();
if (current == null || current.Count == 0)
{
return before; // 無いなら変換しない
}
public static string Translate(string label, string before)
{
TryTranslate(label, before, out var after);
return after;
}

// ラベルなしでテキストが一致するものを検索する
if (current.TryGetValue(before, out var list))
{
var after = list.Where(t => t.HasNoTag()).Select(t => t.After).FirstOrDefault();
if (after != null)
{
return after;
}
}
// マッチするものがないなら変換しない
return before;
public static bool TryTranslate(string before, out string after)
{
return TryTranslate(null, before, out after);
}

public static string Translate(string label, string before)
public static bool TryTranslate(string label, string before, out string after)
{
before = before ?? "";
if (string.IsNullOrWhiteSpace(before))
{
// 空白のときは空文字にして変換失敗とする
after = "";
return false;
}

var current = GetDict();
if (current == null || current.Count == 0)
{
return before; // 無いなら変換しない
after = before; // 無いなら変換しない
return false;
}

// テキストと一致する変換のなかからラベルも一致するものを翻訳にする
if (current.TryGetValue(before, out var list))
{
var after = list.Where(t => t.ContainsTag(label)).Select(t => t.After).FirstOrDefault();
if (after != null)
string text;
// テキストと一致する変換のなかからラベルも一致するものを翻訳にする
if (!string.IsNullOrWhiteSpace(label))
{
return after;
text = list.Where(t => t.ContainsTag(label)).Select(t => t.After).FirstOrDefault();
if (text != null)
{
after = text;
return true;
}
}

// ラベルなしでテキストが一致するものを検索する
text = list.Where(t => t.HasNoTag()).Select(t => t.After).FirstOrDefault();
if (text != null)
{
after = text;
return true;
}
}

// マッチするものがないなら変換しない
return before;
after = before;
return false;
}

private static string SplitAndTranslate(string before)
Expand Down
34 changes: 34 additions & 0 deletions Editor/WF_Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ internal static class WFShaderDictionary
// ================

new WFShaderName("BRP", "Water", "Surface", "Opaque", "UnlitWF/WF_Water_Surface_Opaque", represent: true),
new WFShaderName("BRP", "Water", "Surface", "TransCutout", "UnlitWF/WF_Water_Surface_TransCutout"),
new WFShaderName("BRP", "Water", "Surface", "Transparent", "UnlitWF/WF_Water_Surface_Transparent"),
new WFShaderName("BRP", "Water", "Surface", "Transparent_Refracted", "UnlitWF/WF_Water_Surface_Transparent_Refracted"),
new WFShaderName("BRP", "Water", "FX_Caustics", "Addition", "UnlitWF/WF_Water_Caustics_Addition"),
new WFShaderName("BRP", "Water", "FX_DepthFog", "Transparent", "UnlitWF/WF_Water_DepthFog_Fade"),
new WFShaderName("BRP", "Water", "FX_Sun", "Addition", "UnlitWF/WF_Water_Sun_Addition"),
new WFShaderName("BRP", "Water", "FX_Lamp", "Addition", "UnlitWF/WF_Water_Lamp_Addition"),

// ================
// UnToon 系列(URP)
Expand Down Expand Up @@ -216,6 +219,8 @@ private static bool HasPropertyPrefix(Material mat, string prefix)
new WFShaderFunction("WA3", "WAV_3", "Waving 3", (self, mat) => WFShaderFunction.IsEnable("_WAV_Enable_3", mat)),
new WFShaderFunction("WAS", "WAS", "Water Specular"),
new WFShaderFunction("WAM", "WAM", "Water Reflection"),
new WFShaderFunction("WAR", "WAR", "Water Lamp&Sun Reflection"),
new WFShaderFunction("WMI", "WMI", "Water VRC Mirror Reflection"),

// その他の機能
new WFShaderFunction("BKT", "BKT", "BackFace Texture"),
Expand Down Expand Up @@ -607,13 +612,42 @@ private static bool HasPropertyPrefix(Material mat, string prefix)
new WFI18NTranslation("WAS", "Specular 2 Power", "スペキュラ強度 2"),
new WFI18NTranslation("WAS", "Specular 2 Color", "スペキュラ色 2"),
new WFI18NTranslation("WAS", "Specular 2 Smoothness", "滑らかさ 2"),
new WFI18NTranslation("WAR", "Sun Azimuth", "太陽の方角"),
new WFI18NTranslation("WAR", "Sun Altitude", "太陽の高度"),
new WFI18NTranslation("WAR", "Size", "サイズ"),
new WFI18NTranslation("WAR", "Base Pos", "位置"),
new WFI18NTranslation("WAR", "Hide Back", "後側を非表示"),

// メニュー
new WFI18NTranslation("Copy material", "コピー"),
new WFI18NTranslation("Paste value", "貼り付け"),
new WFI18NTranslation("Paste (without Textures)", "貼り付け (Texture除く)"),
new WFI18NTranslation("Reset", "リセット"),

// 列挙体
new WFI18NTranslation("UnlitWF.BlendModeOVL.ALPHA", "アルファ合成"),
new WFI18NTranslation("UnlitWF.BlendModeOVL.ADD", "加算"),
new WFI18NTranslation("UnlitWF.BlendModeOVL.MUL", "乗算"),
new WFI18NTranslation("UnlitWF.BlendModeOVL.ADD_AND_SUB", "加算・減算"),
new WFI18NTranslation("UnlitWF.BlendModeOVL.SCREEN", "スクリーン"),
new WFI18NTranslation("UnlitWF.BlendModeOVL.OVERLAY", "オーバーレイ"),
new WFI18NTranslation("UnlitWF.BlendModeOVL.HARD_LIGHT", "ハードライト"),
new WFI18NTranslation("UnlitWF.BlendModeHL.ADD_AND_SUB", "加算・減算"),
new WFI18NTranslation("UnlitWF.BlendModeHL.ADD", "加算"),
new WFI18NTranslation("UnlitWF.BlendModeHL.MUL", "乗算"),
new WFI18NTranslation("UnlitWF.BlendModeES.ADD", "加算"),
new WFI18NTranslation("UnlitWF.BlendModeES.ALPHA", "アルファ合成"),
new WFI18NTranslation("UnlitWF.BlendModeES.LEGACY_ALPHA", "アルファ合成(旧タイプ)"),
new WFI18NTranslation("UnlitWF.BlendModeTR.ADD", "加算"),
new WFI18NTranslation("UnlitWF.BlendModeTR.ALPHA", "アルファ合成"),
new WFI18NTranslation("UnlitWF.BlendModeTR.ADD_AND_SUB", "加算・減算"),
new WFI18NTranslation("UnlitWF.SunSourceMode.AUTO", "自動"),
new WFI18NTranslation("UnlitWF.SunSourceMode.ONLY_DIRECTIONAL_LIT", "DirectionalLightのみ"),
new WFI18NTranslation("UnlitWF.SunSourceMode.ONLY_POINT_LIT", "PointLightのみ"),
new WFI18NTranslation("UnlitWF.SunSourceMode.CUSTOM_WORLD_DIR", "カスタム(ワールド方向)"),
new WFI18NTranslation("UnlitWF.SunSourceMode.CUSTOM_LOCAL_DIR", "カスタム(ローカル方向)"),
new WFI18NTranslation("UnlitWF.SunSourceMode.CUSTOM_WORLD_POS", "カスタム(ワールド座標)"),

// その他のテキスト
new WFI18NTranslation(WFMessageText.NewerVersion, "新しいバージョンがリリースされています。\n最新版: "),
new WFI18NTranslation(WFMessageText.PlzMigration, "このマテリアルは古いバージョンで作成されたようです。\n最新版に変換しますか?"),
Expand Down

0 comments on commit 6c0f112

Please sign in to comment.