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; }
public virtual Image GetImage(Actor item) { return DefaultImage; }
public override Image GetImage(Actor item) { AnimatedActor actor = item as AnimatedActor; if (actor == null) return null; return base.GetImage(item); }