当前位置: 首页>>代码示例>>C#>>正文


C# EventManager.Notify方法代码示例

本文整理汇总了C#中EventManager.Notify方法的典型用法代码示例。如果您正苦于以下问题:C# EventManager.Notify方法的具体用法?C# EventManager.Notify怎么用?C# EventManager.Notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventManager的用法示例。


在下文中一共展示了EventManager.Notify方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        public override void Update(GameTime gameTime, EventManager events)
        {
            base.Update(gameTime, events);

              #region GamePad

              // GamePad
              P1LastGamePadState = P1GamePadState;
              P1GamePadState = GamePad.GetState(PlayerIndex.One);

              bool left = P1GamePadState.ThumbSticks.Left.X < 0.0f;
              bool right = P1GamePadState.ThumbSticks.Left.X > 0.0f;
              bool jump = (P1GamePadState.Buttons.A == ButtonState.Pressed
            && P1LastGamePadState.Buttons.A == ButtonState.Released);
              bool action = (P1GamePadState.Buttons.B == ButtonState.Released
            && P1LastGamePadState.Buttons.B == ButtonState.Pressed);

              #endregion

              #region Keyboard

              bool keyJump = (keyboard.IsKeyDown(Keys.Up)
            && lastKeyboard.IsKeyUp(Keys.Up));
              bool keyDownLeft = keyboard.IsKeyDown(Keys.Left);
              bool keyDownRight = keyboard.IsKeyDown(Keys.Right);
              bool keyAction = keyboard.IsKeyUp(Keys.Space)
            && lastKeyboard.IsKeyDown(Keys.Space);

              #endregion

              if (action || keyAction) events.Notify(Event.Action, null);
        }
开发者ID:colincapurso,项目名称:LD25,代码行数:32,代码来源:Input.cs

示例2: Update

        public override void Update(GameTime gameTime, EventManager events)
        {
            base.Update(gameTime, events);

              bool spacePressed = CurrentKeyboard.IsKeyUp(Keys.Space)
            && LastKeyboard.IsKeyDown(Keys.Space);

              if (spacePressed)
            events.Notify(Events.ChangeWorld, Worlds.SaveGame);
        }
开发者ID:colincapurso,项目名称:IC2013,代码行数:10,代码来源:Input.cs

示例3: Update

        public virtual void Update(GameTime gameTime, EventManager events)
        {
            // Keyboard
              lastKeyboard = keyboard;
              keyboard = Keyboard.GetState();

              bool pressUp = keyboard.IsKeyUp(Keys.Up) && lastKeyboard.IsKeyDown(Keys.Up);
              bool pressDown = keyboard.IsKeyUp(Keys.Down) && lastKeyboard.IsKeyDown(Keys.Down);
              bool pressLeft = keyboard.IsKeyUp(Keys.Left) && lastKeyboard.IsKeyDown(Keys.Left);
              bool pressRight = keyboard.IsKeyUp(Keys.Right) && lastKeyboard.IsKeyDown(Keys.Right);

              bool downUp = keyboard.IsKeyDown(Keys.Up);
              bool downDown = keyboard.IsKeyDown(Keys.Down);
              bool downLeft = keyboard.IsKeyDown(Keys.Left);
              bool downRight = keyboard.IsKeyDown(Keys.Right);

              bool keyT = keyboard.IsKeyUp(Keys.T) && lastKeyboard.IsKeyDown(Keys.T);
              //bool keyN = keyboard.IsKeyUp(Keys.N) && lastKeyboard.IsKeyDown(Keys.N);

              // Key Press Events
              if (pressUp)
            events.Notify(Event.PressUP, null);

              if (pressDown)
            events.Notify(Event.PressDOWN, null);

              if (pressLeft)
            events.Notify(Event.PressLEFT, null);

              if (pressRight)
            events.Notify(Event.PressRIGHT, null);

              // Key Down Events
              if (downUp)
            events.Notify(Event.KeyDownUP, null);

              if (downDown)
            events.Notify(Event.KeyDownDOWN, null);

              if (downLeft)
            events.Notify(Event.KeyDownLEFT, null);

              if (downRight)
            events.Notify(Event.KeyDownRIGHT, null);

              //if (keyN)
              //  events.Notify(Event.NextScene, null);
        }
