private void Thread_Func2() { Stopwatch watch = Stopwatch.StartNew(); while (m_running) { if (m_enabled || m_semiauto) { if (m_step == FishingSteps.START) { watch.Restart(); } else if (m_step == FishingSteps.RESTART) { m_semiauto = false; } try { m_step = RunOnce(); } catch (SEHException) { m_step = FishingSteps.IDLE; } if (m_step == FishingSteps.IDLE || m_step == FishingSteps.RESTART) { m_model.Timer = string.Format("{0:F1} 秒", watch.Elapsed.TotalSeconds); if (m_step == FishingSteps.IDLE) { m_enabled = false; m_semiauto = false; } } } else { m_step = FishingSteps.START; Thread.Sleep(100); } if (m_semiauto) { if (m_step == FishingSteps.START_LOOP) { m_step = FishingSteps.STOP; } else if (m_step == FishingSteps.STOP_LOOP) { m_step = FishingSteps.STOP; m_semiauto = false; } } m_model.Enabled = m_enabled; m_model.Semiauto = m_semiauto; } }
private string StepToText(FishingSteps step) { switch (step) { case FishingSteps.START: return("準備"); case FishingSteps.START_LOOP: return("等待開始..."); case FishingSteps.STOP: return("收竿"); case FishingSteps.STOP_LOOP: return("等待重試..."); case FishingSteps.GUESS_WASD: return("文字辨識"); case FishingSteps.INPUT_TEXT: return(FishingBoat.GetText("WASD")); case FishingSteps.TAKE_DROP: return("撿取物品"); case FishingSteps.RESTART: return("拋竿"); } return(null); }