//---------------------------------------------------------------------------- /// <summary> /// check for roll on and roll off events. /// </summary> //---------------------------------------------------------------------------- protected virtual void CheckforRoll() { if (CheckInteraction()) { if (m_currentState != GUIInteractStates.RollOn) { if (OnOver != null) { OnOver(this); } m_currentState = GUIInteractStates.RollOn; } } else { if (m_currentState == GUIInteractStates.RollOn) { if (OnOff != null) { OnOff(this); } m_currentState = GUIInteractStates.RollOff; } } }
public GUIObject(List <IScriptUpdateable <Button> > buttonScripts) { Input inputSytem = EngineServices.GetSystem <IGameSystems>().InputSystem; m_buttonScripts = new Dictionary <string, IScriptUpdateable <GUIObject> >(4); m_treeNode = new GUINode(); m_treeNode.UserData = this; m_currentState = GUIInteractStates.Idle; m_mouseObserver = inputSytem.GetMouseObserver(); InitialiseScripts(buttonScripts); ConnectedEvents(inputSytem); EngineServices.GetSystem <IGameSystems>().Components.Add(this); Enabled = true; }
//---------------------------------------------------------------------------- //---------------------------------------------------------------------------- public virtual void Dispose(bool bDisposing) { if (bDisposing) { bool bFlag = false; try { Monitor.Enter(this, ref bFlag); m_treeNode.RemoveNode(true); m_treeNode.Dispose(); m_treeNode = null; m_currentScript = null; m_currentState = GUIInteractStates.Idle; m_buttonScripts.Clear(); m_buttonScripts = null; m_mouseObserver = null; OnClick -= OnClickEvent; OnOff -= OnOffEvent; OnOver -= OnOverEvent; OnUnClick -= OnUnClickEvent; OnClickPolling -= OnClickEventPolling; if (EngineServices.GetSystem <IGameSystems>() != null) { EngineServices.GetSystem <IGameSystems>().Components.Remove(this); } } finally { if (bFlag) { Monitor.Exit(this); } } } }