Beispiel #1
0
        /// <summary>
        /// Set position (Bounds) for this item, by ClientBounds of host object.
        /// </summary>
        internal void SetPosition()
        {
            InteractiveControl host = this.Host;

            if (host == null)
            {
                return;
            }

            Rectangle hostBounds = host.ClientItemsRectangle;

            Size maxSize = new Size(hostBounds.Width - 12, hostBounds.Height - 12);
            Size size    = new Size(420, 200);

            if (size.Width > maxSize.Width)
            {
                size.Width = maxSize.Width;
            }
            if (size.Height > maxSize.Height)
            {
                size.Height = maxSize.Height;
            }

            Rectangle bounds = hostBounds.Center().CreateRectangleFromCenter(size);

            this.Bounds = bounds;
        }
Beispiel #2
0
        public void AddFocusedControlHandlers(InteractiveControl control)
        {
            if (control == null)
            {
                return;
            }

            CursorMoveLeft_EventHandler  += control.OnCursorMoveLeft;
            CursorMoveUp_EventHandler    += control.OnCursorMoveUp;
            CursorMoveRight_EventHandler += control.OnCursorMoveRight;
            CursorMoveDown_EventHandler  += control.OnCursorMoveDown;

            ForcedCursorMoveLeft_EventHandler  += control.OnForcedCursorMoveLeft;
            ForcedCursorMoveUp_EventHandler    += control.OnForcedCursorMoveUp;
            ForcedCursorMoveRight_EventHandler += control.OnForcedCursorMoveRight;
            ForcedCursorMoveDown_EventHandler  += control.OnForcedCursorMoveDown;

            PressedCursorMoveLeft_EventHandler  += control.OnPressedCursorMoveLeft;
            PressedCursorMoveUp_EventHandler    += control.OnPressedCursorMoveUp;
            PressedCursorMoveRight_EventHandler += control.OnPressedCursorMoveRight;
            PressedCursorMoveDown_EventHandler  += control.OnPressedCursorMoveDown;

            CursorClick_EventHandler += control.OnCursorClick;

            control?.OnCursorOver(relatedSurface, new CursorEventArgs(relatedSurface.ScreenCursor.CursorPosition, CursorEventType.CursorMove));

            UpdateKeysHandlers();
        }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     NewDirection();
     mGameManager = GameObject.Find("GameManager").GetComponent <GlobalBehavior>();
     mHero        = GameObject.Find("Hero").GetComponent <InteractiveControl>();
     mRenderder   = gameObject.GetComponent <SpriteRenderer>();
     mState       = EnemyState.Normal;
     mSpeed       = kReferenceSpeed;
     mHits        = 0;
     wasScary     = false;
 }
Beispiel #4
0
        internal void Draw(System.Drawing.Graphics graphics)
        {
            InteractiveControl host = this.Host;

            if (host == null)
            {
                return;
            }

            Rectangle bounds = this.BoundsAbsolute;
            int       x      = bounds.X;
            int       y      = bounds.Y;
            int       w      = bounds.Width;
            int       h      = bounds.Height;
            int       b      = bounds.Bottom - 1;

            Painter.DrawWindow(graphics, bounds, this.DataBackColor, System.Windows.Forms.Orientation.Vertical, this.DataOpacity, 2, 4);

            int       progressHeight = Application.App.Zoom.ZoomDistance(21);
            Rectangle progBounds     = new Rectangle(x + 15, b - progressHeight - 10, w - 30, progressHeight);

            Painter.DrawButtonBase(graphics, progBounds, new DrawButtonArgs()
            {
                BackColor = this.DataProgressBackColor
            });

            int       progressWidth = this.GetDataProgressWidth(progBounds.Width - 4);
            Rectangle dataBounds    = new Rectangle(progBounds.X + 2, progBounds.Y + 2, progressWidth, progBounds.Height - 4);

            Painter.DrawRectangle(graphics, dataBounds, this.DataProgressForeColor);

            string progressText = this.GetDataProgressText();

            Painter.DrawString(graphics, progressText, FontInfo.Caption, progBounds, ContentAlignment.MiddleCenter, color: Color.Black);

            string infoCurrent = this.DataInfoCurrent;

            if (!String.IsNullOrEmpty(infoCurrent))
            {
                Rectangle infoBounds = new Rectangle(x + 15, y + 12, w - 32, h - 59);
                FontInfo  fontInfo   = FontInfo.Caption;
                fontInfo.Bold      = true;
                fontInfo.SizeRatio = 1.20f;
                Rectangle realBounds;
                realBounds = Painter.DrawString(graphics, infoCurrent, fontInfo, infoBounds, ContentAlignment.TopLeft, color: this.DataForeColor);
            }
        }
Beispiel #5
0
        public void RemoveFocusedControlHandlers(InteractiveControl control)
        {
            CursorMoveLeft_EventHandler  -= control.OnCursorMoveLeft;
            CursorMoveUp_EventHandler    -= control.OnCursorMoveUp;
            CursorMoveRight_EventHandler -= control.OnCursorMoveRight;
            CursorMoveDown_EventHandler  -= control.OnCursorMoveDown;

            ForcedCursorMoveLeft_EventHandler  -= control.OnForcedCursorMoveLeft;
            ForcedCursorMoveUp_EventHandler    -= control.OnForcedCursorMoveUp;
            ForcedCursorMoveRight_EventHandler -= control.OnForcedCursorMoveRight;
            ForcedCursorMoveDown_EventHandler  -= control.OnForcedCursorMoveDown;

            PressedCursorMoveLeft_EventHandler  -= control.OnPressedCursorMoveLeft;
            PressedCursorMoveUp_EventHandler    -= control.OnPressedCursorMoveUp;
            PressedCursorMoveRight_EventHandler -= control.OnPressedCursorMoveRight;
            PressedCursorMoveDown_EventHandler  -= control.OnPressedCursorMoveDown;

            CursorClick_EventHandler -= control.OnCursorClick;

            control?.OnCursorOut(relatedSurface, new CursorEventArgs(relatedSurface.ScreenCursor.CursorPosition, CursorEventType.CursorMove));
            UpdateKeysHandlers();
        }
Beispiel #6
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="host"></param>
 public ProgressItem(InteractiveControl host)
 {
     this._ProgressData = new ProgressData();
     this.Parent        = host;
     this.Is.Visible    = false;
 }