public override void WriteProgram(Work w) { //if (w.Hour < 17) //{ // Console.WriteLine("当前时间:{0}下午工作", w.Hour); //} //else //{ // w.SetState(new EveningState()); // w.WriteProgram(); //} if (w.Finish) { w.SetState(new RestState()); w.WriteProgram(); } else { if (w.Hour < 21) { Console.WriteLine("当前时间:{0} 加班哦,疲累之极", w.Hour); } else { w.SetState(new SleepingState()); w.WriteProgram(); } } }
public override void WriteProgram(Work w) { if (w.Hour < 17) { Console.WriteLine("当前时间:{0}下午工作", w.Hour); } else { w.SetState(new EveningState()); w.WriteProgram(); } }
static void Main(string[] args) { //int nHour = 16; //Work work = new Work(); //work.RunProgram(nHour,true); Work emergencyProjects = new Work(); emergencyProjects.Hour = 16; emergencyProjects.Finish = false; emergencyProjects.WriteProgram(); }
public override void WriteProgram(Work work) { if (work.Hour < 12) { Debug.Log("当前时间" + work.Hour + "点 上午工作状态"); } else { work.SetState(new NoonState()); work.WriteProgram(); } }
public override void WriteProgram(Work w) { if (w.Hour < 12) { Console.WriteLine("当前时间:{0}点 上午工作,精神百倍", w.Hour); } else { //w.SetState(NewsStyleUriParser); w.SetState(new NoonState()); w.WriteProgram(); } }
public override void WriteProgram(Work w) { //throw new NotImplementedException(); if (w.Hour < 13) { Console.WriteLine("当前时间:{0}午休", w.Hour); } else { w.SetState(new AfternoonState()); w.WriteProgram(); } }