private void AnimationSequenceFocusUpdate(IInputReceiver inputReceiver)
        {
            Keyboard keyboard = InputManager.Keyboard;

            #region Delete

            if (keyboard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Delete))
            {
                // Check to see which object is current and delete it

                // If a CurrentTimedKeyframeList is not null, then the CurrentAnimationSequence is also not null.
                // Therefore, always check "bottom up" or else the wrong thing will be deleted.
                if (EditorData.EditorLogic.CurrentTimedKeyframeList != null)
                {
                    EditorData.EditorLogic.CurrentAnimationSequence.Remove(EditorData.EditorLogic.CurrentTimedKeyframeList);
                    UpdateLists();
                }

                else if (EditorData.EditorLogic.CurrentAnimationSequence != null)
                {
                    EditorData.GlobalInstructionSets.Remove(EditorData.EditorLogic.CurrentAnimationSequence);
                    EditorData.EditorLogic.CurrentAnimationSequence = null;
                    UpdateLists();
                }
            }

            #endregion
        }
 // July 10, 2011
 // These two methods
 // were previously not
 // implemented - the FocusUpdate
 // and GainFocus events were not being
 // used.  I implemented them.  Hopefully
 // this doesn't cause issues if the engine
 // raises these events...but I think it should
 // be okay.
 void OnFocusUpdateInternal(IInputReceiver inputReceiver)
 {
     if (this.FocusUpdate != null)
     {
         this.FocusUpdate(this);
     }
 }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        _input = GetComponent <IInputReceiver>();
        _mat   = Renderer.material;

        UpdateColor();
    }
Beispiel #4
0
    public void OnInit(IInputReceiver _receiver)
    {
        m_playerCtrl = _receiver;

        TGInputSetting.Touch.touchDimension   = touchDimension;
        TGInputSetting.Touch.rayMaskForThreeD = rayMaskFor3D;
    }
    // Use this for initialization
    void Start()
    {
        _input = GetComponent<IInputReceiver>();
        _mat = Renderer.material;

        UpdateColor();
    }
Beispiel #6
0
        protected void PushReceiver(IInputReceiver receiver, int layerID)
        {
            if (IndexOfReceiver(receiver) >= 0)
            {
                throw new ArgumentException("Receiver is already active");
            }

            LayerDefinition definition = GetLayerDefinition(layerID);

            if (definition == null)
            {
                throw new ArgumentNullException(string.Format("Layer with ID: {0} was not found.", layerID));
            }

            InputLayer newLayer = new InputLayer(receiver, definition);

            int count = m_ActiveLayers.Count;

            for (int x = 0; x != count; ++x)
            {
                InputLayer layer = m_ActiveLayers[x];
                if (layer.Definition.Priority > definition.Priority)
                {
                    m_ActiveLayers.Insert(x, newLayer);
                    return;
                }
            }
            m_ActiveLayers.Add(newLayer);
        }
Beispiel #7
0
 private void SpriteListFocusUpdate(IInputReceiver inputReceiver)
 {
     if (InputManager.Keyboard.KeyPushed(Microsoft.DirectX.DirectInput.Key.Delete))
     {
         GameData.DeleteCurrentSprites();
     }
 }
Beispiel #8
0
 public static void SetInputReceivingEnabled(this IInputReceiver r, bool isEnabled, bool cacheCurState = true)
 {
     foreach (InputTransmitter t in r.AttachedInputTransmitterList)
     {
         t.SetTransmissionEnabled(isEnabled, cacheCurState);
     }
 }
Beispiel #9
0
 public static void SetInputReceivingToPrevState(this IInputReceiver r)
 {
     foreach (InputTransmitter t in r.AttachedInputTransmitterList)
     {
         t.SetTransmissionStateToPrevState();
     }
 }
