예제 #1
0
        protected WaitForMultipleEvents(Coroutine coroutine, Event[] requests,
            double seconds, params Event[] e)
        {
            this.coroutine = coroutine;

            if (!Object.ReferenceEquals(requests, null))
            {
                waitHandle = WaitHandlePool.Acquire();
                for (int i = 0, count = requests.Length; i < count; ++i)
                {
                    requests[i]._WaitHandle = waitHandle;
                }
                for (int i = 0, count = e.Length; i < count; ++i)
                {
                    e[i]._WaitHandle = waitHandle;
                }
            }

            expected = e;
            actual = new Event[expected.Length];

            handlerTokens = new Binder.Token[expected.Length];
            for (int i = 0; i < expected.Length; ++i)
            {
                handlerTokens[i] = Flow.Bind(expected[i], OnEvent);
            }

            if (seconds > 0)
            {
                TimeoutEvent timeoutEvent = new TimeoutEvent { Key = this };
                timeoutToken = Flow.Bind(timeoutEvent, OnTimeout);
                timerToken = TimeFlow.Default.Reserve(timeoutEvent, seconds);
            }
        }
예제 #2
0
 public WaitForSeconds(Coroutine coroutine, double seconds)
 {
     this.coroutine = coroutine;
     TimeoutEvent e = new TimeoutEvent { Key = this };
     token = Flow.Bind(e, OnTimeout);
     TimeFlow.Default.Reserve(e, seconds);
 }
예제 #3
0
 public WaitForNothing(Coroutine coroutine, object result)
 {
     this.coroutine = coroutine;
     this.result = result;
     TimeoutEvent e = new TimeoutEvent { Key = this };
     token = Flow.Bind(e, OnTimeout);
     Hub.Post(e);
 }
예제 #4
0
        public WaitForMultipleEvents(Coroutine coroutine, params Event[] e)
        {
            this.coroutine = coroutine;
            expected = e;
            actual = new Event[expected.Length];

            for (int i = 0; i < expected.Length; ++i)
            {
                Flow.Bind(expected[i], OnEvent);
            }
        }
예제 #5
0
 public WaitForSingleEvent(Coroutine coroutine, Event e, double seconds)
 {
     this.coroutine = coroutine;
     handlerToken = Flow.Bind(e, OnEvent);
     if (seconds >= 0)
     {
         TimeoutEvent timeoutEvent = new TimeoutEvent { Key = this };
         timeoutToken = Flow.Bind(timeoutEvent, OnTimeout);
         timerToken = TimeFlow.Default.Reserve(timeoutEvent, seconds);
     }
 }
예제 #6
0
        protected WaitForSingleEvent(Coroutine coroutine, Event request, Event e, double seconds)
        {
            this.coroutine = coroutine;

            if (!Object.ReferenceEquals(request, null))
            {
                int waitHandle = WaitHandlePool.Acquire();
                request._WaitHandle = waitHandle;
                e._WaitHandle = waitHandle;
            }

            handlerToken = Flow.Bind(e, OnEvent);
            if (seconds > 0)
            {
                TimeoutEvent timeoutEvent = new TimeoutEvent { Key = this };
                timeoutToken = Flow.Bind(timeoutEvent, OnTimeout);
                timerToken = TimeFlow.Default.Reserve(timeoutEvent, seconds);
            }
        }
예제 #7
0
 public WaitForSingleEvent(Coroutine coroutine, Event e)
     : this(coroutine, null, e, Config.Coroutine.DefaultTimeout)
 {
 }
예제 #8
0
 public WaitForSingleResponse(Coroutine coroutine, Event request,
         Event response)
     : this(coroutine, request, response, Config.Coroutine.DefaultTimeout)
 {
 }
예제 #9
0
 public WaitForSingleResponse(Coroutine coroutine, Event request,
         Event response, double seconds)
     : base(coroutine, request, response, seconds)
 {
     if (Object.ReferenceEquals(request, null))
     {
         throw new ArgumentNullException();
     }
     request.Post();
 }
예제 #10
0
 public WaitForSingleResponse(Coroutine coroutine, Event request, Event response)
     : base(coroutine, response)
 {
     request.Post();
 }
예제 #11
0
 public WaitForCompletion(Coroutine coroutine,
     Func<Coroutine, IEnumerator> func)
 {
     Coroutine c = new Coroutine(coroutine);
     c.Start(func(c));
 }
예제 #12
0
 public WaitForSingleEvent(Coroutine coroutine, Event e)
     : this(coroutine, e, 30.0)
 {
 }
예제 #13
0
 public WaitForMultipleEvents(Coroutine coroutine, params Event[] e)
     : this(coroutine, null, Config.Coroutine.DefaultTimeout, e)
 {
 }
예제 #14
0
 public WaitForMultipleResponses(Coroutine coroutine, Event[] requests,
         double seconds, params Event[] responses)
     : base(coroutine, requests, seconds, responses)
 {
     if (Object.ReferenceEquals(requests, null))
     {
         throw new ArgumentNullException();
     }
     for (int i = 0; i < requests.Length; ++i)
     {
         requests[i].Post();
     }
 }
예제 #15
0
 public WaitForSingleEvent(Coroutine coroutine, Event e, double seconds)
     : this(coroutine, null, e, seconds)
 {
 }
예제 #16
0
 public WaitForMultipleResponses(Coroutine coroutine, Event[] requests, params Event[] responses)
     : base(coroutine, responses)
 {
     for (int i = 0; i < requests.Length; ++i)
     {
         requests[i].Post();
     }
 }
예제 #17
0
 public WaitForMultipleEvents(Coroutine coroutine, double seconds,
         params Event[] e)
     : this(coroutine, null, seconds, e)
 {
 }
예제 #18
0
 public WaitForNothing(Coroutine coroutine)
     : this(coroutine, null)
 {
 }
예제 #19
0
 public WaitForSingleResponse(Coroutine coroutine, Event request, Event response, double seconds)
     : base(coroutine, response, seconds)
 {
     request.Post();
 }
예제 #20
0
 public WaitForMultipleResponses(Coroutine coroutine, Event[] requests,
         params Event[] responses)
     : this(coroutine, requests, Config.Coroutine.DefaultTimeout, responses)
 {
 }