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


C# Events.Notify方法代码示例

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


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

示例1: update

        public override void update(GameTime gameTime, Events events)
        {
            base.update(gameTime, events);

              bool anyKey = keyboard.GetPressedKeys().Length == 0
            && lastKeyboard.GetPressedKeys().Length > 0;

              if (anyKey)
            events.Notify(TitleScene.startGame, Screens.Game);
        }
开发者ID:colincapurso,项目名称:FuckThisJamRTS,代码行数:10,代码来源:TitleInput.cs

示例2: update

        public override void update(GameTime gameTime, Events events)
        {
            base.update(gameTime, events);

              bool anyKey = keyboard.GetPressedKeys().Length == 0
            && lastKeyboard.GetPressedKeys().Length > 0;

              if (anyKey)
            events.Notify(EndCreditsScene.startOpeningScene, Screens.Opening);
        }
开发者ID:colincapurso,项目名称:FuckThisJamRTS,代码行数:10,代码来源:EndCreditsInput.cs

示例3: update

        public override void update(GameTime gameTime, Events events)
        {
            base.update(gameTime, events);

              // Mouse
              Point coords = new Point(mouse.X, mouse.Y);
              lastMouse = mouse;
              mouse = Mouse.GetState();

              bool leftMousePress = mouse.LeftButton == ButtonState.Released && lastMouse.LeftButton == ButtonState.Pressed;
              bool rightMousePress = mouse.RightButton == ButtonState.Released && lastMouse.RightButton == ButtonState.Pressed;

              bool leftMouseDown = mouse.LeftButton == ButtonState.Pressed;
              bool rightMouseDown = mouse.RightButton == ButtonState.Pressed;

              bool scrollWheelUp = mouse.ScrollWheelValue > lastMouse.ScrollWheelValue;
              bool scrollWheelDown = mouse.ScrollWheelValue < lastMouse.ScrollWheelValue;

              bool mouseMove = false;

              if (mouse.X != lastMouse.X || mouse.Y != lastMouse.Y)
            mouseMove = true;

              // Mouse Press Events
              if (leftMousePress)
            events.Notify("leftMousePress", coords);

              if (rightMousePress)
            events.Notify("rightMousePress", coords);

              // Mouse Down Events
              if (leftMouseDown)
            events.Notify("leftMouseDown", coords);

              if (rightMouseDown)
            events.Notify("rightMouseDown", coords);

              // Mouse Move
              if (mouseMove)
            events.Notify("mouseMove", coords);

              // Mouse Scroll Wheel Zoom
              if (scrollWheelUp)
            events.Notify("scrollUp", coords);

              if (scrollWheelDown)
            events.Notify("scrollDown", coords);
        }
开发者ID:colincapurso,项目名称:FuckThisJamRTS,代码行数:48,代码来源:GameInput.cs

示例4: update

        public virtual void update(GameTime gameTime, Events 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);

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

              if (pressDown)
            events.Notify("pressDown", null);

              if (pressLeft)
            events.Notify("pressLeft", null);

              if (pressRight)
            events.Notify("pressRight", null);

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

              if (downDown)
            events.Notify("downDown", null);

              if (downLeft)
            events.Notify("downLeft", null);

              if (downRight)
            events.Notify("downRight", null);
        }
开发者ID:colincapurso,项目名称:FuckThisJamRTS,代码行数:42,代码来源:AInput.cs


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