Beispiel #10
0
    public static void RemoveInputListener <T>(this IInputReceiver r, InputTransmitter.EventDelegate <T> callback)
        where T : InputEvent
    {
        if (r.Delegates == null)
        {
            return;
        }

        InputTransmitter.EventDelegate internalDel;

        if (r.DelegateLookUp.TryGetValue(callback, out internalDel))
        {
            InputTransmitter.EventDelegate tempDel;
            if (r.Delegates.TryGetValue(typeof(T), out tempDel))
            {
                tempDel -= internalDel;

                if (tempDel == null)
                {
                    r.Delegates.Remove(typeof(T));
                }
                else
                {
                    r.Delegates[typeof(T)] = tempDel;
                }
            }

            r.DelegateLookUp.Remove(callback);
        }
    }
        private void InstructionListHotkeyUpdate(IInputReceiver receiver)
        {
            #region Delete

            if (InputManager.Keyboard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Delete))
            {
                object highlightedObject = mInstructionSetListBox.GetFirstHighlightedObject();

                if (highlightedObject is KeyframeList)
                {
                    EditorData.EditorLogic.CurrentInstructionSet.Remove(highlightedObject as KeyframeList);

                    EditorData.EditorLogic.CurrentKeyframe = null;

                    EditorData.EditorLogic.CurrentKeyframeList = null;

                    UpdateLists();
                }
                else if (highlightedObject is InstructionList)
                {
                    EditorData.EditorLogic.CurrentKeyframeList.Remove(highlightedObject as InstructionList);
                    UpdateLists();
                }
            }

            #endregion
        }
 void Start()
 {
     // Components
     _input = GetComponent<IInputReceiver>();
     //_teamController = GetComponent<TeamController>();
     _playerController = GetComponent<PlayerController>();
     _cursorCanvas = CursorUI.GetComponent<Canvas>();
 }
 void Start()
 {
     // Components
     _input = GetComponent <IInputReceiver>();
     //_teamController = GetComponent<TeamController>();
     _playerController = GetComponent <PlayerController>();
     _cursorCanvas     = CursorUI.GetComponent <Canvas>();
 }
Beispiel #14
0
        public Mastermind(IRandomNumberGenerator randomNumberGenerator, IInputReceiver inputReceiver)
        {
            _inputCentral   = new InputCentral(inputReceiver);
            _keyPegsCreator = new KeyPegsCreator();
            _winnerFinder   = new WinnerFinder();
            var codePegs = new CodePegsGenerator(randomNumberGenerator).Generate();

            _decodingBoard = new DecodingBoard(codePegs);
        }
        /// <summary>Initializes a new input capturer using the specified input service</summary>
        /// <param name="inputService">Input service the capturer will subscribe to</param>
        public DefaultInputCapturer(IGuiInputService inputService)
        {
            _inputService  = inputService;
            _inputReceiver = new DummyInputReceiver();

            _keyboardListener = inputService.KeyboardListener;
            _mouseListener    = inputService.MouseListener;
            _gamePadListener  = inputService.GamePadListener;

            SubscribeInputDevices();
        }
        // Hook this receiver to all input events.
        public static void SubscribeToInputEvents(this IInputReceiver receiver)
        {
            SpeechInputListener.Instance.SpeechInputEvent += receiver.OnSpeechInputEvent;

            GestureInputListener.Instance.OneHandTap         += receiver.OnOneHandTap;
            GestureInputListener.Instance.OneHandDoubleTap   += receiver.OnOneHandDoubleTap;
            GestureInputListener.Instance.OneHandManipStart  += receiver.OnOneHandManipStart;
            GestureInputListener.Instance.TwoHandManipStart  += receiver.OnTwoHandManipStart;
            GestureInputListener.Instance.ManipulationUpdate += receiver.OnManipulationUpdate;
            GestureInputListener.Instance.ManipulationEnd    += receiver.OnManipulationEnd;
        }
Beispiel #17
0
        /// <summary>
        /// Removes an object that no longer wishes to be notified about navigational commands.
        /// </summary>
        /// <param name="receiver">The object to no longer receive the commands.</param>
        public void RemoveReceiver(IInputReceiver receiver)
        {
            #region Sanity checks
            if (receiver == null)
            {
                throw new ArgumentNullException(nameof(receiver));
            }
            #endregion

            _receivers.Remove(receiver);
        }
Beispiel #18
0
        public bool PopReceiver(IInputReceiver receiver)
        {
            int index = IndexOfReceiver(receiver);

            if (index == -1)
            {
                return(false);
            }
            m_ActiveLayers.RemoveAt(index);
            return(true);
        }
Beispiel #19
0
        /// <summary>Mocks a receiver for the input processing of a control</summary>
        /// <param name="screen">Screen to mock an input receiver on</param>
        /// <returns>The mocked input receiver</returns>
        private IInputReceiver mockReceiver(Screen screen)
        {
            IInputReceiver mockedReceiver = this.mockery.NewMock <IInputReceiver>();

            DelegatingControl delegatingControl = new DelegatingControl(mockedReceiver);

            screen.Desktop.Children.Add(delegatingControl);
            screen.FocusedControl = delegatingControl;

            return(mockedReceiver);
        }
Beispiel #20
0
    public static void DeattachInputTransmitter(this IInputReceiver r, InputTransmitter t)
    {
        if (r.AttachedInputTransmitterList == null)
        {
            return;
        }

        r.AttachedInputTransmitterList.Remove(t);

        t.Dispose();
    }
