//--------------------------------------------------------------------- void _rattleOn() { if (mbRattleOn || mbDestroy) { return; } mbRattleOn = true; while (mQueEvent.Count > 0) { IEbEvent ev = mQueEvent.Dequeue(); for (int i = mQueCurrentState.Count - 1; i >= 0; i--) { var it = mQueCurrentState[i]; EbState state = it; if (!state._isBindEvent(ev.name)) { continue; } string next_state_name = state._onEvent(ev); if (string.IsNullOrEmpty(next_state_name)) { continue; } if (mbDestroy) { break; } EbState next_state = null; if (mMapState.ContainsKey(next_state_name)) { next_state = mMapState[next_state_name]; } if (next_state == null) { break; } EbState p = next_state._getParentState(); _exitChildState(p); _enterState(next_state); break; } } mbRattleOn = false; }
//--------------------------------------------------------------------- public string _onEvent(IEbEvent ev) { if (mMapAction.ContainsKey(ev.name)) { return(mMapAction[ev.name].action(ev)); } else { return(""); } }
//--------------------------------------------------------------------- public string action(IEbEvent ev) { return(mHandler(ev)); }