public void BuildSurfacePickers(SurfaceDict surfaces) { string slot1Val = (string)slot1Pick.SelectedItem; string slot2Val = (string)slot2Pick.SelectedItem; string slot3Val = (string)slot3Pick.SelectedItem; string slot4Val = (string)slot4Pick.SelectedItem; string slot5Val = (string)slot5Pick.SelectedItem; string slot6Val = (string)slot6Pick.SelectedItem; string slot7Val = (string)slot7Pick.SelectedItem; string slot8Val = (string)slot8Pick.SelectedItem; slot1Pick.Items.Clear(); slot2Pick.Items.Clear(); slot3Pick.Items.Clear(); slot4Pick.Items.Clear(); slot5Pick.Items.Clear(); slot6Pick.Items.Clear(); slot7Pick.Items.Clear(); slot8Pick.Items.Clear(); // build all the slot pickers by adding every surface to every picker foreach (Surface s in surfaces.Surfaces) { slot1Pick.Items.Add(s.Name); slot2Pick.Items.Add(s.Name); slot3Pick.Items.Add(s.Name); slot4Pick.Items.Add(s.Name); slot5Pick.Items.Add(s.Name); slot6Pick.Items.Add(s.Name); slot7Pick.Items.Add(s.Name); slot8Pick.Items.Add(s.Name); } // put the saved values back into the pickers. if the value is no longer there, null will be selected slot1Pick.SelectedItem = slot1Val; slot2Pick.SelectedItem = slot2Val; slot3Pick.SelectedItem = slot3Val; slot4Pick.SelectedItem = slot4Val; slot5Pick.SelectedItem = slot5Val; slot6Pick.SelectedItem = slot6Val; slot7Pick.SelectedItem = slot7Val; slot8Pick.SelectedItem = slot8Val; }
public void Initialize(string filePath, SurfaceDict surfaces) { fileName = filePath; surfDict = surfaces; this.Text = System.IO.Path.GetFileNameWithoutExtension(fileName); xmlDoc = new XmlDocument(); xmlDoc.Load(fileName); // note on persistence: the surface sets are in subnodes of the root xml document // each surface set record will hold pointers to these subnodes // when we save, we copy date back to the subnodes and then write the whole doc // back to the file. foreach (XmlNode node in xmlDoc.ChildNodes) { // look for the actor - should be one per file if (node.Name == "XmlGameActor") { foreach (XmlNode actorNode in node.ChildNodes) { // now get the surface sets - could be a couple if (actorNode.Name == "SurfaceSets") { foreach (XmlNode surfSetNode in actorNode.ChildNodes) { if (surfSetNode.Name == "SurfaceSet") { SurfaceSetRecord surfSetRec = new SurfaceSetRecord(surfSetNode); surfaceSets.Add(surfSetRec); SurfSetMenu.Items.Add(surfSetRec); } } } } } } Dirty = false; BuildSurfacePickers(surfaces); SurfSetMenu.SelectedIndex = 0; }
// Load from a particular file private void LoadDictionary(string fileName) { surfaces = SurfaceDict.Load(DictionaryFileName, BokuShared.FileStorageHelper.Instance); }
public void Initialize(SurfaceDict surfaces) { Initialize(fileName, surfaces); }
public CharacterEdit(string filePath, SurfaceDict surfaces) { InitializeComponent(); Initialize(filePath, surfaces); }