Beispiel #21
0
    public static void SetInputReceivingToPrevState <T>(this IInputReceiver r)
        where T : InputTransmitter
    {
        T t = (T)r.AttachedInputTransmitterList.SingleOrDefault(val => val is T);

        if (t == null)
        {
            return;
        }

        t.SetTransmissionStateToPrevState();
    }
    public static void DeattachInputTransmitter <T>(IInputReceiver r)
        where T : InputTransmitter, new()
    {
        T transmitter = (T)r.AttachedInputTransmitterList.SingleOrDefault(val => val is T);

        if (transmitter == default(T))
        {
            return;
        }

        r.DeattachInputTransmitter(transmitter);
    }
Beispiel #23
0
    public static void SetInputReceivingEnabled <T>(this IInputReceiver r, bool isEnabled, bool cacheCurState = true)
        where T : InputTransmitter
    {
        T t = (T)r.AttachedInputTransmitterList.SingleOrDefault(val => val is T);

        if (t == null)
        {
            return;
        }

        t.SetTransmissionEnabled(isEnabled, cacheCurState);
    }
Beispiel #24
0
    public static void AttachInputTransmitter(this IInputReceiver r, InputTransmitter t)
    {
        if (r.AttachedInputTransmitterList == null)
        {
            r.AttachedInputTransmitterList = new List <InputTransmitter>();
        }

        if (r.AttachedInputTransmitterList.Contains(t))
        {
            return;
        }

        r.AttachedInputTransmitterList.Add(t);
    }
Beispiel #25
0
        protected int IndexOfReceiver(IInputReceiver receiver)
        {
            int count = m_ActiveLayers.Count;

            for (int x = 0; x != count; ++x)
            {
                InputLayer layer = m_ActiveLayers[x];
                if (layer.Receiver == receiver)
                {
                    return(x);
                }
            }
            return(-1);
        }
        public void Add(IInputReceiver input)
        {
            //validate
            if (input == null || _permissions.ContainsKey(input))
            {
                return;
            }

            //add
            var permission = new InputPermissions(this, input);

            _permissions.Add(input, permission);

            UpdatePermissions();
            input.ReceivedInputControl(permission);
        }
Beispiel #27
0
        private void TextureListBoxFocusUpdate(IInputReceiver inputReceiver)
        {
            if (InputManager.Keyboard.KeyPushed(Microsoft.DirectX.DirectInput.Key.Delete))
            {
                bool doAnyItemsReferenceTexture = false;

                if (!doAnyItemsReferenceTexture)
                {
                    object highlightedObject = textureListBox.GetFirstHighlightedObject();

                    if (highlightedObject != null && highlightedObject is Texture2D)
                    {
                        GameData.DeleteTexture(highlightedObject as Texture2D);
                    }
                }
            }
        }
Beispiel #28
0
        private void FocusUpdate(IInputReceiver inputReceiver)
        {
            if (InputManager.Keyboard.KeyPushed(Keys.Delete))
            {
                EditorData.EditorLogic.DeleteCurrentEmitter();
            }

            if (InputManager.Keyboard.KeyPushed(Keys.Space) && AppState.Self.CurrentEmitter != null)
            {
                AppState.Self.CurrentEmitter.Emit(null);
            }

            if (InputManager.Keyboard.KeyPushed(Keys.C))
            {
                GuiData.ActivityWindow.ClearAllParticles();
            }
        }
        public void Remove(IInputReceiver input)
        {
            //validate
            if (input == null || !_permissions.ContainsKey(input))
            {
                return;
            }

            var permission = _permissions[input];

            _permissions.Remove(input);

            UpdatePermissions();
            permission.CanUseMouse    = false;
            permission.CanUseKeyboard = false;
            input.RevokedInputControl(permission);
        }
    public void Start()
    {
        // Components
        _rb               = GetComponent <Rigidbody>();
        _input            = GetComponent <IInputReceiver>();
        _weaponController = GetComponent <WeaponController>();
        _transf           = transform;
        //_mat = MeshRender.material;
        _animator = GetComponentInChildren <Animator>();
        _teamC    = GetComponent <TeamController>();

        // Colorize
        //_mat.color = PlayerColor;

        //
        _prevForward = _transf.forward;
    }
    public static T AttachInputTransmitter <T>(IInputReceiver r, bool isTransmissionEnabled = true)
        where T : InputTransmitter, new()
    {
        if (r.AttachedInputTransmitterList != null &&
            r.AttachedInputTransmitterList.Any(val => val is T))
        {
            return((T)r.AttachedInputTransmitterList.SingleOrDefault(val => val is T));
        }

        T it = new T()
        {
            _receiver = r
        };

        it._receiver.AttachInputTransmitter(it);
        it.IsTransmissionEnabled = isTransmissionEnabled;

        return(it);
    }
        private void FocusUpdate(IInputReceiver inputReceiver)
        {
            if (InputManager.Keyboard.KeyPushed(Keys.Delete))
            {
                EditorData.EditorLogic.DeleteCurrentEmitter();
                
            }

            if (InputManager.Keyboard.KeyPushed(Keys.Space) && AppState.Self.CurrentEmitter != null)
            {
                AppState.Self.CurrentEmitter.Emit(null);

            }

            if (InputManager.Keyboard.KeyPushed(Keys.C))
            {
                GuiData.ActivityWindow.ClearAllParticles();
            }
        }
        public void OnInputRequest(InputRequestData requestData, IInputReceiver inputReceiver)
        {
            Console.WriteLine($"TransactionListener OnInputRequest InputRequestData: {requestData} , IInputReceiver: {inputReceiver}");
            // Get information about the request for input from the terminal
            InputRequestType inputType    = requestData.InputType;
            DeviceType       inputDevice  = requestData.DeviceType;
            string           inputDefault = requestData.DefaultInputString;
            int?           inputTimeout   = requestData.TimeoutInSeconds;
            int?           inputMinLength = requestData.MinLength;
            int?           inputMaxLength = requestData.MaxLength;
            DisplayOutput  output         = requestData.DisplayOutput;
            DeviceType     outputDevice   = output.DeviceType;
            DisplayContent outputContent  = output.Content;

            if (outputContent.Format == DisplayFormatType.Text)
            {
                ContentText contentText             = outputContent.Text;
                string      plainTextDisplayMessage = contentText.PlainText;
            }
            // Return user input
            inputReceiver.InputText("1234"); //see chapter "Input requests" for details
        }
