示例#1
0
文件: TestLog.cs 项目: hbpp/GearUnity
    // Use this for initialization
    void Start()
    {
        t         = new EnterFrameTimer(200);
        t.OnTimer = onTimer;
        t.Start();

        ConsoleCommand   command;
        CompositeCommand cc = new CompositeCommand(CompositeCommandMode.SEQUENCE);

        cc.OnCommandItemComplete = delegate(AbstractCommand _command) {
            Debug.Log("Item Complete" + " " + (_command as ConsoleCommand).index.ToString());
        };
        cc.OnCommandComplete = delegate(AbstractCommand _command) {
            Debug.Log("All Complete");
        };
        int max = 10;

        for (int i = 0; i < max; i++)
        {
            command       = new ConsoleCommand();
            command.index = i;
            cc.AddCommand(command);
        }

        cc.Execute();
    }
示例#2
0
    public static void SetTimeOut(uint delay, OnTimeOutDelegate OnTimeOut)
    {
        EnterFrameTimer timer = new EnterFrameTimer(delay, 1);

        timer.OnComplete = delegate() {
            timer.Stop();
            if (OnTimeOut != null)
            {
                OnTimeOut();
            }
        };
        timer.Start();
    }
示例#3
0
 protected virtual void InvokeComplete()
 {
     if (delayInvokeComplete == 0f)
     {
         if (OnCommandComplete != null)
         {
             OnCommandComplete(this);
         }
     }
     else
     {
         EnterFrameTimer.SetTimeOut((uint)(delayInvokeComplete * 1000), delegate() {
             if (OnCommandComplete != null)
             {
                 OnCommandComplete(this);
             }
         });
     }
 }
示例#4
0
	// Use this for initialization
	void Start(){
		t = new EnterFrameTimer(200);
		t.OnTimer = onTimer;
		t.Start();

		ConsoleCommand command;
		CompositeCommand cc = new CompositeCommand(CompositeCommandMode.SEQUENCE);
		cc.OnCommandItemComplete = delegate(AbstractCommand _command) {
			Debug.Log("Item Complete" + " " + (_command as ConsoleCommand).index.ToString());
		};
		cc.OnCommandComplete = delegate(AbstractCommand _command) {
			Debug.Log("All Complete");
		};
		int max = 10;
		for (int i = 0; i < max; i++) {
			command = new ConsoleCommand();
			command.index = i;
			cc.AddCommand(command);
		}

		cc.Execute();

	}
示例#5
0
	public static void SetTimeOut(uint delay, OnTimeOutDelegate OnTimeOut){
		EnterFrameTimer timer = new EnterFrameTimer(delay, 1);
		timer.OnComplete = delegate() {
			timer.Stop();
			if(OnTimeOut != null)
			{
				OnTimeOut();
			}
		};
		timer.Start();
	}