public StateMachine(CaptureMachine captureMachine, Form1.ThreadStopEvent callBack) { this.m_locker = new object(); this.m_State = StudyState.SelectIndexTitle; this.m_captureMachine = captureMachine; this.m_isWorking = false; this.m_callBack = callBack; }
private StudyState() { if (_instance != null) { return; } _instance = this; timeToStudy = 20.0f; energyDrainMultiplier = 0.9f; staminaDrainMultiplier = 0.6f; }
private void button_start_Click(object sender, EventArgs e) { if (!m_stateMachine.isWorking) { button_start.Text = "Stop"; StudyState startState = (StudyState)Enum.Parse(typeof(StudyState), (string)comboBox_startState.SelectedItem); m_stateMachine.Begin(startState); } else { SetButtonActive(); } }
public override void CheckProgress() { PlayerMobile from = System.From; if (m_CurrentNest != null) { NestArea nest = m_CurrentNest; if ((from.Map == Map.Trammel || from.Map == Map.Felucca) && nest.Contains(from)) { if (m_StudyState != StudyState.Inactive) { TimeSpan time = DateTime.UtcNow - m_StudyBegin; if (time > TimeSpan.FromSeconds(30.0)) { m_StudiedNests.Add(nest); m_StudyState = StudyState.Inactive; if (m_CurrentNest.Special) { from.SendLocalizedMessage(1054057); // You complete your examination of this bizarre Egg Nest. The Naturalist will undoubtedly be quite interested in these notes! m_StudiedSpecialNest = true; } else { from.SendLocalizedMessage(1054054); // You have completed your study of this Solen Egg Nest. You put your notes away. CurProgress++; } } else if (m_StudyState == StudyState.FirstStep && time > TimeSpan.FromSeconds(15.0)) { if (!nest.Special) { from.SendLocalizedMessage(1054058); // You begin recording your completed notes on a bit of parchment. } m_StudyState = StudyState.SecondStep; } } } else { if (m_StudyState != StudyState.Inactive) { from.SendLocalizedMessage(1054046); // You abandon your study of the Solen Egg Nest without gathering the needed information. } m_CurrentNest = null; } } else if (from.Map == Map.Trammel || from.Map == Map.Felucca) { NestArea nest = NestArea.Find(from); if (nest != null) { m_CurrentNest = nest; m_StudyBegin = DateTime.UtcNow; if (m_StudiedNests.Contains(nest)) { m_StudyState = StudyState.Inactive; from.SendLocalizedMessage(1054047); // You glance at the Egg Nest, realizing you've already studied this one. } else { m_StudyState = StudyState.FirstStep; if (nest.Special) { from.SendLocalizedMessage(1054056); // You notice something very odd about this Solen Egg Nest. You begin taking notes. } else { from.SendLocalizedMessage(1054045); // You begin studying the Solen Egg Nest to gather information. } if (from.Female) { from.PlaySound(0x30B); } else { from.PlaySound(0x419); } } } } }
public override void CheckProgress() { PlayerMobile from = System.From; if ( m_CurrentNest != null ) { NestArea nest = m_CurrentNest; if ( ( from.Map == Map.Trammel || from.Map == Map.Felucca ) && nest.Contains( from ) ) { if ( m_StudyState != StudyState.Inactive ) { TimeSpan time = DateTime.Now - m_StudyBegin; if ( time > TimeSpan.FromSeconds( 30.0 ) ) { m_StudiedNests.Add( nest ); m_StudyState = StudyState.Inactive; if ( m_CurrentNest.Special ) { from.SendLocalizedMessage( 1054057 ); // You complete your examination of this bizarre Egg Nest. The Naturalist will undoubtedly be quite interested in these notes! m_StudiedSpecialNest = true; } else { from.SendLocalizedMessage( 1054054 ); // You have completed your study of this Solen Egg Nest. You put your notes away. CurProgress++; } } else if ( m_StudyState == StudyState.FirstStep && time > TimeSpan.FromSeconds( 15.0 ) ) { if ( !nest.Special ) { from.SendLocalizedMessage( 1054058 ); // You begin recording your completed notes on a bit of parchment. } m_StudyState = StudyState.SecondStep; } } } else { if ( m_StudyState != StudyState.Inactive ) { from.SendLocalizedMessage( 1054046 ); // You abandon your study of the Solen Egg Nest without gathering the needed information. } m_CurrentNest = null; } } else if ( from.Map == Map.Trammel || from.Map == Map.Felucca ) { NestArea nest = NestArea.Find( from ); if ( nest != null ) { m_CurrentNest = nest; m_StudyBegin = DateTime.Now; if ( m_StudiedNests.Contains( nest ) ) { m_StudyState = StudyState.Inactive; from.SendLocalizedMessage( 1054047 ); // You glance at the Egg Nest, realizing you've already studied this one. } else { m_StudyState = StudyState.FirstStep; if ( nest.Special ) { from.SendLocalizedMessage( 1054056 ); // You notice something very odd about this Solen Egg Nest. You begin taking notes. } else { from.SendLocalizedMessage( 1054045 ); // You begin studying the Solen Egg Nest to gather information. } if ( from.Female ) { from.PlaySound( 0x30B ); } else { from.PlaySound( 0x419 ); } } } } }