//---------------------------------------------------------------------------- /// <summary> /// OnOffEvent /// </summary> /// <param name="guiObject">object to be called from event.</param> //---------------------------------------------------------------------------- protected virtual void OnOffEvent(GUIObject guiObject) { if (Active) { IScriptUpdateable <GUIObject> script; if (m_buttonScripts.TryGetValue("OnOff", out script)) { m_currentScript = script; } else { //Debug.WriteLine("No OnOff Script has been defined.."); } } }
//---------------------------------------------------------------------------- /// <summary> /// Polling method to detect OnClickEvent. /// </summary> /// <param name="sender">sender of event.</param> //---------------------------------------------------------------------------- protected virtual void OnClickEventPolling(object sender) { if (Active && CheckInteraction()) { IScriptUpdateable <GUIObject> script; if (m_buttonScripts.TryGetValue("OnSelectPolling", out script)) { m_currentScript = script; } else { //Debug.WriteLine("No OnClick Script has been defined.."); } if (OnClickPolling != null) { OnClickPolling(this); } m_bSelected = true; } }
//---------------------------------------------------------------------------- /// <summary> /// OnUnClickEvent. /// </summary> /// <param name="sender">sender of event.</param> //---------------------------------------------------------------------------- protected virtual void OnUnClickEvent(object sender) { if (Active && m_bSelected) { IScriptUpdateable <GUIObject> script; if (m_buttonScripts.TryGetValue("OnUnSelect", out script)) { m_currentScript = script; } else { //Debug.WriteLine("No OnClick Script has been defined.."); } if (OnUnClick != null) { OnUnClick(this); } m_bSelected = false; } }
//---------------------------------------------------------------------------- //---------------------------------------------------------------------------- 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); } } } }
//---------------------------------------------------------------------------- /// <summary> /// clears current script /// </summary> //---------------------------------------------------------------------------- private void ScriptComplete() { m_currentScript = null; }