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