Пример #1
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (e.Key == DoomKey.Y ||
                e.Key == DoomKey.Enter ||
                e.Key == DoomKey.Space)
            {
                action();
                Menu.Close();
                Menu.StartSound(Sfx.PISTOL);
            }

            if (e.Key == DoomKey.N ||
                e.Key == DoomKey.Escape)
            {
                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);
            }

            return(true);
        }
Пример #2
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (e.Key == DoomKey.Enter ||
                e.Key == DoomKey.Space ||
                e.Key == DoomKey.LControl ||
                e.Key == DoomKey.RControl)
            {
                page--;
                if (page == -1)
                {
                    Menu.Close();
                }
                Menu.StartSound(Sfx.PISTOL);
            }

            if (e.Key == DoomKey.Escape)
            {
                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);
            }

            return(true);
        }
Пример #3
0
        public bool DoEvent(DoomEvent e)
        {
            if (active)
            {
                if (current.DoEvent(e))
                {
                    return(true);
                }

                if (e.Key == DoomKeys.Escape && e.Type == EventType.KeyDown)
                {
                    Close();
                }

                return(true);
            }
            else
            {
                if (e.Key == DoomKeys.Escape && e.Type == EventType.KeyDown)
                {
                    current = main;
                    Open();
                    return(true);
                }

                if (e.Type == EventType.KeyDown && app.State == ApplicationState.Opening)
                {
                    current = main;
                    Open();
                    return(true);
                }

                return(false);
            }
        }
Пример #4
0
 public void PostEvent(DoomEvent e)
 {
     if (events.Count < 64)
     {
         events.Add(e);
     }
 }
Пример #5
0
        public bool DoEvent(DoomEvent e)
        {
            if (gameState == GameState.Level)
            {
                var am = world.AutoMap;

                if (am.Visible)
                {
                    if (am.DoEvent(e))
                    {
                        return(true);
                    }
                }

                if (e.Key == DoomKeys.Tab && e.Type == EventType.KeyDown)
                {
                    if (am.Visible)
                    {
                        am.Close();
                    }
                    else
                    {
                        am.Open();
                    }
                }

                return(true);
            }

            return(false);
        }
Пример #6
0
        public bool DoEvent(DoomEvent e)
        {
            if (stage != 2)
            {
                return(false);
            }

            if (e.Type == EventType.KeyDown)
            {
                if (castDeath)
                {
                    // Already in dying frames.
                    return(true);
                }

                // Go into death frame.
                castDeath     = true;
                castState     = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)castorder[castNumber].Type].DeathState];
                castTics      = castState.Tics;
                castFrames    = 0;
                castAttacking = false;
                if (DoomInfo.MobjInfos[(int)castorder[castNumber].Type].DeathSound != 0)
                {
                    StartSound(DoomInfo.MobjInfos[(int)castorder[castNumber].Type].DeathSound);
                }

                return(true);
            }

            return(false);
        }
Пример #7
0
 private void KeyReleased(object sender, KeyEventArgs e)
 {
     if (events.Count < 64)
     {
         var de = new DoomEvent();
         de.Type = EventType.KeyUp;
         de.Key  = (DoomKeys)e.Code;
         events.Add(de);
     }
 }
Пример #8
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (textInput != null)
            {
                var result = textInput.DoEvent(e);

                if (textInput.State == TextInputState.Canceled)
                {
                    textInput = null;
                }
                else if (textInput.State == TextInputState.Finished)
                {
                    textInput = null;
                }

                if (result)
                {
                    return(true);
                }
            }

            if (e.Key == DoomKey.Up)
            {
                Up();
                Menu.StartSound(Sfx.PSTOP);
            }

            if (e.Key == DoomKey.Down)
            {
                Down();
                Menu.StartSound(Sfx.PSTOP);
            }

            if (e.Key == DoomKey.Enter)
            {
                textInput = choice.Edit(() => DoSave(index));
                Menu.StartSound(Sfx.PISTOL);
            }

            if (e.Key == DoomKey.Escape)
            {
                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);
            }

            return(true);
        }
Пример #9
0
        public bool DoEvent(DoomEvent e)
        {
            if (e.Type == EventType.KeyDown)
            {
                buffer[p] = e.Key.GetChar();

                p = (p + 1) % buffer.Length;

                CheckBuffer();
            }

            return(true);
        }
