public void SetAxis(string name, float?value, AutoPatternFloat pattern = null) { if (value.HasValue) { pattern ??= new AutoPatternFloat(value.Value, _on, 0, _off); _axisPatterns[name] = pattern; } else { _axisPatterns.Remove(name); } }
} // Pretty much a hack, public void SetFloat(string name, float?value, AutoPatternFloat pattern = null) { if (value.HasValue) { if (pattern == null) { pattern = new AutoPatternFloat(value.Value, On, 0, Off); } _floatPatterns[name] = pattern; } else { _floatPatterns.Remove(name); } }
private void SetUpColumns() { TasView.AllColumns.Clear(); AddColumn(CursorColumnName, string.Empty, 18); AddColumn(FrameColumnName, "Frame#", 68); var columnNames = GenerateColumnNames(); foreach (var kvp in columnNames) { // N64 hack for now, for fake analog if (Emulator.SystemId == "N64") { if (kvp.Key.Contains("A Up") || kvp.Key.Contains("A Down") || kvp.Key.Contains("A Left") || kvp.Key.Contains("A Right")) { continue; } } AddColumn(kvp.Key, kvp.Value, 20 * kvp.Value.Length); } var columnsToHide = TasView.AllColumns .Where(c => c.Name == "Power" || c.Name == "Reset"); foreach (var column in columnsToHide) { column.Visible = false; } TasView.AllColumns.ColumnsChanged(); // Patterns int bStart = 0; int fStart = 0; if (BoolPatterns == null) { BoolPatterns = new AutoPatternBool[controllerType.BoolButtons.Count + 2]; FloatPatterns = new AutoPatternFloat[controllerType.FloatControls.Count + 2]; } else { bStart = BoolPatterns.Length - 2; fStart = FloatPatterns.Length - 2; Array.Resize(ref BoolPatterns, controllerType.BoolButtons.Count + 2); Array.Resize(ref FloatPatterns, controllerType.FloatControls.Count + 2); } for (int i = bStart; i < BoolPatterns.Length - 2; i++) BoolPatterns[i] = new AutoPatternBool(1, 1); BoolPatterns[BoolPatterns.Length - 2] = new AutoPatternBool(1, 0); BoolPatterns[BoolPatterns.Length - 1] = new AutoPatternBool( Global.Config.AutofireOn, Global.Config.AutofireOff); for (int i = fStart; i < FloatPatterns.Length - 2; i++) FloatPatterns[i] = new AutoPatternFloat(new float[] { 1f }); FloatPatterns[FloatPatterns.Length - 2] = new AutoPatternFloat(new float[] { 1f }); FloatPatterns[FloatPatterns.Length - 1] = new AutoPatternFloat( 1f, Global.Config.AutofireOn, 0f, Global.Config.AutofireOff); SetUpToolStripColumns(); }
public void SetFloat(string name, float? value, AutoPatternFloat pattern = null) { if (value.HasValue) { if (pattern == null) pattern = new AutoPatternFloat(value.Value, On, 0, Off); _floatPatterns[name] = pattern; } else { _floatPatterns.Remove(name); } }