示例#1
0
 public RailLine(ModelStorage db, ModelListener lis)
 {
     storage  = db;
     listener = lis;
     storage.Add(this);
     listener.Fire(EventType.CREATED, this);
 }
示例#2
0
 public Action(ModelStorage db, ModelListener lis, ModelFactory f)
 {
     storage  = db;
     listener = lis;
     factory  = f;
     Actions  = new LinkedList <Transactional>();
 }
示例#3
0
 public DeptTask(ModelStorage db, ModelListener lis, RailLine l, Platform p, LineTask lt) : base(db, lis, l, lt)
 {
     Stay = p;
     Stay.Depts.AddLast(this);
     db.Add(this);
     Queue  = new LinkedList <Human>();
     router = new RouterImpl(this);
     listener.Fire(EventType.CREATED, this);
 }
示例#4
0
 public StayTask(ModelListener lis, Train t, DeptTask dept, OnComplete fn) : base(t, fn)
 {
     org        = dept;
     listener   = lis;
     onComplete = () =>
     {
         // 積み残しがあるまま発車
         InQueue.ToList().ForEach(h =>
         {
             h.State   = Human.StateType.WAIT_TRAIN_ARRIVAL;
             h.OnTrain = null;
         });
         fn();
     };
     org      = dept;
     OutQueue = new LinkedList <Human>();
     InQueue  = new LinkedList <Human>();
     org.Trains.Add(train);
 }
 public void removeListener(ModelListener l)
 {
     scheduler.Add(() => { if (registeredListeners.Contains(l)) { registeredListeners.Remove(l); } });
 }
 public void addListener(ModelListener l)
 {
     scheduler.Add(() => { if (!registeredListeners.Contains(l)) { registeredListeners.Add(l); } });
 }
示例#7
0
 public void addModelListener(ModelListener l)
 {
     modelListeners.Add(l);
 }
 public void unregisterModelListener(ModelListener listener)
 {
     _service.unregisterModelListener(listener, _caller);
 }
示例#9
0
 public WaitEvent(ModelListener lis, Human.StateType s)
 {
     state    = s;
     listener = lis;
 }
示例#10
0
 protected LineTask(ModelStorage db, ModelListener lis)
 {
     Trains   = new List <Train>();
     listener = lis;
     storage  = db;
 }
 public void unregisterModelListener(ModelListener listener, String callerPath)
 {
     modelListeners.removeListener(listener);
 }
示例#12
0
 public EdgeTask(ModelStorage db, ModelListener lis, RailLine l, RailEdge re, LineTask lt) : base(db, lis, l, lt)
 {
     Edge = re;
     db.Add(this);
     listener.Fire(EventType.CREATED, this);
 }
示例#13
0
 public TrainExecutor(ModelListener lis, Train t, LineTask lt)
 {
     listener = lis;
     train    = t;
     Current  = Generate(lt, () => Next());
 }
 public CreateLineAction(ModelStorage db, ModelListener lis, RailLine line, RollbackFn fn) : this(db, lis)
 {
     prevLine = line;
     rollback = fn;
 }
 public CreateLineAction(ModelStorage db, ModelListener lis)
 {
     storage  = db;
     listener = lis;
 }
示例#16
0
    public TestUtils()
    {
        storage  = new GameObject().AddComponent <ModelStorage>();
        listener = new GameObject().AddComponent <ModelListener>();
        factory  = new GameObject().AddComponent <ModelFactory>();

        var co = new GameObject();

        co.AddComponent <SpriteRenderer>();
        factory.c = c = co.AddComponent <Company>();

        var ro = new GameObject();

        ro.AddComponent <SpriteRenderer>();
        factory.r = r = ro.AddComponent <Residence>();

        factory.rn = rn = new GameObject().AddComponent <RailNode>();

        factory.re = re = new GameObject().AddComponent <RailEdge>();

        var rpo = new GameObject();

        rpo.AddComponent <MeshRenderer>();
        factory.rp = rp = rpo.AddComponent <RailPart>();

        var sto = new GameObject();

        sto.AddComponent <SpriteRenderer>();
        factory.st = st = sto.AddComponent <Station>();

        factory.p = p = new GameObject().AddComponent <Platform>();

        factory.g = g = new GameObject().AddComponent <Gate>();

        var to = new GameObject();

        to.AddComponent <SpriteRenderer>();
        factory.t = t = to.AddComponent <Train>();

        var ho = new GameObject();

        ho.AddComponent <SpriteRenderer>();
        factory.h = h = ho.AddComponent <Human>();

        var ureso = new GameObject();

        ures = ureso.AddComponent <UserResource>();

        var transo = new GameObject();

        trans = transo.AddComponent <Transport>();

        var routeo = new GameObject();

        route       = routeo.AddComponent <Route>();
        route.trans = trans;

        c.listener = r.listener = rn.listener = re.listener = rp.listener = st.listener = p.listener = g.listener = t.listener = h.listener = ures.listener = trans.listener = route.listener = listener;
        c.storage  = r.storage = rn.storage = re.storage = rp.storage = st.storage = p.storage = g.storage = t.storage = h.storage = ures.storage = trans.storage = route.storage = storage;
        r.factory  = rn.factory = re.factory = st.factory = ures.factory = factory;
        t.resource = trans.resource = route.resource = ures;
    }
示例#17
0
 public RouterImpl(ModelListener lis, Gate g)
 {
     listener = lis;
     parent   = g;
 }
示例#18
0
 public void unregisterModelListener(ModelListener listener)
 {
     _service.unregisterModelListener(listener, _caller);
 }
示例#19
0
 public LineTask(ModelStorage db, ModelListener lis, RailLine line, LineTask lt) : this(db, lis)
 {
     Parent    = line;
     Prev      = lt;
     Prev.Next = this;
 }
 public void registerModelListener(ModelListener listener, String callerPath)
 {
     modelListeners.addListener(listener);
 }