Пример #1
0
 internal override void HandleEvent(WorldEvent e)
 {
     if (!visible)
     {
         return;
     }
     base.HandleEvent(e);
     if (e.Handled)
     {
         return;
     }
     if (!selected)
     {
         return;
     }
     if (e is KeyDownEvent)
     {
         Keys k = (e as KeyDownEvent).Key;
         if (k == Keys.Back || k == Keys.Delete)
         {
             Input((char)8);
         }
         else if (CommonData.KeyCharMap.Keys.Contains(k))
         {
             Input(CommonData.KeyCharMap[k][InputManager.IsKeyDown(Keys.LeftShift) || InputManager.IsKeyDown(Keys.RightShift) ? 1 : 0]);
         }
     }
 }
Пример #2
0
 public void HandleEvent(WorldEvent e, bool forcehandle = false)
 {
     // Send to GUI
     // if not handled send to world
     if (gameover || won)
         main.HandleEvent(e);
 }
Пример #3
0
 public void HandleEvent(WorldEvent e, bool forcehandle = false)
 {
     // Send to GUI
     // if not handled send to world
     if (gameover || won)
     {
         main.HandleEvent(e);
     }
 }
Пример #4
0
 internal override void HandleEvent(WorldEvent e)
 {
     if (!visible)
     {
         return;
     }
     base.HandleEvent(e);
     foreach (UIObject obj in children)
     {
         obj.HandleEvent(e);
     }
     base.HandleEvent(e);
 }
Пример #5
0
 internal static void HandleEvent(WorldEvent e)
 {
     if (!initd) return;
     // Debugging commands
     if (Debugger.IsAttached && e is KeyDownEvent)
     {
         if ((e as KeyDownEvent).Key == Keys.OemTilde)
         {
             // Could open a console here later
         }
     }
     stateManager.CurrentGameState.HandleEvent(e);
 }
Пример #6
0
 internal static void HandleEvent(WorldEvent e)
 {
     if (!initd)
     {
         return;
     }
     // Debugging commands
     if (Debugger.IsAttached && e is KeyDownEvent)
     {
         if ((e as KeyDownEvent).Key == Keys.OemTilde)
         {
             // Could open a console here later
         }
     }
     stateManager.CurrentGameState.HandleEvent(e);
 }
Пример #7
0
        internal override void HandleEvent(WorldEvent e)
        {
            if (!visible || e.Handled)
            {
                return;
            }
            foreach (UIObject obj in siblings)
            {
                obj.HandleEvent(e);
            }
            if (e.Handled)
            {
                return;
            }
            Vector2 pos;

            if (e is MouseUpEvent)
            {
                pos = (e as MouseUpEvent).Position;
            }
            else if (e is TouchTapEvent)
            {
                pos = (e as TouchTapEvent).Position;
            }
            else
            {
                return;
            }
            UIGrid p = parent as UIGrid;

            if (p != null)
            {
                pos = p.Camera.DeTransform(pos);
            }
            if (BoundingBox.ContainsPoint(pos))
            {
                e.Handled = true;
                OnPressed();
                //SoundManager.PlaySound(DataHandler.Sounds[SoundType.TapSound], SoundCategory.SFX); ;
            }

            base.HandleEvent(e);
        }
Пример #8
0
 internal override void HandleEvent(WorldEvent e)
 {
 }
Пример #9
0
 internal virtual void HandleEvent(WorldEvent e)
 {
 }
Пример #10
0
 public void HandleEvent(WorldEvent e, bool forcehandle = false)
 {
     menu.HandleEvent(e);
 }
Пример #11
0
 public void HandleEvent(WorldEvent e, bool forcehandle = false)
 {
     menu.HandleEvent(e);
 }
Пример #12
0
 internal override void HandleEvent(WorldEvent e)
 {
     if (!visible) return;
     base.HandleEvent(e);
     foreach (UIObject obj in children)
         obj.HandleEvent(e);
     base.HandleEvent(e);
 }
