Beispiel #1
0
        public void setEventDispatcher(IEventDispatcher argDispatcher)
        {
            dispatcher = argDispatcher;

            // if we have assets waiting for a renderer...
            if (hasAssetsWaitingForRenderer)
            {
                // for all the assets in our collection
                foreach (String s in assets.Keys)
                {
                    Asset a;

                    assets.TryGetValue(s, out a);
                    // if the asset doesnt have a renderer
                    if (a.getRenderer() == null)
                    {
                        // make an event to request a renderer
                        AssetToRendererEvent atre = new AssetToRendererEvent();
                        atre.setAsset(a);

                        // send event
                        dispatcher.submitEvent(atre);
                    }
                }
            }
        }
Beispiel #2
0
        private void addAsset(Asset a)
        {
            if (dispatcher != null)
            {
                // make an event to add a renderer to this asset
                AssetToRendererEvent atre = new AssetToRendererEvent();
                atre.setAsset(a);

                // send event
                dispatcher.submitEvent(atre);
            }
            else // we cannot send an event right away so we'll make sure this gets done once we have a dispatcher
            {
                hasAssetsWaitingForRenderer = true;
            }

            if (!assets.ContainsKey(a.getName()))
            {
                assets.Add(a.getName(), a);
            }
        }