private void LoadInputConfigurationsFromResource(string resourcePath) { if (_inputManager.inputConfigurations.Count > 0) { bool cont = EditorUtility.DisplayDialog("Warning", "This operation will replace the current input configrations!\nDo you want to continue?", "Yes", "No"); if (!cont) { return; } } TextAsset textAsset = Resources.Load <TextAsset>(resourcePath); if (textAsset != null) { using (System.IO.StringReader reader = new System.IO.StringReader(textAsset.text)) { InputLoaderXML inputLoader = new InputLoaderXML(reader); _inputManager.Load(inputLoader.Load()); _selectionPath.Clear(); } } else { EditorUtility.DisplayDialog("Error", "Failed to load input configurations. The resource file might have been deleted or renamed.", "OK"); } }
private void ConfigureForInputAdapter() { if (_inputManager.inputConfigurations.Count > 0) { bool cont = EditorUtility.DisplayDialog("Warning", "This operation will replace the current input configrations!\nDo you want to continue?", "Yes", "No"); if (!cont) { return; } } TextAsset textAsset = Resources.Load <TextAsset>("input_adapter_init"); if (textAsset != null) { using (System.IO.StringReader reader = new System.IO.StringReader(textAsset.text)) { InputLoaderXML inputLoader = new InputLoaderXML(reader); inputLoader.Load(out _inputManager.inputConfigurations, out _inputManager.defaultConfiguration); _selectionPath.Clear(); } } else { EditorUtility.DisplayDialog("Error", "Failed to load default configurations for Input Adapter.", "OK"); } }
public void ResetInputs() { ControlScheme controlScheme = InputManager.GetControlScheme(m_controlSchemeName); ControlScheme defControlScheme = null; using (StringReader reader = new StringReader(m_defaultInputProfile.text)) { InputLoaderXML loader = new InputLoaderXML(reader); defControlScheme = loader.Load(m_controlSchemeName); } if (defControlScheme != null) { if (defControlScheme.Actions.Count == controlScheme.Actions.Count) { for (int i = 0; i < defControlScheme.Actions.Count; i++) { controlScheme.Actions[i].Copy(defControlScheme.Actions[i]); } InputManager.Reinitialize(); } else { Debug.LogError("Current and default control scheme don't have the same number of actions"); } } else { Debug.LogErrorFormat("Default input profile doesn't contain a control scheme named '{0}'", m_controlSchemeName); } }
public static void LoadSnapshot(TeamUtility.IO.InputManager inputManager) { if (!CanLoadSnapshot()) { return; } InputLoaderXML inputLoader = new InputLoaderXML(_snapshotFile); inputLoader.Load(out inputManager.inputConfigurations, out inputManager.defaultConfiguration); }
public static void LoadSnapshot(InputManager inputManager) { if (!CanLoadSnapshot()) { return; } InputLoaderXML inputLoader = new InputLoaderXML(m_snapshotFile); inputManager.SetSaveData(inputLoader.Load()); }
/// <summary> /// 加载玩家的配置 /// </summary> public void Load() { if (!File.Exists(ConfigFilePath)) { return; } var loader = new InputLoaderXML(ConfigFilePath); loader.Load(ref this.joystickControlSchemes, ref this.pcControlSchemes); }
public static void LoadSnapshot(TeamUtility.IO.InputManager inputManager) { if (!CanLoadSnapshot()) { return; } InputLoaderXML inputLoader = new InputLoaderXML(_snapshotFile); inputManager.Load(inputLoader.Load()); }
private void ImportInputConfigurations() { string file = EditorUtility.OpenFilePanel("Import input profile", "", "xml"); if (string.IsNullOrEmpty(file)) { return; } bool replace = EditorUtility.DisplayDialog("Replace or Append", "Do you want to replace the current input configrations?", "Replace", "Append"); if (replace) { InputLoaderXML inputLoader = new InputLoaderXML(file); inputLoader.Load(out _inputManager.inputConfigurations, out _inputManager.defaultConfiguration); _selectionPath.Clear(); } else { List <InputConfiguration> configurations; string defaultConfig; InputLoaderXML inputLoader = new InputLoaderXML(file); inputLoader.Load(out configurations, out defaultConfig); if (configurations != null && configurations.Count > 0) { foreach (var config in configurations) { _inputManager.inputConfigurations.Add(config); } } } if (_searchString.Length > 0) { UpdateSearchResults(); } Repaint(); }