コード例 #1
0
ファイル: Input.cs プロジェクト: DatZach/Californium
        internal bool ProcessInput(InputArgs args)
        {
            if (MouseMove != null)
            {
                var eArgs = args as MouseMoveInputArgs;

                if (eArgs != null)
                    return MouseMove(eArgs);
            }

            if (MouseWheel != null)
            {
                var eArgs = args as MouseWheelInputArgs;

                if (eArgs != null)
                    return MouseWheel(eArgs);
            }

            if (Text != null)
            {
                var eArgs = args as TextInputArgs;

                if (eArgs != null)
                    return Text(eArgs);
            }

            var keyArgs = args as KeyInputArgs;
            if (keyArgs != null)
            {
                KeyEvent e;
                if (Key.TryGetValue(keyArgs.Key, out e))
                    return e(keyArgs);
            }

            var mouseArgs = args as MouseButtonInputArgs;
            if (mouseArgs != null)
            {
                MouseButtonEvent e;
                if (MouseButton.TryGetValue(mouseArgs.Button, out e))
                    return e(mouseArgs);
            }

            return false;
        }
コード例 #2
0
ファイル: Input.cs プロジェクト: DatZach/HumanityAgainstCards
        internal bool ProcessInput(InputArgs args)
        {
            if (MouseMove != null && args is MouseMoveInputArgs)
            {
                var eArgs = (MouseMoveInputArgs)args;
                return MouseMove(eArgs);
            }

            if (args is KeyInputArgs)
            {
                var eArgs = (KeyInputArgs)args;
                KeyEvent e;

                if (Key.TryGetValue(eArgs.Key, out e))
                    return e(eArgs);
            }
            else if (Text != null && args is TextInputArgs)
            {
                var tArgs = (TextInputArgs)args;
                return Text(tArgs);
            }
            else if (args is MouseButtonInputArgs)
            {
                var eArgs = (MouseButtonInputArgs)args;
                MouseButtonEvent e;

                if (MouseButton.TryGetValue(eArgs.Button, out e))
                    return e(eArgs);
            }
            else if (MouseWheel != null && args is MouseWheelInputArgs)
            {
                var eArgs = (MouseWheelInputArgs)args;
                return MouseWheel(eArgs);
            }

            return false;
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: DatZach/HumanityAgainstCards
        private static void DispatchEvent(InputArgs args)
        {
            for (var i = states.Count - 1; i >= 0; i--)
            {
                var state = states[i];

                args.View = state.Camera.View;
                if (states[i].ProcessEvent(args))
                    return;
            }
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: DatZach/Californium
        private static void DispatchEvent(InputArgs args)
        {
            for (var i = StateStack.Count - 1; i >= 0; i--)
            {
                var state = StateStack[i];

                args.View = state.Camera.View;
                if ((state.IsActive || state.InactiveMode.HasFlag(State.UpdateMode.Input)) && state.ProcessEvent(args))
                    return;
            }
        }
コード例 #5
0
ファイル: State.cs プロジェクト: DatZach/Californium
 internal bool ProcessEvent(InputArgs args)
 {
     if (input != null && input.ProcessInput(args))
         return true;
     return Entities.ProcessInput(args);
 }
コード例 #6
0
ファイル: EntityManager.cs プロジェクト: Rohansi/Californium
 public bool ProcessInput(InputArgs args)
 {
     return(inputEntities.Any(e => e.Input.ProcessInput(args)));
 }