Пример #10
0
        public bool DoEvent(DoomEvent e)
        {
            if (gameState == GameState.Level)
            {
                return(world.DoEvent(e));
            }
            else if (gameState == GameState.Finale)
            {
                return(finale.DoEvent(e));
            }

            return(false);
        }
Пример #11
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (e.Key == DoomKey.Escape)
            {
                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);
            }

            return(true);
        }
Пример #12
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type == EventType.KeyDown)
            {
                if (action != null)
                {
                    action();
                }

                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);

                return(true);
            }

            return(true);
        }
Пример #13
0
        public bool DoEvent(DoomEvent e)
        {
            if (active)
            {
                if (current.DoEvent(e))
                {
                    return(true);
                }

                if (e.Key == DoomKey.Escape && e.Type == EventType.KeyDown)
                {
                    Close();
                }

                return(true);
            }
            else
            {
                if (e.Key == DoomKey.Escape && e.Type == EventType.KeyDown)
                {
                    SetCurrent(main);
                    Open();
                    StartSound(Sfx.SWTCHN);
                    return(true);
                }

                if (e.Type == EventType.KeyDown && app.State == ApplicationState.Opening)
                {
                    if (e.Key == DoomKey.Enter ||
                        e.Key == DoomKey.Space ||
                        e.Key == DoomKey.LControl ||
                        e.Key == DoomKey.RControl ||
                        e.Key == DoomKey.Escape)
                    {
                        SetCurrent(main);
                        Open();
                        StartSound(Sfx.SWTCHN);
                        return(true);
                    }
                }

                return(false);
            }
        }
Пример #14
0
        public override bool DoEvent(DoomEvent e)
        {
            if (endCount != -1)
            {
                return(true);
            }

            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (e.Key == DoomKey.Y ||
                e.Key == DoomKey.Enter ||
                e.Key == DoomKey.Space)
            {
                endCount = 0;

                Sfx sfx;
                if (Menu.Options.GameMode == GameMode.Commercial)
                {
                    sfx = doom2QuitSoundList[random.Next() % doom2QuitSoundList.Length];
                }
                else
                {
                    sfx = doomQuitSoundList[random.Next() % doomQuitSoundList.Length];
                }
                Menu.StartSound(sfx);
            }

            if (e.Key == DoomKey.N ||
                e.Key == DoomKey.Escape)
            {
                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);
            }

            return(true);
        }
Пример #15
0
        public bool DoEvent(DoomEvent e)
        {
            if (!options.NetGame && options.Skill != GameSkill.Nightmare)
            {
                cheat.DoEvent(e);
            }

            if (autoMap.Visible)
            {
                if (autoMap.DoEvent(e))
                {
                    return(true);
                }
            }

            if (e.Key == DoomKey.Tab && e.Type == EventType.KeyDown)
            {
                if (autoMap.Visible)
                {
                    autoMap.Close();
                }
                else
                {
                    autoMap.Open();
                }
                return(true);
            }

            if (e.Key == DoomKey.F12 && e.Type == EventType.KeyDown)
            {
                if (options.DemoPlayback || options.Deathmatch == 0)
                {
                    ChangeDisplayPlayer();
                }
                return(true);
            }

            return(false);
        }
Пример #16
0
        public bool DoEvent(DoomEvent e)
        {
            var ch = e.Key.GetChar();

            if (ch != 0)
            {
                text.Add(ch);
                typed(text);
                return(true);
            }

            if (e.Key == DoomKey.Backspace && e.Type == EventType.KeyDown)
            {
                if (text.Count > 0)
                {
                    text.RemoveAt(text.Count - 1);
                }
                typed(text);
                return(true);
            }

            if (e.Key == DoomKey.Enter && e.Type == EventType.KeyDown)
            {
                finished(text);
                state = TextInputState.Finished;
                return(true);
            }

            if (e.Key == DoomKey.Escape && e.Type == EventType.KeyDown)
            {
                canceled();
                state = TextInputState.Canceled;
                return(true);
            }

            return(true);
        }
Пример #17
0
        public bool DoEvent(DoomEvent e)
        {
            if (DoomKeys.A <= e.Key && e.Key <= DoomKeys.Z && e.Type == EventType.KeyDown)
            {
                text.Add((char)(e.Key - DoomKeys.A + 'A'));
                typed(text);
                return(true);
            }

            if (e.Key == DoomKeys.Backspace &&
                e.Type == EventType.KeyDown)
            {
                if (text.Count > 0)
                {
                    text.RemoveAt(text.Count - 1);
                }
                typed(text);
                return(true);
            }

            if (e.Key == DoomKeys.Enter && e.Type == EventType.KeyDown)
            {
                finished(text);
                state = TextInputState.Finished;
                return(true);
            }

            if (e.Key == DoomKeys.Escape && e.Type == EventType.KeyDown)
            {
                canceled();
                state = TextInputState.Canceled;
                return(true);
            }

            return(true);
        }
