void ReleaseDesignerOutlets() { if (BaseView != null) { BaseView.Dispose(); BaseView = null; } if (CancelBarButton != null) { CancelBarButton.Dispose(); CancelBarButton = null; } if (OptionsContainer != null) { OptionsContainer.Dispose(); OptionsContainer = null; } if (PasswordLabel != null) { PasswordLabel.Dispose(); PasswordLabel = null; } if (SelectBarButton != null) { SelectBarButton.Dispose(); SelectBarButton = null; } }
public void LoadConfiguration() { if (File.Exists(this.configFile)) { XmlSerializer serializer = null; TextReader textReader = null; try { serializer = new XmlSerializer(typeof(OptionsContainer)); textReader = new StreamReader(this.configFile); this.Options = (OptionsContainer)serializer.Deserialize(textReader); } catch (Exception exception) { throw new Exception(string.Format("Error reading configuration from {0}!", this.configFile), exception); } finally { if (textReader != null) { textReader.Close(); } } } if (this.Options.rddnsip == null) { this.Options.rddnsip = ""; } }
void ResetButton_Click(object sender, RoutedEventArgs e) { ComboBoxItem selectedPresetItem = presetComboBox.SelectedItem as ComboBoxItem; if (selectedPresetItem != null) { if (presets.ContainsKey((string)selectedPresetItem.Tag)) { var presetFunc = presets[(string)selectedPresetItem.Tag]; // Ask user if he's sure to reset all previously defined settings if (presetFunc != null) { if (SD.MessageService.AskQuestion("${res:CSharpBinding.Formatting.PresetOverwriteQuestion}")) { OptionsContainer.Reset(presetFunc()); } } else { SD.MessageService.ShowWarning("${res:CSharpBinding.Formatting.NoPresetSelectedMessage}"); } } } }
public float volumeValue; //volume sensitivity #endregion Fields #region Methods void Awake() { if(Instance) { DestroyImmediate(gameObject); } else { DontDestroyOnLoad(gameObject); Instance = this; } }
void Start() { optionsContainer = FindObjectOfType <OptionsContainer>(); MainMenu.SetActive(true); OptionsMenu.SetActive(false); InstructionsMenu.SetActive(false); debuggingToggle.onValueChanged.AddListener(delegate { DebuggingToggleValueChanged(debuggingToggle); }); optionsContainer.DebuggingMode = debuggingToggle.isOn; }
private void Awake() { OptionsContainer op = FindObjectOfType <OptionsContainer>(); if (op != null) { debuggingMode = op.DebuggingMode; if (debuggingMode) { DebugLine = gameObject.AddComponent <LineRenderer>(); DebugLine.material = new Material(Shader.Find("Sprites/Default")); DebugLine.startColor = Color.white; DebugLine.endColor = Color.white; DebugLine.startWidth = 0.1f; DebugLine.endWidth = 0.1f; } } }
void Start() { optionsContainer = FindObjectOfType <OptionsContainer>(); OptionsMenu.SetActive(false); InstructionsMenu.SetActive(false); }
// Saves a file containing all game options which are in the above. public static void SaveOptions() { // Prepare for data IO. BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(WhereIsData()); // Create and write to a new container. OptionsContainer data = new OptionsContainer(); // Grab fields. FieldInfo[] classOptions = typeof(OptionsManager).GetFields(); FieldInfo[] containerOptions = data.GetType().GetFields(); // Write booleans into container. for (int i = 0; i < classOptions.Length; i++) { if (classOptions[i].FieldType == typeof(bool)) containerOptions[i].SetValue(data, (bool)classOptions[i].GetValue(null)); } // Save and close safely. bf.Serialize(file, data); file.Close(); Debug.Log("Saved all options successfully."); }