Exemple #1
0
    //根据当前状态和转换条件进行状态切换
    public void doTransition(ENUM_StateCondition stateCondition)
    {
        ENUM_State newStateType = CurState.Transitions[stateCondition];

        CurState     = m_states[newStateType];
        CurStateType = newStateType;
    }
Exemple #2
0
 public void removeTransiton(ENUM_StateCondition stateCondition, ENUM_State state)
 {
     if (m_transitions.ContainsKey(stateCondition))
     {
         m_transitions.Remove(stateCondition);
     }
 }
        private static void OnStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RunPauseStopIcon owner = d as RunPauseStopIcon;
            ENUM_State       state = (ENUM_State)e.NewValue;

            switch (state)
            {
            case ENUM_State.Run:
                owner.icon_run.Visibility   = Visibility.Visible;
                owner.icon_pause.Visibility = Visibility.Hidden;
                owner.icon_stop.Visibility  = Visibility.Hidden;
                break;

            case ENUM_State.Pause:
                owner.icon_run.Visibility   = Visibility.Hidden;
                owner.icon_pause.Visibility = Visibility.Visible;
                owner.icon_stop.Visibility  = Visibility.Hidden;
                break;

            case ENUM_State.Stop:
                owner.icon_run.Visibility   = Visibility.Hidden;
                owner.icon_pause.Visibility = Visibility.Hidden;
                owner.icon_stop.Visibility  = Visibility.Visible;
                break;
            }
        }
Exemple #4
0
    public abstract void act(); //当前状态下的行为

    //添加 转换--状态 键值对
    public void addTransiton(ENUM_StateCondition stateCondition, ENUM_State state)
    {
        if (!m_transitions.ContainsKey(stateCondition))
        {
            m_transitions.Add(stateCondition, state);
        }
    }