Пример #1
0
        public Actor CreateActor(ActorDesc desc)
        {
            ActorFactoryMethod factory;

            if (!actorFactories.TryGetValue(desc.GetType(), out factory))
            {
                throw new InvalidOperationException();      // TODO: Message
            }
            var actor   = factory(desc);
            var context = new ActorContext(this, actor);

            actor.Initialize(context, desc);

            actors.Add(desc.Id, context);

            return(actor);
        }
Пример #2
0
 public ActorSnapshot(ActorDesc actorDesc, ISnapshotArgs args)
 {
     Desc = actorDesc;
     Args = args;
 }
Пример #3
0
 internal virtual void Initialize(ActorContext context, ActorDesc desc)
 {
     this.context  = context;
     this.desc     = desc;
     this.snapshot = desc.InitSnapshot();
 }
Пример #4
0
 public TActor CreateActor <TActor>(ActorDesc desc)
     where TActor : Actor, new()
 {
     return((TActor)CreateActor(desc));
 }