Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        private void UpdateActiveLayers()
        {
            bool isActive = true;
            int  count    = m_ActiveLayers.Count - 1;

            for (int x = count; x >= 0; --x)
            {
                InputLayer layer = m_ActiveLayers[x];
                layer.IsActive = isActive;
                if (isActive)
                {
                    layer.Receiver.UpdateInput(this);
                }
                if (layer.Definition.Block)
                {
                    isActive = false;
                }
            }
        }