开发者ID:colincapurso,项目名称:LD25,代码行数:48,代码来源:AInput.cs

示例4: Update

        public virtual void Update(GameTime gameTime, EventManager events)
        {
            // Keyboard
              LastKeyboard = CurrentKeyboard;
              CurrentKeyboard = Keyboard.GetState();

              // Mouse
              LastMouse = CurrentMouse;
              CurrentMouse = Mouse.GetState();

              bool showInGameMenu = CurrentKeyboard.IsKeyUp(Keys.Escape) && LastKeyboard.IsKeyDown(Keys.Escape);

              bool pressUp = CurrentKeyboard.IsKeyUp(Keys.Up) && LastKeyboard.IsKeyDown(Keys.Up);
              bool pressDown = CurrentKeyboard.IsKeyUp(Keys.Down) && LastKeyboard.IsKeyDown(Keys.Down);
              bool pressLeft = CurrentKeyboard.IsKeyUp(Keys.Left) && LastKeyboard.IsKeyDown(Keys.Left);
              bool pressRight = CurrentKeyboard.IsKeyUp(Keys.Right) && LastKeyboard.IsKeyDown(Keys.Right);

              bool downUp = CurrentKeyboard.IsKeyDown(Keys.Up);
              bool downDown = CurrentKeyboard.IsKeyDown(Keys.Down);
              bool downLeft = CurrentKeyboard.IsKeyDown(Keys.Left);
              bool downRight = CurrentKeyboard.IsKeyDown(Keys.Right);

              bool keyT = CurrentKeyboard.IsKeyUp(Keys.T) && LastKeyboard.IsKeyDown(Keys.T);
              bool keyN = CurrentKeyboard.IsKeyUp(Keys.N) && LastKeyboard.IsKeyDown(Keys.N);
              bool keyP = CurrentKeyboard.IsKeyUp(Keys.P) && LastKeyboard.IsKeyDown(Keys.P);
              bool keyF6 = CurrentKeyboard.IsKeyUp(Keys.F6) && LastKeyboard.IsKeyDown(Keys.F6);

              bool mouseHasMoved = CurrentMouse.X != LastMouse.X || CurrentMouse.Y != LastMouse.Y;
              bool mouseClick = CurrentMouse.LeftButton == ButtonState.Released
            && LastMouse.LeftButton == ButtonState.Pressed;

              if (keyF6)
            Game1.DEBUG = !Game1.DEBUG;

              // Key Press Events
              if (pressUp)
            events.Notify(Events.PressUP, null);

              if (pressDown)
            events.Notify(Events.PressDOWN, null);

              if (pressLeft)
            events.Notify(Events.PressLEFT, null);

              if (pressRight)
            events.Notify(Events.PressRIGHT, null);

              // Key Down Events
              if (downUp)
            events.Notify(Events.DownUP, null);

              if (downDown)
            events.Notify(Events.DownDOWN, null);

              if (downLeft)
            events.Notify(Events.DownLEFT, null);

              if (downRight)
            events.Notify(Events.DownRIGHT, null);

              if (Game1.DEBUG)
              {
            if (keyN)
              events.Notify(Events.NextWorld, null);

            if (keyP)
              events.Notify(Events.ChangeWorld, Worlds.Planet);
              }

              if (mouseHasMoved)
            events.Notify(Events.MouseMove, CurrentMouse);

              if (mouseClick)
            events.Notify(Events.MouseClick, CurrentMouse);

              if (showInGameMenu && !InGameMenu.Visible)
            events.Notify(Events.ShowInGameMenu, null);
              else if (showInGameMenu && InGameMenu.Visible)
            events.Notify(Events.HideInGameMenu, null);
        }
开发者ID:colincapurso,项目名称:IC2013,代码行数:80,代码来源:AInput.cs


注:本文中的EventManager.Notify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。