/// <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);
        }
Example #3
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);
		}
Example #4
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;
		}
Example #5
0
		/// <summary>Creates a new instance of a WindowHud.</summary>
		/// <param name="region">The size and location of the entire window, 
		///		including the title bar.</param>
		/// <param name="title">The title of the window.</param>
		/// <param name="manager">The manager for this window.</param>
		public WindowHud(Rectangle region, string title, HudManager manager)
		{
			mRegion = ConstrainRegion(region);
			mClientRegion = CalculateClientRegion(mRegion);

			mClientImage = new Bitmap(mClientRegion.Width, mClientRegion.Height);

			mTitle = title;
			mManager = manager;

			mFaderTimer = new DecalTimer();
			mFaderTimer.Timeout += new Decal.Interop.Input.ITimerEvents_TimeoutEventHandler(FaderTimer_Timeout);

			// For fading
			MouseEnter += new EventHandler<HudMouseEventArgs>(FadeIn);
			MouseLeave += new EventHandler<HudMouseEventArgs>(FadeOut);

			// This will call RecreateHud()
			Manager.RegisterHud(this, false);
		}