예제 #1
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)
            {
                this.page--;

                if (this.page == -1)
                {
                    this.Menu.Close();
                }

                this.Menu.StartSound(Sfx.PISTOL);
            }

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

            return(true);
        }
예제 #2
0
        public bool DoEvent(DoomEvent e)
        {
            if (this.stage != 2)
            {
                return(false);
            }

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

                // Go into death frame.
                this.castDeath     = true;
                this.castState     = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].DeathState];
                this.castTics      = this.castState.Tics;
                this.castFrames    = 0;
                this.castAttacking = false;

                if (DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].DeathSound != 0)
                {
                    this.StartSound(DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].DeathSound);
                }

                return(true);
            }

            return(false);
        }
예제 #3
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

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

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

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

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

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

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

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

            return(true);
        }
예제 #4
0
        public bool DoEvent(DoomEvent e)
        {
            if (this.gameState == GameState.Level)
            {
                return(this.world.DoEvent(e));
            }
            else if (this.gameState == GameState.Finale)
            {
                return(this.finale.DoEvent(e));
            }

            return(false);
        }
예제 #5
0
        public bool DoEvent(DoomEvent e)
        {
            if (e.Type == EventType.KeyDown)
            {
                this.buffer[this.p] = e.Key.GetChar();

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

                this.CheckBuffer();
            }

            return(true);
        }
예제 #6
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

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

            return(true);
        }
예제 #7
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type == EventType.KeyDown)
            {
                if (this.action != null)
                {
                    this.action();
                }

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

                return(true);
            }

            return(true);
        }
예제 #8
0
        public bool DoEvent(DoomEvent e)
        {
            if (this.active)
            {
                if (this.current.DoEvent(e))
                {
                    return(true);
                }

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

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

                    return(true);
                }

                if (e.Type == EventType.KeyDown && this.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)
                    {
                        this.SetCurrent(this.main);
                        this.Open();
                        this.StartSound(Sfx.SWTCHN);

                        return(true);
                    }
                }

                return(false);
            }
        }
예제 #9
0
        public bool DoEvent(DoomEvent e)
        {
            var ch = e.Key.GetChar();

            if (ch != 0)
            {
                this.text.Add(ch);
                this.typed(this.text);

                return(true);
            }

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

                this.typed(this.text);

                return(true);
            }

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

                return(true);
            }

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

                return(true);
            }

            return(true);
        }
예제 #10
0
        public override bool DoEvent(DoomEvent e)
        {
            if (this.endCount != -1)
            {
                return(true);
            }

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

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

                Sfx sfx;

                if (DoomApplication.Instance.IWad == "doom2" ||
                    DoomApplication.Instance.IWad == "freedoom2" ||
                    DoomApplication.Instance.IWad == "plutonia" ||
                    DoomApplication.Instance.IWad == "tnt")
                {
                    sfx = QuitConfirm.doom2QuitSoundList[this.random.Next() % QuitConfirm.doom2QuitSoundList.Length];
                }
                else
                {
                    sfx = QuitConfirm.doomQuitSoundList[this.random.Next() % QuitConfirm.doomQuitSoundList.Length];
                }

                this.Menu.StartSound(sfx);
            }

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

            return(true);
        }
예제 #11
0
파일: World.cs 프로젝트: MSylvia/DoomEngine
        public bool DoEvent(DoomEvent e)
        {
            if (!this.options.NetGame && this.options.Skill != GameSkill.Nightmare)
            {
                this.cheat.DoEvent(e);
            }

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

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

                return(true);
            }

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

                return(true);
            }

            return(false);
        }
예제 #12
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)
            {
                this.action();
                this.Menu.Close();
                this.Menu.StartSound(Sfx.PISTOL);
            }

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

            return(true);
        }
예제 #13
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

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

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

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

                this.Menu.StartSound(Sfx.PISTOL);
            }

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

            return(true);
        }
예제 #14
0
        public bool DoEvent(DoomEvent e)
        {
            if (this.options.Skill != GameSkill.Nightmare)
            {
                this.cheat.DoEvent(e);
            }

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

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

                return(true);
            }

            if (e.Key == DoomKey.F12 && e.Type == EventType.KeyDown)
            {
                return(true);
            }

            return(false);
        }
예제 #15
0
 public abstract bool DoEvent(DoomEvent e);
예제 #16
0
        public override bool DoEvent(DoomEvent e)
        {
            if (e.Type != EventType.KeyDown)
            {
                return(true);
            }

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

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

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

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

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

            if (e.Key == DoomKey.Left)
            {
                var toggle = this.choice as ToggleMenuItem;

                if (toggle != null)
                {
                    toggle.Down();
                    this.Menu.StartSound(Sfx.PISTOL);
                }

                var slider = this.choice as SliderMenuItem;

                if (slider != null)
                {
                    slider.Down();
                    this.Menu.StartSound(Sfx.STNMOV);
                }
            }

            if (e.Key == DoomKey.Right)
            {
                var toggle = this.choice as ToggleMenuItem;

                if (toggle != null)
                {
                    toggle.Up();
                    this.Menu.StartSound(Sfx.PISTOL);
                }

                var slider = this.choice as SliderMenuItem;

                if (slider != null)
                {
                    slider.Up();
                    this.Menu.StartSound(Sfx.STNMOV);
                }
            }

            if (e.Key == DoomKey.Enter)
            {
                var toggle = this.choice as ToggleMenuItem;

                if (toggle != null)
                {
                    toggle.Up();
                    this.Menu.StartSound(Sfx.PISTOL);
                }

                var simple = this.choice as SimpleMenuItem;

                if (simple != null)
                {
                    if (simple.Selectable)
                    {
                        if (simple.Action != null)
                        {
                            simple.Action();
                        }

                        if (simple.Next != null)
                        {
                            this.Menu.SetCurrent(simple.Next);
                        }
                        else
                        {
                            this.Menu.Close();
                        }
                    }

                    this.Menu.StartSound(Sfx.PISTOL);

                    return(true);
                }

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

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

            return(true);
        }
예제 #17
0
        public bool DoEvent(DoomEvent e)
        {
            if (e.Key == DoomKey.Add || e.Key == DoomKey.Quote)
            {
                if (e.Type == EventType.KeyDown)
                {
                    this.zoomIn = true;
                }
                else if (e.Type == EventType.KeyUp)
                {
                    this.zoomIn = false;
                }

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

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

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

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

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

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

                    if (this.follow)
                    {
                        this.world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_FOLLOWON);
                    }
                    else
                    {
                        this.world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_FOLLOWOFF);
                    }

                    return(true);
                }
            }
            else if (e.Key == DoomKey.M)
            {
                if (e.Type == EventType.KeyDown)
                {
                    if (this.marks.Count < 10)
                    {
                        this.marks.Add(new Vertex(this.viewX, this.viewY));
                    }
                    else
                    {
                        this.marks[this.nextMarkNumber] = new Vertex(this.viewX, this.viewY);
                    }

                    this.nextMarkNumber++;

                    if (this.nextMarkNumber == 10)
                    {
                        this.nextMarkNumber = 0;
                    }

                    this.world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_MARKEDSPOT);

                    return(true);
                }
            }
            else if (e.Key == DoomKey.C)
            {
                if (e.Type == EventType.KeyDown)
                {
                    this.marks.Clear();
                    this.nextMarkNumber = 0;
                    this.world.ConsolePlayer.SendMessage(DoomInfo.Strings.AMSTR_MARKSCLEARED);

                    return(true);
                }
            }

            return(false);
        }