public AnarchyInputStart(int inputId, TimedInputSet timedInputSet, float fps) { ButtonSet = timedInputSet.InputSet.Inputs.Select(i => i.ButtonName).ToImmutableList(); InputId = inputId; HeldFrames = (int)Math.Round(timedInputSet.HoldDuration * fps); SleepFrames = (int)Math.Round(timedInputSet.SleepDuration * fps); }
public IDictionary <string, object> Map(TimedInputSet timedInputSet) { Dictionary <string, object> inputMap = new(); bool isTouched = false; foreach (var input in timedInputSet.InputSet.Inputs) { if (input is TouchscreenDragInput drag) { if (isTouched) { throw new ArgumentException("multitouch is not supported!"); } isTouched = true; inputMap["Touch_Screen_X"] = drag.X; inputMap["Touch_Screen_Y"] = drag.Y; inputMap["Touch_Screen_X2"] = drag.X2; inputMap["Touch_Screen_Y2"] = drag.Y2; } else if (input is TouchscreenInput touch) { if (isTouched) { throw new ArgumentException("multitouch is not supported!"); } isTouched = true; inputMap["Touch_Screen_X"] = touch.X; inputMap["Touch_Screen_Y"] = touch.Y; } else { inputMap[ToLowerFirstUpper(input.ButtonName)] = true; } } inputMap["Held_Frames"] = (int)Math.Round(timedInputSet.HoldDuration * _fps); inputMap["Sleep_Frames"] = (int)Math.Round(timedInputSet.SleepDuration * _fps); return(inputMap); }