mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-23 00:14:08 -05:00
improve event flag/const multigen handling
no longer assumes 4 chars for const/flag ID makes translation possible for multiple languages to be translated (labels)
This commit is contained in:
@@ -3654,6 +3654,12 @@
|
||||
<ItemGroup>
|
||||
<None Include="Resources\img\types\type_icon_05.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\text\other\const_sm.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\text\other\flags_sm.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
18
PKHeX/Properties/Resources.Designer.cs
generated
18
PKHeX/Properties/Resources.Designer.cs
generated
@@ -12070,6 +12070,15 @@ internal class Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 0 Test1.
|
||||
/// </summary>
|
||||
internal static string const_sm {
|
||||
get {
|
||||
return ResourceManager.GetString("const_sm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Country ID,JP,EN,FR,DE,IT,ES,ZH,KO
|
||||
///1,日本,Japan,Japon,Japan,Giappone,Japón,日本,일본
|
||||
@@ -12294,6 +12303,15 @@ internal class Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 0005 Test1.
|
||||
/// </summary>
|
||||
internal static string flags_sm {
|
||||
get {
|
||||
return ResourceManager.GetString("flags_sm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2237 2237
|
||||
///2238 2238
|
||||
|
||||
@@ -7261,4 +7261,10 @@
|
||||
<data name="type_icon_17" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\img\types\type_icon_17.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="const_sm" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\text\other\const_sm.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
<data name="flags_sm" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\text\other\flags_sm.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
</root>
|
||||
1
PKHeX/Resources/text/other/const_sm.txt
Normal file
1
PKHeX/Resources/text/other/const_sm.txt
Normal file
@@ -0,0 +1 @@
|
||||
0 Test1
|
||||
1
PKHeX/Resources/text/other/flags_sm.txt
Normal file
1
PKHeX/Resources/text/other/flags_sm.txt
Normal file
@@ -0,0 +1 @@
|
||||
0005 Test1
|
||||
@@ -51,6 +51,7 @@ public SAV_EventFlags()
|
||||
private const string constLabelTag = "L_";
|
||||
private bool editing;
|
||||
private int constEntry = -1;
|
||||
private string gamePrefix = "unk";
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -72,12 +73,24 @@ private void B_Save_Click(object sender, EventArgs e)
|
||||
|
||||
private string[] getStringList(string type)
|
||||
{
|
||||
string[] text = null;
|
||||
if (SAV.ORAS)
|
||||
text = Util.getStringList($"{type}_oras");
|
||||
else if (SAV.XY)
|
||||
text = Util.getStringList($"{type}_xy");
|
||||
return text;
|
||||
switch (SAV.Version)
|
||||
{
|
||||
case GameVersion.X:
|
||||
case GameVersion.Y:
|
||||
gamePrefix = "xy";
|
||||
break;
|
||||
case GameVersion.OR:
|
||||
case GameVersion.AS:
|
||||
gamePrefix = "oras";
|
||||
break;
|
||||
case GameVersion.SN:
|
||||
case GameVersion.MN:
|
||||
gamePrefix = "sm";
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return Util.getStringList($"{type}_{gamePrefix}");
|
||||
}
|
||||
private void addFlagList(string[] list)
|
||||
{
|
||||
@@ -113,7 +126,7 @@ private void addFlagList(string[] list)
|
||||
var lbl = new Label
|
||||
{
|
||||
Text = desc[i],
|
||||
Name = flagLabelTag + num[i].ToString("0000"),
|
||||
Name = gamePrefix + flagLabelTag + num[i].ToString("0000"),
|
||||
Margin = Padding.Empty,
|
||||
AutoSize = true
|
||||
};
|
||||
@@ -165,7 +178,7 @@ private void addConstList(string[] list)
|
||||
var lbl = new Label
|
||||
{
|
||||
Text = desc[i],
|
||||
Name = constLabelTag + num[i].ToString("0000"),
|
||||
Name = gamePrefix + constLabelTag + num[i].ToString("0000"),
|
||||
Margin = Padding.Empty,
|
||||
AutoSize = true
|
||||
};
|
||||
@@ -184,12 +197,12 @@ private void addConstList(string[] list)
|
||||
}
|
||||
}
|
||||
|
||||
private int getControlNum(Control chk)
|
||||
private int getControlNum(Control c)
|
||||
{
|
||||
try
|
||||
{
|
||||
string source = chk.Name;
|
||||
return Convert.ToInt32(source.Substring(Math.Max(0, source.Length - 4)));
|
||||
string source = c.Name.Split('_')[1];
|
||||
return Convert.ToInt32(source);
|
||||
}
|
||||
catch { return 0; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user