private void DrawHotkeyChain(HotkeyChain hotkeyChain, int chainCounter) { int hotkeyCounter = 0; hotkeyChain.Enable.Value = ImGuiExtension.Checkbox("Enable", hotkeyChain.Enable); ImGui.Separator(); DrawHotkey(hotkeyChain.Trigger, "Trigger Key", chainCounter.ToString() + hotkeyCounter.ToString(), false); ImGui.Separator(); hotkeyCounter++; foreach (var hotkey in hotkeyChain.Chain) { DrawHotkey(hotkey, "Key", chainCounter.ToString() + hotkeyCounter.ToString(), true); ImGui.Separator(); hotkeyCounter++; } var keyCount = hotkeyChain.Chain.Count; ImGui.PushID(chainCounter.ToString() + "buttons"); if (ImGui.Button("Key +") && keyCount < 20) { hotkeyChain.Chain.Add(new Hotkey()); } ImGui.SameLine(); if (ImGui.Button("Key -") && keyCount > 1) { hotkeyChain.Chain.RemoveAt(keyCount - 1); } ImGui.PopID(); ImGui.Separator(); }
private IEnumerator RunHotkeyChain(HotkeyChain hotkeyChain) { yield return(new WaitTime(int.Parse(hotkeyChain.Trigger.WaitAfterInMs.Value))); foreach (var hotkey in hotkeyChain.Chain) { yield return(KeyPress(hotkey.Key, hotkey.ControlModifier.Value)); var waitTime = int.Parse(hotkey.WaitAfterInMs.Value); if (waitTime > 0) { yield return(new WaitTime(waitTime)); } } }