public virtual void OnTaikoStateUpdated(TaikoStateUpdatedEventArgs e) { TaikoStateUpdated?.Invoke(this, e); }
public void GetPixelColor() { Stopwatch swScan = new Stopwatch(); Stopwatch swProcess = new Stopwatch(); Stopwatch swLoop = new Stopwatch(); swLoop.Start(); while (Thread.CurrentThread.IsAlive) { //LatencyList.Add(new Latency(swScan.ElapsedMilliseconds, swProcess.ElapsedMilliseconds, swLoop.ElapsedMilliseconds)); Color c = scanner.GetPixel(0); Color cb = scanner.GetPixel(1); Color cCheck = scanner.GetPixel(2); Color cSpinner = Color.White; if (UpdatePanels) { PanelColorUpdatedEventArgs PanelColorArgs = new PanelColorUpdatedEventArgs(); PanelColorArgs.c = Color.FromArgb(0, c.R, c.G, c.B); OnPanelColorUpdated(PanelColorArgs); } if (cCheck.R == 0 && cCheck.G == 0 && cCheck.B == 0) { //Update the label TaikoStateUpdatedEventArgs TaikoState = new TaikoStateUpdatedEventArgs(); TaikoState.State = "Taiko Running (" + Math.Round(scanner.GetAverageLatency(), 2) + "ms)"; OnTaikoStateUpdated(TaikoState); if (isSpinner(c)) { if (lastInput == Inputs.INPUT_R) { SendBlue(); } else if (lastInput == Inputs.INPUT_B) { SendRed(); } else { SendRed(); SendBlue(); } CountNote(swLoop.ElapsedMilliseconds); } else if (isRed(c) || isRed(cb)) { if (lastInput != Inputs.INPUT_R) { SendRed(); } CountNote(swLoop.ElapsedMilliseconds); } else if (isBlue(c) || isBlue(cb)) { if (lastInput != Inputs.INPUT_B) { SendBlue(); } CountNote(swLoop.ElapsedMilliseconds); } else { lastInput = Inputs.INPUT_NONE; } } else { //Update the label TaikoStateUpdatedEventArgs TaikoState = new TaikoStateUpdatedEventArgs(); TaikoState.State = "Taiko Not Running"; OnTaikoStateUpdated(TaikoState); } Thread.Sleep(1); } }