private void SavePreset() { if (selectedIndex != -1) { ControllerOffset selectedPreset = new ControllerOffset(positionOffset, rotationOffset); PluginConfig.Instance.OffsetPresets[customListTableData.data[selectedIndex].text] = selectedPreset; customListTableData.data[selectedIndex].subtext = selectedPreset.ToString(); customListTableData.tableView.ClearSelection(); customListTableData.tableView.ReloadData(); customListTableData.tableView.ScrollToCellWithIdx(selectedIndex, TableView.ScrollPositionType.Center, false); selectedIndex = -1; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ModifyButtonsEnabled))); } }
private void CreatePreset(string presetName) { if (presetName != "" && !PluginConfig.Instance.OffsetPresets.ContainsKey(presetName)) { ControllerOffset newPreset = new ControllerOffset(); PluginConfig.Instance.OffsetPresets.Add(presetName, newPreset); customListTableData.data.Add(new CustomListTableData.CustomCellInfo(presetName, newPreset.ToString())); customListTableData.tableView.ScrollToCellWithIdx(customListTableData.data.Count, TableView.ScrollPositionType.End, true); customListTableData.tableView.ReloadData(); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ScrollButtonsEnabled))); } }