Пример #1
0
        public static ActorRenderer GetRenderer(Actor item)
        {
            Type renderer = typeof(ActorRenderer);

            // walk the tree until we find a type we have a renderer for
            Type t = item.GetType();
            while (true)
            {
                if (t == typeof(Actor))
                    break;
                if (Renderers.ContainsKey(t))
                {
                    renderer = Renderers[t];
                    break;
                }
                t = t.BaseType;
            }

            if (RenderCache.ContainsKey(renderer))
                return RenderCache[renderer];

            ActorRenderer i = (ActorRenderer)Activator.CreateInstance(renderer);
            RenderCache.Add(renderer, i);
            return i;
        }
Пример #2
0
 public virtual Image GetImage(Actor item)
 {
     return DefaultImage;
 }
Пример #3
0
        public override Image GetImage(Actor item)
        {
            AnimatedActor actor = item as AnimatedActor;
            if (actor == null)
                return null;

            return base.GetImage(item);
        }