private void loadControls(serializableTerrain ter) { findSelections(); RadioButton but; terrainInfo info; opTerrain.Checked = true; foreach (String key in table.Keys) { but = (RadioButton)table[key]; but.Checked = true; info = (terrainInfo)ter.table[key]; barPressure.Value = info.barPressure; barOuter.Value = info.barOuter; barInner.Value = info.barInner; barFourth.Value = info.barFourth; variation.Value = info.bladeVeriation; blade.Value = info.bladeSize; /* if (key == "texture") { for (int i = 0; i < 6; i++) { labelTextures[i].Text = ter.textures[i]; labelTextures[i].BackColor = ter.images[i]; } } * */ } colorButton.BackColor = ter.color; int count = listGrass.Items.Count; for (int i = 0; i < count; i++) { listGrass.SetSelected(i, false); } foreach (int i in ter.grass) { listGrass.SetSelected(i, true); } restoreSelection(); }
public serializableTerrain saveControls(String name) { serializableTerrain ter = new serializableTerrain(name); RadioButton but; terrainInfo info; findSelections(); foreach (String key in table.Keys) { but = (RadioButton)table[key]; but.Checked = true; info = new terrainInfo(barPressure.Value, barOuter.Value, barFourth.Value, barInner.Value, blade.Value, variation.Value); ter.table.Add(key, info); /* if (key == "texture") { for (int i = 0; i < 6; i++) { ter.textures[i] = labelTextures[i].Text; // Console.WriteLine(ter.textures[i]); // Console.WriteLine(TE.GetTexture(i)); ter.images[i] = labelTextures[i].BackColor; } // radioTextures[1].Text = "TT_GD_Dirt_01"; // radioTextures[1].BackgroundImage = bitMapReturn(radioTextures[1].Text); // labelTextures[1].Text = stringReturn(radioTextures[1].Text); // Console.WriteLine("Txture: " + radioTextures[1].Text + ", label: " + labelTextures[1].Text); // Console.WriteLine("name: " + radioTextures[1].BackgroundImage); // radioTextures[1].Checked = true; } */ } ter.color = colorButton.BackColor; var l = listGrass.SelectedIndices; int[] intArray = new int[l.Count]; int j = 0; foreach (int i in l) { intArray[j] = i; j++; } ter.grass = intArray; restoreSelection(); return ter; }