Пример #18
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (e.Key == DoomKey.Up)
            {
                Up();
                Menu.StartSound(Sfx.PSTOP);
            }

            if (e.Key == DoomKey.Down)
            {
                Down();
                Menu.StartSound(Sfx.PSTOP);
            }

            if (e.Key == DoomKey.Enter)
            {
                if (DoLoad(index))
                {
                    Menu.Close();
                }
                Menu.StartSound(Sfx.PISTOL);
            }

            if (e.Key == DoomKey.Escape)
            {
                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);
            }

            return(true);
        }
Пример #19
0
        public bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (textInput != null)
            {
                var result = textInput.DoEvent(e);

                if (textInput.State == TextInputState.Canceled)
                {
                    textInput = null;
                }
                else if (textInput.State == TextInputState.Finished)
                {
                    textInput = null;
                }

                if (result)
                {
                    return(true);
                }
            }

            if (e.Key == DoomKeys.Up)
            {
                Up();
            }

            if (e.Key == DoomKeys.Down)
            {
                Down();
            }

            if (e.Key == DoomKeys.Left)
            {
                var toggle = choice as ToggleMenuItem;
                if (toggle != null)
                {
                    toggle.Down();
                }

                var slider = choice as SliderMenuItem;
                if (slider != null)
                {
                    slider.Down();
                }
            }

            if (e.Key == DoomKeys.Right)
            {
                var toggle = choice as ToggleMenuItem;
                if (toggle != null)
                {
                    toggle.Up();
                }

                var slider = choice as SliderMenuItem;
                if (slider != null)
                {
                    slider.Up();
                }
            }

            if (e.Key == DoomKeys.Enter)
            {
                var toggle = choice as ToggleMenuItem;
                if (toggle != null)
                {
                    toggle.Up();
                }

                var textBox = choice as TextBoxMenuItem;
                if (textBox != null)
                {
                    textInput = textBox.Edit();
                }

                var simple = choice as SimpleMenuItem;
                if (simple != null && simple.Action != null)
                {
                    simple.Action();
                    menu.Close();
                    return(true);
                }

                if (choice.Next != null)
                {
                    menu.SetCurrent(choice.Next);
                }
            }

            if (e.Key == DoomKeys.Escape)
            {
                menu.Close();
            }

            return(true);
        }
Пример #20
0
        public bool DoEvent(DoomEvent e)
        {
            if (e.Key == DoomKey.Add || e.Key == DoomKey.Quote || e.Key == DoomKey.Equal)
            {
                if (e.Type == EventType.KeyDown)
                {
                    zoomIn = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    zoomIn = false;
                }

                return(true);
            }
            else if (e.Key == DoomKey.Subtract || e.Key == DoomKey.Hyphen || e.Key == DoomKey.Semicolon)
            {
                if (e.Type == EventType.KeyDown)
                {
                    zoomOut = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    zoomOut = false;
                }

                return(true);
            }
            else if (e.Key == DoomKey.Left)
            {
                if (e.Type == EventType.KeyDown)
                {
                    left = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    left = false;
                }

                return(true);
            }
            else if (e.Key == DoomKey.Right)
            {
                if (e.Type == EventType.KeyDown)
                {
                    right = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    right = false;
                }

                return(true);
            }
            else if (e.Key == DoomKey.Up)
            {
                if (e.Type == EventType.KeyDown)
                {
                    up = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    up = false;
                }

                return(true);
            }
            else if (e.Key == DoomKey.Down)
            {
                if (e.Type == EventType.KeyDown)
                {
                    down = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    down = false;
                }

                return(true);
            }
            else if (e.Key == DoomKey.F)
            {
                if (e.Type == EventType.KeyDown)
                {
                    follow = !follow;
                    if (follow)
                    {
                        world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_FOLLOWON);
                    }
                    else
                    {
                        world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_FOLLOWOFF);
                    }
                    return(true);
                }
            }
            else if (e.Key == DoomKey.M)
            {
                if (e.Type == EventType.KeyDown)
                {
                    if (marks.Count < 10)
                    {
                        marks.Add(new Vertex(viewX, viewY));
                    }
                    else
                    {
                        marks[nextMarkNumber] = new Vertex(viewX, viewY);
                    }
                    nextMarkNumber++;
                    if (nextMarkNumber == 10)
                    {
                        nextMarkNumber = 0;
                    }
                    world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_MARKEDSPOT);
                    return(true);
                }
            }
            else if (e.Key == DoomKey.C)
            {
                if (e.Type == EventType.KeyDown)
                {
                    marks.Clear();
                    nextMarkNumber = 0;
                    world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_MARKSCLEARED);
                    return(true);
                }
            }

            return(false);
        }
