示例#1
0
        static void Main(string[] args)
        {
            ScriptSystem system = new ScriptSystem(0);
            AsynScript1  a;
            AsynScript2  b;
            AsynScript3  c;
            AsynScript4  d;

            system.Add(a = new ScriptDEMO.AsynScript1());
            system.Add(b = new ScriptDEMO.AsynScript2());
            system.Add(c = new ScriptDEMO.AsynScript3());
            system.Add(d = new ScriptDEMO.AsynScript4());
            system.Start();


            Console.ReadLine();
            system.Remove(a);
            Console.ReadLine();
            system.Remove(b);
            Console.ReadLine();
            system.Remove(c);
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            Scheduler scehduler = new Scheduler();

            scehduler.Add(async() =>
            {
                await Task.Delay(1000);
                Console.WriteLine("AAAAAAAA");
            });


            scehduler.Run();
            System.Threading.Thread.Sleep(1100);
            scehduler.Run();

            Console.ReadLine();


            ScriptSystem tmp = new ScriptSystem(0);

            var a1 = new Test2()
            {
                Name = "1", Priority = 2, testcab = test
            };
            var a2 = new Test2()
            {
                Name = "2", Priority = 1, testcab = test
            };
            var a3 = new Test()
            {
                Name = "3", Priority = 0, testcab = test
            };
            var a4 = new Test3()
            {
                Name = "4", Priority = 0, testcab = test
            };

            tmp.Add(a1);
            tmp.Add(a2);
            tmp.Add(a3);
            tmp.Add(a4);



            tmp.Start();


            Console.ReadLine();

            tmp.Stop();

            Console.ReadLine();

            tmp.Start();

            Console.ReadLine();

            tmp.Remove(a1);
            tmp.Remove(a2);
            tmp.Remove(a3);
            tmp.Remove(a4);

            Console.ReadLine();
        }
 protected override void OnEntityComponentRemoved(ScriptComponent component)
 {
     scriptSystem.Remove(component);
 }