public static void ClearSelected(GUI_Base root) { int i = 0; XNA_GUI.GUIElements.GUI_Base slider = null; string test = string.Format(c_sliderName, i); if (test == null) { return; } while ((slider = root.GetChildByName(string.Format(c_sliderName, i))) != null) { root.RemoveChild(slider); GUI_Base cancelButton = root.GetChildByName(string.Format("Cancel Button {0}", i)); root.RemoveChild(cancelButton); GUI_Base name = root.GetChildByName(string.Format("Label {0}", i)); root.RemoveChild(name); i++; } s_root = null; TextLabel planetName = (TextLabel)root.GetChildByName("Planet Name"); TextLabel defenseLabel = (TextLabel)root.GetChildByName("Defense Fleets"); TextLabel production = (TextLabel)root.GetChildByName("Production"); planetName.DisplayText = "No Planet Selected"; defenseLabel.DisplayText = "No Planet"; production.DisplayText = "Production: No Planet"; s_previousSelected = null; }
public static void RemoveSingeRoute(int dispatchIndex) { GUI_Base slider = s_root.GetChildByName(string.Format("Deployment Route {0}", dispatchIndex)); s_root.RemoveChild(slider); slider = null; GUI_Base cancelButton = s_root.GetChildByName(string.Format("Cancel Button {0}", dispatchIndex)); s_root.RemoveChild(cancelButton); cancelButton = null; GUI_Base name = s_root.GetChildByName(string.Format("Label {0}", dispatchIndex)); s_root.RemoveChild(name); name = null; dispatchIndex++; SliderBar s = null; while ((s = (SliderBar)s_root.GetChildByName(string.Format("Deployment Route {0}", dispatchIndex))) != null) { s.ControlName = string.Format("Deployment Route {0}", dispatchIndex - 1); GUI_Base button = s_root.GetChildByName(string.Format("Cancel Button {0}", dispatchIndex)); button.ControlName = string.Format("Cancel Button {0}", dispatchIndex - 1); GUI_Base label = s_root.GetChildByName(string.Format("Label {0}", dispatchIndex)); label.ControlName = string.Format("Label {0}", dispatchIndex - 1); dispatchIndex++; } }