Пример #21
0
 public void DoEvent(DoomEvent e)
 {
     game.DoEvent(e);
 }
Пример #22
0
        public bool DoEvent(DoomEvent e)
        {
            if (e.Key == DoomKeys.Add)
            {
                if (e.Type == EventType.KeyDown)
                {
                    zoomIn = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    zoomIn = false;
                }

                return(true);
            }
            else if (e.Key == DoomKeys.Subtract)
            {
                if (e.Type == EventType.KeyDown)
                {
                    zoomOut = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    zoomOut = false;
                }

                return(true);
            }
            else if (e.Key == DoomKeys.Left)
            {
                if (e.Type == EventType.KeyDown)
                {
                    left = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    left = false;
                }

                return(true);
            }
            else if (e.Key == DoomKeys.Right)
            {
                if (e.Type == EventType.KeyDown)
                {
                    right = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    right = false;
                }

                return(true);
            }
            else if (e.Key == DoomKeys.Up)
            {
                if (e.Type == EventType.KeyDown)
                {
                    up = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    up = false;
                }

                return(true);
            }
            else if (e.Key == DoomKeys.Down)
            {
                if (e.Type == EventType.KeyDown)
                {
                    down = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    down = false;
                }

                return(true);
            }
            else if (e.Key == DoomKeys.F)
            {
                if (e.Type == EventType.KeyDown)
                {
                    follow = !follow;
                    return(true);
                }
            }

            return(false);
        }
Пример #23
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

            if (textInput != null)
            {
                var result = textInput.DoEvent(e);

                if (textInput.State == TextInputState.Canceled)
                {
                    textInput = null;
                }
                else if (textInput.State == TextInputState.Finished)
                {
                    textInput = null;
                }

                if (result)
                {
                    return(true);
                }
            }

            if (e.Key == DoomKey.Up)
            {
                Up();
                Menu.StartSound(Sfx.PSTOP);
            }

            if (e.Key == DoomKey.Down)
            {
                Down();
                Menu.StartSound(Sfx.PSTOP);
            }

            if (e.Key == DoomKey.Left)
            {
                var toggle = choice as ToggleMenuItem;
                if (toggle != null)
                {
                    toggle.Down();
                    Menu.StartSound(Sfx.PISTOL);
                }

                var slider = choice as SliderMenuItem;
                if (slider != null)
                {
                    slider.Down();
                    Menu.StartSound(Sfx.STNMOV);
                }
            }

            if (e.Key == DoomKey.Right)
            {
                var toggle = choice as ToggleMenuItem;
                if (toggle != null)
                {
                    toggle.Up();
                    Menu.StartSound(Sfx.PISTOL);
                }

                var slider = choice as SliderMenuItem;
                if (slider != null)
                {
                    slider.Up();
                    Menu.StartSound(Sfx.STNMOV);
                }
            }

            if (e.Key == DoomKey.Enter)
            {
                var toggle = choice as ToggleMenuItem;
                if (toggle != null)
                {
                    toggle.Up();
                    Menu.StartSound(Sfx.PISTOL);
                }

                var simple = choice as SimpleMenuItem;
                if (simple != null)
                {
                    if (simple.Selectable)
                    {
                        if (simple.Action != null)
                        {
                            simple.Action();
                        }
                        if (simple.Next != null)
                        {
                            Menu.SetCurrent(simple.Next);
                        }
                        else
                        {
                            Menu.Close();
                        }
                    }
                    Menu.StartSound(Sfx.PISTOL);
                    return(true);
                }

                if (choice.Next != null)
                {
                    Menu.SetCurrent(choice.Next);
                    Menu.StartSound(Sfx.PISTOL);
                }
            }

            if (e.Key == DoomKey.Escape)
            {
                Menu.Close();
                Menu.StartSound(Sfx.SWTCHX);
            }

            return(true);
        }
Пример #24
0
 public abstract bool DoEvent(DoomEvent e);