void Start() { //target = GameObject.FindWithTag ("Player").transform; keyTracker = GetComponent(typeof(KeyTracker)) as KeyTracker; cameraZoom = Camera.main.gameObject.GetComponent <CameraZoom>(); mainMenuPanel = GameObject.Find("Menu Panel"); }
public static void StrawberryPiano() { //File.WriteAllText("StrawberryPiano.bat", $"ffmpeg.exe -framerate 25 -i {Path.GetFullPath("StrawberryPianoFrames")}/frame*.png -r 25 -pix_fmt yuv420p out.mp4"); var folder = @"C:\Users\alexm\Downloads"; HashSet <byte> pressed = new HashSet <byte>(); using (var f = new FileStream(@$ "{ folder}\Strawberry Piano.mid", FileMode.Open)) { var m = MidiSequence.Open(f); List <NoteVoiceMidiEvent> notes = new List <NoteVoiceMidiEvent>(); foreach (var t in m.Tracks) { notes.AddRange(t.Events.OfType <NoteVoiceMidiEvent>()); } { //Convert to absolute time long previous = 0; foreach (var n in notes) { var dt = n.DeltaTime; n.DeltaTime = (dt + previous) / 30; previous += dt; } Console.WriteLine($"Note count: {notes.Count} "); Console.WriteLine($"Last note: {notes.Last().DeltaTime} ms"); Console.WriteLine($"Last note: {notes.Last().DeltaTime / 1000} seconds"); } var dir = @$ "{folder}\Strawberry Piano Frames"; Directory.CreateDirectory(dir); int frameRate = 25; Console.WriteLine($"Frames: {notes.Last().DeltaTime * frameRate / 1000} frames"); using (StrawberryVisualizer v = new StrawberryVisualizer(@$ "Strawberry Piano Note.png", $"StrawberryPianoFrames")) { KeyTracker keys = new KeyTracker(); int index = 0; int i = 0; while (index < notes.Count) { double time = i * 1000 / frameRate; i++; var now = notes.Skip(index).TakeWhile(n => n.DeltaTime <= time); keys.Process(now); index += now.Count(); v.AddFrame(keys.pressed); //Console.WriteLine($"Time: {time}"); //Console.WriteLine($"Index: {index}"); } Process.Start(Path.GetFullPath("StrawberryPiano.bat")); } }
private void OnStartup(object sender, StartupEventArgs e) { var clipboard = new Domain.Clipboard(new Clipboard()); var clipboardHistoryManager = new ClipboardHistoryManager(10); var clipboardBindingManager = new ClipboardBindingManager(); var keyTracker = new KeyTracker(); var ctrlCHotkey = new Hotkey(keyTracker, new KeyCombo(ModifierKeys.Control, Key.C)); var ctrlVHotkey = new Hotkey(keyTracker, new KeyCombo(ModifierKeys.Control, Key.V)); var escHotkey = new Hotkey(keyTracker, new KeyCombo(Key.Escape)); var inputSimulator = new InputSimulator(); var notificationDispatcher = new NotificationDispatcher(); var historyMenuViewModel = new HistoryMenuViewModel(clipboardHistoryManager); var copypasta = new CopypastaController(clipboard, clipboardHistoryManager, clipboardBindingManager, ctrlVHotkey, ctrlCHotkey, escHotkey, keyTracker, inputSimulator, notificationDispatcher); var notifyIconWindow = new NotifyIconWindow(notificationDispatcher, historyMenuViewModel); }
// Use this for initialization void Awake () { keyTracker = new KeyTracker(); supportedKeyCodes = new List<KeyCode>(); }