示例#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));
 }