use translated puzzle names
This commit is contained in:
parent
578812a1e6
commit
c027a0335a
@ -14,6 +14,16 @@ using System.Resources;
|
|||||||
|
|
||||||
namespace EduNetworkBuilder
|
namespace EduNetworkBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class MyPuzzleEntry
|
||||||
|
{
|
||||||
|
public string Title;
|
||||||
|
public string PuzzleName;
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return this.Title;
|
||||||
|
}
|
||||||
|
}
|
||||||
public partial class ListBoxWindow : Form
|
public partial class ListBoxWindow : Form
|
||||||
{
|
{
|
||||||
protected LBContents MyMode = LBContents.messages;
|
protected LBContents MyMode = LBContents.messages;
|
||||||
@ -225,6 +235,7 @@ namespace EduNetworkBuilder
|
|||||||
btnReset.Visible = true;
|
btnReset.Visible = true;
|
||||||
PuzzleInfo pi;
|
PuzzleInfo pi;
|
||||||
string shown_name;
|
string shown_name;
|
||||||
|
string puzzle_name="";
|
||||||
List<string> Puzzles = NB.GetPuzzleNames();
|
List<string> Puzzles = NB.GetPuzzleNames();
|
||||||
NBSettings oursettings = NB.GetSettings();
|
NBSettings oursettings = NB.GetSettings();
|
||||||
if (Puzzles == null) return;
|
if (Puzzles == null) return;
|
||||||
@ -235,7 +246,9 @@ namespace EduNetworkBuilder
|
|||||||
if (FilterString == "")
|
if (FilterString == "")
|
||||||
{
|
{
|
||||||
pi = NB.GetPuzzleInfoFromName(str);
|
pi = NB.GetPuzzleInfoFromName(str);
|
||||||
shown_name = pi.PuzzleName;
|
//shown_name = pi.PuzzleName;
|
||||||
|
shown_name = pi.NetTitle.GetText();
|
||||||
|
puzzle_name = pi.PuzzleName;
|
||||||
if (oursettings.CheckIfDone(str))
|
if (oursettings.CheckIfDone(str))
|
||||||
{
|
{
|
||||||
shown_name = "* " + shown_name;
|
shown_name = "* " + shown_name;
|
||||||
@ -245,8 +258,11 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
if (isChecked(tag))
|
if (isChecked(tag))
|
||||||
{
|
{
|
||||||
|
MyPuzzleEntry MPE = new MyPuzzleEntry();
|
||||||
|
MPE.PuzzleName = puzzle_name;
|
||||||
|
MPE.Title = shown_name;
|
||||||
if(selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle
|
if(selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle
|
||||||
lbWindowData.Items.Add(shown_name);
|
lbWindowData.Items.Add(MPE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,7 +270,8 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
//We are filtering stuff
|
//We are filtering stuff
|
||||||
pi = NB.GetPuzzleInfoFromName(str);
|
pi = NB.GetPuzzleInfoFromName(str);
|
||||||
shown_name = pi.PuzzleName;
|
//shown_name = pi.PuzzleName;
|
||||||
|
shown_name = pi.NetTitle.GetText();
|
||||||
bool added = false;
|
bool added = false;
|
||||||
string localFilter = ".*" + FilterString + ".*";
|
string localFilter = ".*" + FilterString + ".*";
|
||||||
if (oursettings.ScoreList.Contains(str))
|
if (oursettings.ScoreList.Contains(str))
|
||||||
@ -262,27 +279,31 @@ namespace EduNetworkBuilder
|
|||||||
shown_name = "* " + shown_name;
|
shown_name = "* " + shown_name;
|
||||||
wasfinished = true;
|
wasfinished = true;
|
||||||
}
|
}
|
||||||
|
MyPuzzleEntry MPE = new MyPuzzleEntry();
|
||||||
|
MPE.PuzzleName = puzzle_name;
|
||||||
|
MPE.Title = shown_name;
|
||||||
|
|
||||||
if (!added && pi.PuzzleName != null && Regex.IsMatch(pi.PuzzleName, localFilter, RegexOptions.IgnoreCase))
|
if (!added && pi.PuzzleName != null && Regex.IsMatch(pi.PuzzleName, localFilter, RegexOptions.IgnoreCase))
|
||||||
{
|
{
|
||||||
added = true;
|
added = true;
|
||||||
lbWindowData.Items.Add(shown_name);
|
lbWindowData.Items.Add(MPE);
|
||||||
}
|
}
|
||||||
if (!added && pi.PuzzleDescription!= null && Regex.IsMatch(pi.PuzzleDescription, localFilter, RegexOptions.IgnoreCase))
|
if (!added && pi.PuzzleDescription!= null && Regex.IsMatch(pi.PuzzleDescription, localFilter, RegexOptions.IgnoreCase))
|
||||||
{
|
{
|
||||||
added = true;
|
added = true;
|
||||||
lbWindowData.Items.Add(shown_name);
|
lbWindowData.Items.Add(MPE);
|
||||||
}
|
}
|
||||||
if (!added && pi.PuzzleTitle != null && Regex.IsMatch(pi.PuzzleTitle, localFilter,RegexOptions.IgnoreCase))
|
if (!added && pi.PuzzleTitle != null && Regex.IsMatch(pi.PuzzleTitle, localFilter,RegexOptions.IgnoreCase))
|
||||||
{
|
{
|
||||||
added = true;
|
added = true;
|
||||||
lbWindowData.Items.Add(shown_name);
|
lbWindowData.Items.Add(MPE);
|
||||||
}
|
}
|
||||||
foreach (string tag in pi.PuzzleTags)
|
foreach (string tag in pi.PuzzleTags)
|
||||||
{
|
{
|
||||||
if (!added && pi.PuzzleTitle != null && Regex.IsMatch(tag, localFilter, RegexOptions.IgnoreCase))
|
if (!added && pi.PuzzleTitle != null && Regex.IsMatch(tag, localFilter, RegexOptions.IgnoreCase))
|
||||||
{
|
{
|
||||||
if (selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle
|
if (selected == "" && !wasfinished) selected = shown_name; //Select the first unfinished puzzle
|
||||||
lbWindowData.Items.Add(shown_name);
|
lbWindowData.Items.Add(MPE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,8 +311,11 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
if(selected != null && selected != "")
|
if(selected != null && selected != "")
|
||||||
{
|
{
|
||||||
if (lbWindowData.Items.Contains(selected))
|
foreach (object one in lbWindowData.Items)
|
||||||
lbWindowData.SelectedItem = selected;
|
{
|
||||||
|
if(one.ToString() == selected)
|
||||||
|
lbWindowData.SelectedItem = selected;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(lbWindowData.SelectedIndex != -1)
|
if(lbWindowData.SelectedIndex != -1)
|
||||||
{
|
{
|
||||||
@ -309,21 +333,42 @@ namespace EduNetworkBuilder
|
|||||||
NBSettings oursettings = NB.GetSettings();
|
NBSettings oursettings = NB.GetSettings();
|
||||||
if (MyMode == LBContents.puzzles && lbWindowData.SelectedItem != null)
|
if (MyMode == LBContents.puzzles && lbWindowData.SelectedItem != null)
|
||||||
{
|
{
|
||||||
string TheName = lbWindowData.SelectedItem.ToString();
|
if (lbWindowData.SelectedItem is string)
|
||||||
TheName = Regex.Replace(TheName, @"^\* ", "");
|
|
||||||
Visible = false;
|
|
||||||
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
|
|
||||||
if (myWin == null)
|
|
||||||
{
|
{
|
||||||
myWin.Activate();
|
string TheName = lbWindowData.SelectedItem.ToString();
|
||||||
|
TheName = Regex.Replace(TheName, @"^\* ", "");
|
||||||
|
Visible = false;
|
||||||
|
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
|
||||||
|
if (myWin == null)
|
||||||
|
{
|
||||||
|
myWin.Activate();
|
||||||
|
}
|
||||||
|
if (oursettings.AutoStartPuzzles != cbLoadPuzzlesAtStart.Checked)
|
||||||
|
{
|
||||||
|
oursettings.AutoStartPuzzles = cbLoadPuzzlesAtStart.Checked;
|
||||||
|
// oursettings.Save();
|
||||||
|
}
|
||||||
|
if (lbWindowData.SelectedItem != null)
|
||||||
|
NB.LoadNetworkFromResource(TheName);
|
||||||
}
|
}
|
||||||
if(oursettings.AutoStartPuzzles != cbLoadPuzzlesAtStart.Checked)
|
else if (lbWindowData.SelectedItem is MyPuzzleEntry)
|
||||||
{
|
{
|
||||||
oursettings.AutoStartPuzzles = cbLoadPuzzlesAtStart.Checked;
|
MyPuzzleEntry MPE = (MyPuzzleEntry)lbWindowData.SelectedItem;
|
||||||
// oursettings.Save();
|
string TheName = MPE.PuzzleName;
|
||||||
|
Visible = false;
|
||||||
|
BuilderWindow myWin = (BuilderWindow)Application.OpenForms["BuilderWindow"];
|
||||||
|
if (myWin == null)
|
||||||
|
{
|
||||||
|
myWin.Activate();
|
||||||
|
}
|
||||||
|
if (oursettings.AutoStartPuzzles != cbLoadPuzzlesAtStart.Checked)
|
||||||
|
{
|
||||||
|
oursettings.AutoStartPuzzles = cbLoadPuzzlesAtStart.Checked;
|
||||||
|
// oursettings.Save();
|
||||||
|
}
|
||||||
|
if (lbWindowData.SelectedItem != null)
|
||||||
|
NB.LoadNetworkFromResource(TheName);
|
||||||
}
|
}
|
||||||
if (lbWindowData.SelectedItem != null)
|
|
||||||
NB.LoadNetworkFromResource(TheName);
|
|
||||||
}
|
}
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
@ -526,8 +571,8 @@ namespace EduNetworkBuilder
|
|||||||
oursettings.ScoreList.Add(TheName);
|
oursettings.ScoreList.Add(TheName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UpdateForm();
|
||||||
}
|
}
|
||||||
UpdateForm();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,9 +215,15 @@ namespace EduNetworkBuilder
|
|||||||
public List<string> PuzzleTags = new List<string>();
|
public List<string> PuzzleTags = new List<string>();
|
||||||
public int Level=0;
|
public int Level=0;
|
||||||
public double SortOrder=0;
|
public double SortOrder=0;
|
||||||
|
public LanguageStrings NetMessage;
|
||||||
|
public LanguageStrings NetTitle;
|
||||||
|
|
||||||
public void Load(XmlNode TheNode, string Name)
|
public void Load(XmlNode TheNode, string Name)
|
||||||
{
|
{
|
||||||
PuzzleName = Name;
|
PuzzleName = Name;
|
||||||
|
NetMessage = new LanguageStrings("message"); //Do not translate this string "message" It is an important word
|
||||||
|
NetTitle = new LanguageStrings("title"); //Do not translate this string "title". It is an important word
|
||||||
|
|
||||||
foreach (XmlNode Individual in TheNode.ChildNodes)
|
foreach (XmlNode Individual in TheNode.ChildNodes)
|
||||||
{
|
{
|
||||||
XmlNodeType myNodetype = Individual.NodeType;
|
XmlNodeType myNodetype = Individual.NodeType;
|
||||||
@ -244,6 +250,18 @@ namespace EduNetworkBuilder
|
|||||||
break;
|
break;
|
||||||
case "sortorder":
|
case "sortorder":
|
||||||
double.TryParse(Individual.InnerText, out SortOrder);
|
double.TryParse(Individual.InnerText, out SortOrder);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (Regex.IsMatch(Individual.Name.ToLower(), "message"))
|
||||||
|
{
|
||||||
|
NetMessage.Add(Individual);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Regex.IsMatch(Individual.Name.ToLower(), "title"))
|
||||||
|
{
|
||||||
|
NetTitle.Add(Individual);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user