Beispiel #34
0
 public void Bind(ApKeyBind _abk, IInputReceiver _sender)
 {
     //ugly BUT it works
     _abk.Sender = _sender;
     KeyBinds.Add(_abk);
 }
Beispiel #35
0
        private void AnimationSequenceFocusUpdate(IInputReceiver inputReceiver)
        {
            Keyboard keyboard = InputManager.Keyboard;

            #region Delete

            if (keyboard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Delete))
            {
                // Check to see which object is current and delete it

                // If a CurrentTimedKeyframeList is not null, then the CurrentAnimationSequence is also not null.
                // Therefore, always check "bottom up" or else the wrong thing will be deleted.
                if (EditorData.EditorLogic.CurrentTimedKeyframeList != null)
                {
                    EditorData.EditorLogic.CurrentAnimationSequence.Remove(EditorData.EditorLogic.CurrentTimedKeyframeList);
                    UpdateLists();

                }

                else if (EditorData.EditorLogic.CurrentAnimationSequence != null)
                {
                    EditorData.GlobalInstructionSets.Remove(EditorData.EditorLogic.CurrentAnimationSequence);
                    EditorData.EditorLogic.CurrentAnimationSequence = null;
                    UpdateLists();

                }

            }

            #endregion
        }
Beispiel #36
0
 // July 10, 2011
 // These two methods
 // were previously not
 // implemented - the FocusUpdate
 // and GainFocus events were not being
 // used.  I implemented them.  Hopefully
 // this doesn't cause issues if the engine
 // raises these events...but I think it should
 // be okay.
 void OnFocusUpdateInternal(IInputReceiver inputReceiver)
 {
     if (this.FocusUpdate != null)
     {
         this.FocusUpdate(this);
     }
 }
Beispiel #37
0
 /// <summary>Initializes a new input delegating control</summary>
 /// <param name="receiver">Receiver to which the input is delegated</param>
 public DelegatingControl(IInputReceiver receiver) {
   this.receiver = receiver;
 }
Beispiel #38
0
        private void InstructionListHotkeyUpdate(IInputReceiver receiver)
        {
            #region Delete

            if (InputManager.Keyboard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Delete))
            {
                object highlightedObject = mInstructionSetListBox.GetFirstHighlightedObject();

                if (highlightedObject is KeyframeList)
                {
                    EditorData.EditorLogic.CurrentInstructionSet.Remove(highlightedObject as KeyframeList);

                    EditorData.EditorLogic.CurrentKeyframe = null;

                    EditorData.EditorLogic.CurrentKeyframeList = null;

                    UpdateLists();
                }
                else if (highlightedObject is InstructionList)
                {
                    EditorData.EditorLogic.CurrentKeyframeList.Remove(highlightedObject as InstructionList);
                    UpdateLists();
                }
            }

            #endregion
        }
    void Awake()
    {
        target = this.gameObject.GetComponent<IInputReceiver>();

        
    }
    public void Start()
    {
        // Components
        _rb = GetComponent<Rigidbody>();
        _input = GetComponent<IInputReceiver>();
        _weaponController = GetComponent<WeaponController>();
        _transf = transform;
        //_mat = MeshRender.material;
        _animator = GetComponentInChildren<Animator>();
        _teamC = GetComponent<TeamController>();

        // Colorize
        //_mat.color = PlayerColor;

        //
        _prevForward = _transf.forward;
    }