/// <summary>
        /// Cleans up the HudManager and Disposes all windows that are
        /// being managed by this HudManager. Use this function when the
        /// plugin is shutting down. Also be sure to unregister
        /// <see cref="GraphicsReset()"/> from the GraphicsReset event.
        /// </summary>
        public void Dispose()
        {
            if (Disposed)
            {
                return;
            }

            if (mRepaintHeartbeat.Running)
            {
                mRepaintHeartbeat.Stop();
            }
            mRepaintHeartbeat.Timeout -= RepaintHeartbeatDispatch;
            mRepaintHeartbeat          = null;

            //Core.WindowMessage -= WindowMessageDispatch;

            // Need to use a copy of the list because the Dispose() method of
            // windows modifies mWindowList.
            UpdateHudsListCopy();
            foreach (IManagedHud hud in mHudsListCopy)
            {
                hud.Dispose();
            }
            mHudsOnTopList.Clear();
            mHudsList.Clear();
            mHudsListCopy.Clear();

            mHost              = null;
            mCore              = null;
            mDefaultView       = null;
            mDefaultViewActive = null;

            mDisposed = true;
        }
        /// <summary>
        /// Constructs a new instance of a HudManager. You <b>must</b> also register
        ///  the GraphicsReset() function for the PluginBase.GraphicsReset event.
        /// </summary>
        /// <param name="host">PluginBase.Host</param>
        /// <param name="core">PluginBase.Core</param>
        /// <param name="startHeartbeatNow">If this is true, the heartbeat
        ///		timer will start ticking right away. This is generally
        ///		undesirable if this HudManager is created in the Startup()
        ///		method of the plugin. If this is false, you must call
        ///		<see cref="StartHeartbeat()"/> at a later time, such as during
        ///		the PlayerLogin event.</param>
        public HudManager(PluginHost host, CoreManager core, MyClasses.MetaViewWrappers.IView defaultView, DefaultViewActiveDelegate defaultViewActive, bool startHeartbeatNow)
        {
            mHost              = host;
            mCore              = core;
            mDefaultView       = defaultView;
            mDefaultViewActive = defaultViewActive;

            mToolTip = new ToolTipHud(this);

            mRepaintHeartbeat          = new DecalTimer();
            mRepaintHeartbeat.Timeout += new Decal.Interop.Input.ITimerEvents_TimeoutEventHandler(RepaintHeartbeatDispatch);
            if (startHeartbeatNow)
            {
                StartHeartbeat();
            }

            //Core.WindowMessage += new EventHandler<WindowMessageEventArgs>(WindowMessageDispatch);
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Cleans up the HudManager and Disposes all windows that are 
		/// being managed by this HudManager. Use this function when the 
		/// plugin is shutting down. Also be sure to unregister 
		/// <see cref="GraphicsReset()"/> from the GraphicsReset event.
		/// </summary>
		public void Dispose()
		{
			if (Disposed)
				return;

			if (mRepaintHeartbeat.Running)
				mRepaintHeartbeat.Stop();
			mRepaintHeartbeat.Timeout -= RepaintHeartbeatDispatch;
			mRepaintHeartbeat = null;

			//Core.WindowMessage -= WindowMessageDispatch;

			// Need to use a copy of the list because the Dispose() method of 
			// windows modifies mWindowList.
			UpdateHudsListCopy();
			foreach (IManagedHud hud in mHudsListCopy)
			{
				hud.Dispose();
			}
			mHudsOnTopList.Clear();
			mHudsList.Clear();
			mHudsListCopy.Clear();

			mHost = null;
			mCore = null;
			mDefaultView = null;
			mDefaultViewActive = null;

			mDisposed = true;
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Constructs a new instance of a HudManager. You <b>must</b> also register
		///  the GraphicsReset() function for the PluginBase.GraphicsReset event.
		/// </summary>
		/// <param name="host">PluginBase.Host</param>
		/// <param name="core">PluginBase.Core</param>
		/// <param name="startHeartbeatNow">If this is true, the heartbeat 
		///		timer will start ticking right away. This is generally 
		///		undesirable if this HudManager is created in the Startup() 
		///		method of the plugin. If this is false, you must call 
		///		<see cref="StartHeartbeat()"/> at a later time, such as during 
		///		the PlayerLogin event.</param>
		public HudManager(PluginHost host, CoreManager core, ViewWrapper defaultView, DefaultViewActiveDelegate defaultViewActive, bool startHeartbeatNow)
		{
			mHost = host;
			mCore = core;
			mDefaultView = defaultView;
			mDefaultViewActive = defaultViewActive;

			mToolTip = new ToolTipHud(this);

			mRepaintHeartbeat = new DecalTimer();
			mRepaintHeartbeat.Timeout += new Decal.Interop.Input.ITimerEvents_TimeoutEventHandler(RepaintHeartbeatDispatch);
			if (startHeartbeatNow)
				StartHeartbeat();

			//Core.WindowMessage += new EventHandler<WindowMessageEventArgs>(WindowMessageDispatch);
		}