Пример #1
0
        public static void Start(TimeCallback timeCallback, LBSelectedTextCallback lbSelectedTextCallback)
        {
            GliderScoreWindowScraperThread.timeCallback = timeCallback;

            GliderScoreWindowScraperThread.lbSelectedTextCallback = lbSelectedTextCallback;
            sTime           = "";
            sLBSelectedText = "";
            scraperThread   = new Thread(ScrapeWindow);
            scraperThread.Start();
        }
Пример #2
0
    public void StopCallFunc(Action callback)
    {
        if (callback == null || cdic == null)
        {
            return;
        }
        TimeCallback tc = getTc(callback);

        if (tc != null)
        {
            tc.deleted = true;
        }
    }
Пример #3
0
 public void Init(int total, string format, TimeCallback callback)
 {
     if (!m_TShow)
     {
         m_TShow = GetComponent <UILabel>();
     }
     flag           = true;
     m_fSTime       = Time.realtimeSinceStartup;
     m_n32Total     = total;
     m_n32Time      = m_n32Total;
     m_Format       = format;
     m_pfunCallback = callback;
 }
Пример #4
0
        static void main(string[] args)
        {
            int y;

            a = 10; b = 7;
            c = 15; d = 3;
            TimerCallback tc      = new TimeCallback(CheckTime);
            Thread        thread1 = new Thread(new ThreadStart(Program.Threadfunc1));
            Thread        thread2 = new Thread(new ThreadStart(Program.Threadfunc2));
            Thread        thread3 = new Thread(new ThreadStart(Program.Threadfunc3));
            Thread        thread4 = new Thread(new ThreadStart(Program.Threadfunc4));
            Timer         t       = new timer(tc, null, 0, 1000);

            Console.WriteLine("thread1.ThreadState=" + thread1.ThreadState);
            Console.WriteLine("thread2.ThreadState=" + thread2.ThreadState);
            Console.WriteLine("thread3.ThreadState=" + thread3.ThreadState);
            Console.WriteLine("thread4.ThreadState=" + thread4.ThreadState);
            thread1.start();
            thread2.start();

            Console.WriteLine("thread1.ThreadState=" + thread1.ThreadState);
            Console.WriteLine("thread2.ThreadState=" + thread2.ThreadState);
            Console.WriteLine("thread3.ThreadState=" + thread3.ThreadState);
            Console.WriteLine("thread4.ThreadState=" + thread4.ThreadState);
            thread1.join();
            thread2.join();

            Console.WriteLine("new threads ending");
            Console.WriteLine("y1=" + y1);
            Console.WriteLine("y2=" + y2);

            thread3.start();
            thread4.Start();
            Console.WriteLine("thread1.ThreadState=" + thread1.ThreadState);
            Console.WriteLine("thread2.ThreadState=" + thread2.ThreadState);
            Console.WriteLine("thread3.ThreadState=" + thread3.ThreadState);
            Console.WriteLine("thread4.ThreadState=" + thread4.ThreadState);

            thread3.join();
            thread4.join();

            Console.WriteLine("new threads ending");
            Console.WriteLine("y3=" + y3);
            Console.WriteLine("y4=" + y4);

            Thread.sleep(2000);
            y = y3 + y4;
            Console.WriteLine("y=" + y);
            t.dispose();
            Console.ReadLine();
        }
Пример #5
0
        void StartUpdating()
        {
            timerCallback = new TimeCallback(TimerCallback);
            //TIME_KILL_SYNCHRONOUS = 0x0100
            //TIME_PERIODIC = 0x0001
            timerId = timeSetEvent((int)(1000 / (double)framerate), 0, timerCallback, 0, 0x0101);

            while (timerCallback != null)
            {
                updateEvent.WaitOne();
                DoUpdate();
                Application.DoEvents();
                updateEvent.Reset();
            }
        }
Пример #6
0
    public void AddArrowEff(Vector3 pos, SongInfo.DIRECTION d)
    {
        GameObject prefab = null;

        switch (d)
        {
        case SongInfo.DIRECTION.LEFT:
            prefab = arrowLeft;
            break;

        case SongInfo.DIRECTION.RIGHT:
            prefab = arrowRight;
            break;

        case SongInfo.DIRECTION.UP:
            prefab = arrowTop;
            break;

        case SongInfo.DIRECTION.DOWN:
            prefab = arrowDown;
            break;
        }

        if (prefab == null)
        {
            Debug.Log(d);
            Debug.Break();
        }

        GameObject go = PrefabPool.instance(prefab);

        go.name               = prefab.name;
        go.transform.parent   = transform;
        go.transform.position = pos;
        go.GetComponent <ParticleSystem>().Play();
        go.SetActive(true);
        TimeCallback   call     = go.GetComponent <TimeCallback>();
        ParticleSystem particle = go.GetComponent <ParticleSystem>();

        particle.Stop();
        particle.Play(true);
        call.data         = prefab;
        call.doneCallback = (g) =>
        {
            PrefabPool.restore(g, g.GetComponent <TimeCallback>().data as GameObject);
        };
    }
Пример #7
0
    public void CallDelay(Action callback, float delay)
    {
//        StartCoroutine (delayFunc (callback,delay));
        if (callback != null)
        {
            TimeCallback tc = new TimeCallback();
            tc.ac      = callback;
            tc.time    = Time.time + delay;
            tc.deleted = false;
            if (cdic == null)
            {
                cdic = new System.Collections.Generic.LinkedList <TimeCallback>();
            }
            cdic.AddLast(tc);
            StartCoroutine(delayFunc2(tc));
        }
    }
Пример #8
0
 private System.Collections.IEnumerator delayFunc2(TimeCallback tc)
 {
     if (tc.deleted)
     {
         tc.time = -1;
     }
     while (Time.time < tc.time)
     {
         yield return(1);
     }
     if (!tc.deleted)
     {
         tc.ac();
     }
     if (cdic != null)
     {
         cdic.Remove(tc);
     }
 }
Пример #9
0
 void StopUpdating()
 {
     timerCallback = null;
     timeKillEvent(timerId);
     updateEvent.WaitOne();
 }
Пример #10
0
 static extern int timeSetEvent(int delay, int resolution, TimeCallback callback, int user, int mode);
Пример #11
0
 void StopUpdating()
 {
     timerCallback = null;
     timeKillEvent(timerId);
     updateEvent.WaitOne();
 }
Пример #12
0
        void StartUpdating()
        {
            timerCallback = new TimeCallback(TimerCallback);
            //TIME_KILL_SYNCHRONOUS = 0x0100
            //TIME_PERIODIC = 0x0001
            timerId = timeSetEvent((int)(1000/(double)framerate), 0, timerCallback, 0, 0x0101);

            while (timerCallback != null)
            {
                updateEvent.WaitOne();
                DoUpdate();
                Application.DoEvents();
                updateEvent.Reset();
            }
        }
Пример #13
0
 static extern int timeSetEvent(int delay, int resolution, TimeCallback callback, int user, int mode);
Пример #14
0
 public static extern uint timeSetEvent(uint uDelay, uint uResolution, TimeCallback lpTimeProc, UIntPtr dwUser, uint fuEvent);
Пример #15
0
 public static extern uint timeSetEvent(uint uDelay, uint uResolution, TimeCallback lpTimeProc, UIntPtr dwUser, uint fuEvent);