Exemplo n.º 1
0
        /// <summary>
        /// Add a new Event go the GetEventLog
        /// </summary>
        /// <param name="eventType">the event's type</param>
        /// <param name="text">the text to show</param>
        /// <param name="onThis">the spatial that created this event</param>
        public void AddEvent(ELogEventType eventType, string text, ISpatial onThis)
        {
            // create a new EventLogItem of the event to add
            if (mLibSans10 == null)
            {
                return;
            }
            mAddedEvent = new EventLogIWindowItem(eventType, text, 180, mLibSans10, mDirector, onThis);

            // enqueue to the event's queue
            mEventList.Enqueue(mAddedEvent);

            mNewEvent = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an EventLogIWindowItem to give to EventLogWindow in UI consisiting of a button and a message
        /// </summary>
        /// <param name="eventType">the event's type</param>
        /// <param name="message">message for the user</param>
        /// <param name="width">width to fit the text to</param>
        /// <param name="spriteFont">textfont</param>
        /// <param name="director">basic director</param>
        /// <param name="onThis">the object where the event is happening</param>
        public EventLogIWindowItem(ELogEventType eventType, string message, float width, SpriteFont spriteFont, Director director, ISpatial onThis)
        {
            mShiftValue = spriteFont.MeasureString("// ").X;
            mText       = new TextField(message, Vector2.Zero, new Vector2(width - mShiftValue, 0), spriteFont, Color.White);
            mInfoBox    = new InfoBoxWindow(new List <IWindowItem> {
                new TextField("To event", Vector2.Zero, spriteFont.MeasureString("To event"), spriteFont, Color.White)
            }, spriteFont.MeasureString("To event"), Color.White, Color.Black, true, director);

            // button to jump to object that created the event
            mPositionButton = new Button("// " + eventType, spriteFont, Vector2.Zero, false, new SpatialPositionEventArgs(onThis))
            {
                Opacity = 1f
            };
            mPositionButton.ButtonHovering    += ShowInfoBox;
            mPositionButton.ButtonHoveringEnd += HideInfoBox;
            mPositionButton.ButtonClicked     += JumpToPosition;

            Size     = new Vector2(width, mPositionButton.Size.Y + mText.Size.Y);
            Position = Vector2.Zero;

            mDirector = director;

            ActiveInWindow = true;
        }