コード例 #1
0
 public void AddAction(KeyboardInputCallback callback)
 {
     if (!callbacks.Contains(callback))
     {
         callbacks.Add(callback);
     }
     else
     {
         Debug.WriteLine("Yritettiin lisätä olemassa olevaa callbackkia bindaukselle {0}", Name);
     }
 }
コード例 #2
0
        /// <summary>
        /// Display the keyboard input panel
        /// </summary>
        /// <param name="graphics">The game's GraphicsDeviceManager (usually the _graphics object)</param>
        /// <param name="callbackfnc">A function to call once the keyboard panel has been used</param>
        /// <param name="title">The title for the panel</param>
        /// <param name="body">The body text for the panel</param>
        /// <param name="initialValue">The initial user text to display in the panel</param>
        public static void BeginShowKeyboardInput(GraphicsDeviceManager graphics, KeyboardInputCallback callbackfnc, string title, string body, string initialValue)
        {
            // Don't do anything if the keyboard input panel is already displayed
            if (KeyboardInputIsVisible) return;

            // Remember that the input panel is now being displayed
            KeyboardInputIsVisible = true;
            // Remember the callback function
            _keyboardInputCallbackFnc = callbackfnc;

            #if WINDOWS_PHONE
            BeginShowKeyboardInput_WP(title, body, initialValue);
            #else
            // Store the game's SwapChainPanel
            _parent = graphics.SwapChainPanel;
            // Show the keyboard 'popup'
            BeginShowKeyboardInput_Win8(title, body, initialValue);
            #endif
        }
コード例 #3
0
        public void Map(KeyTrigger trigger, KeyboardInputCallback callback, InputState inputCondition = (InputState.Down | InputState.Pressed | InputState.Released | InputState.Up))
        {
            if (!Bindings.ContainsKey(trigger.Name))
            {
                KeyboardBinding binding = new KeyboardBinding(trigger.Name);
                Bindings.Add(trigger.Name, binding);
                Bindings[trigger.Name].AddAction(callback);
                Bindings[trigger.Name].Condition = inputCondition;
            }

            if (keyBinds.ContainsKey(trigger.Name))
            {
                return;
            }
            Keys[] keys = new Keys[1 + trigger.AlternateKeys.Length];
            keys[0] = trigger.Key;
            for (int i = 0, j = 1; i < trigger.AlternateKeys.Length; i++, j++)
            {
                keys[j] = trigger.AlternateKeys[i];
            }
            keyBinds.Add(trigger.Name, keys);
        }
コード例 #4
0
        /// <summary>
        /// Display the keyboard input panel
        /// </summary>
        /// <param name="graphics">The game's GraphicsDeviceManager (usually the _graphics object)</param>
        /// <param name="callbackfnc">A function to call once the keyboard panel has been used</param>
        /// <param name="title">The title for the panel</param>
        /// <param name="body">The body text for the panel</param>
        /// <param name="initialValue">The initial user text to display in the panel</param>
        public static void BeginShowKeyboardInput(GraphicsDeviceManager graphics, KeyboardInputCallback callbackfnc, string title, string body, string initialValue)
        {
            // Don't do anything if the keyboard input panel is already displayed
            if (KeyboardInputIsVisible)
            {
                return;
            }

            // Remember that the input panel is now being displayed
            KeyboardInputIsVisible = true;
            // Remember the callback function
            _keyboardInputCallbackFnc = callbackfnc;

#if WINDOWS_PHONE
            BeginShowKeyboardInput_WP(title, body, initialValue);
#else
            // Store the game's SwapChainPanel
            _parent = graphics.SwapChainPanel;
            // Show the keyboard 'popup'
            BeginShowKeyboardInput_Win8(title, body, initialValue);
#endif
        }
コード例 #5
0
ファイル: KeyInputBindProvider.cs プロジェクト: Jntz/jamipeli
        public void Map(KeyTrigger trigger, KeyboardInputCallback callback, InputState inputCondition = (InputState.Down | InputState.Pressed | InputState.Released | InputState.Up))
        {
            if (!Bindings.ContainsKey(trigger.Name))
            {
                KeyboardBinding binding = new KeyboardBinding(trigger.Name);
                Bindings.Add(trigger.Name, binding);
                Bindings[trigger.Name].AddAction(callback);
                Bindings[trigger.Name].Condition = inputCondition;
            }

            if (keyBinds.ContainsKey(trigger.Name))
            {
                return;
            }
            Keys[] keys = new Keys[1 + trigger.AlternateKeys.Length];
            keys[0] = trigger.Key;
            for (int i = 0, j = 1; i < trigger.AlternateKeys.Length; i++, j++)
            {
                keys[j] = trigger.AlternateKeys[i];
            }
            keyBinds.Add(trigger.Name, keys);
        }
コード例 #6
0
ファイル: Binding.cs プロジェクト: Jntz/jamipeli
 public void AddAction(KeyboardInputCallback callback)
 {
     if (!callbacks.Contains(callback))
     {
         callbacks.Add(callback);
     }
     else
     {
         Debug.WriteLine("Yritettiin lisätä olemassa olevaa callbackkia bindaukselle {0}", Name);
     }
 }