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 LayerDefinition GetLayerDefinition(int layerID)
        {
            int count = LayerDefinitions.Count;

            for (int x = 0; x != count; ++x)
            {
                LayerDefinition definition = LayerDefinitions[x];
                if (definition.ID == layerID)
                {
                    return(definition);
                }
            }
            return(null);
        }