Пример #13
0
        internal override void HandleEvent(WorldEvent e)
        {
            if (!visible || e.Handled)
            {
                return;
            }

            if (e is MouseUpEvent && dragging)
            {
                e.Handled = true; dragging = false; if (SnapCameraToCells)
                {
                    SnapCam();
                }
                return;
            }
            foreach (UIVisibleObject b in cells)
            {
                b.HandleEvent(e);
            }
            if (e is TouchFreeDragEvent)
            {
                e.Handled = true;
                if (LockCamera)
                {
                    return;
                }
                TouchFreeDragEvent ev = (e as TouchFreeDragEvent);
                if (!BoundingBox.ContainsPoint(ev.Postion))
                {
                    goto skip;
                }
                Vector2 delta = ev.Delta;
                cam.StepHorizontal(-delta.X);
                cam.StepVertical(-delta.Y);
                return;

                skip : e.Handled = false; return;
            }
            if (e is MouseMovedEvent)
            {
                if (InputManager.isMouseDown(InputManager.MouseKey.LeftKey))
                {
                    e.Handled = true;
                    if (LockCamera)
                    {
                        return;
                    }
                    if (!dragging && !BoundingBox.ContainsPoint((e as MouseMovedEvent).Position))
                    {
                        goto skip;
                    }
                    dragging = true;
                    Vector2 offset = (e as MouseMovedEvent).Offset;
                    cam.StepHorizontal(offset.X);
                    cam.StepVertical(offset.Y);
                    return;

                    skip : e.Handled = false; return;
                }
            }
            if (e is TouchAllFingersOffEvent && SnapCameraToCells)
            {
                SnapCam();
            }
        }
Пример #14
0
 internal virtual void HandleEvent(WorldEvent e)
 {
 }
Пример #15
0
        internal override void HandleEvent(WorldEvent e)
        {
            if (!visible || e.Handled) return;

            if (e is MouseUpEvent && dragging)
            { e.Handled = true; dragging = false; if (SnapCameraToCells) SnapCam(); return; }
            foreach (UIVisibleObject b in cells) b.HandleEvent(e);
            if (e is TouchFreeDragEvent)
            {
                e.Handled = true;
                if (LockCamera) return;
                TouchFreeDragEvent ev = (e as TouchFreeDragEvent);
                if (!BoundingBox.ContainsPoint(ev.Postion)) goto skip;
                Vector2 delta = ev.Delta;
                cam.StepHorizontal(-delta.X);
                cam.StepVertical(-delta.Y);
                return;
            skip: e.Handled = false; return;
            }
            if (e is MouseMovedEvent)
            {
                if (InputManager.isMouseDown(InputManager.MouseKey.LeftKey))
                {
                    e.Handled = true;
                    if (LockCamera) return;
                    if (!dragging && !BoundingBox.ContainsPoint((e as MouseMovedEvent).Position)) goto skip;
                    dragging = true;
                    Vector2 offset = (e as MouseMovedEvent).Offset;
                    cam.StepHorizontal(offset.X);
                    cam.StepVertical(offset.Y);
                    return;
                skip: e.Handled = false; return;
                }
            }
            if (e is TouchAllFingersOffEvent && SnapCameraToCells)
                SnapCam();
        }
Пример #16
0
 internal override void HandleEvent(WorldEvent e)
 {
     if (!visible) return;
     base.HandleEvent(e);
     if (e.Handled) return;
     if (!selected) return;
     if (e is KeyDownEvent)
     {
         Keys k = (e as KeyDownEvent).Key;
         if (k == Keys.Back || k == Keys.Delete)
             Input((char)8);
         else if (CommonData.KeyCharMap.Keys.Contains(k))
             Input(CommonData.KeyCharMap[k][InputManager.IsKeyDown(Keys.LeftShift) || InputManager.IsKeyDown(Keys.RightShift) ? 1 : 0]);
     }
 }
Пример #17
0
 internal override void HandleEvent(WorldEvent e)
 {
 }