Ejemplo n.º 1
0
    void addInvoke(FuncCallBack callback)
    {
        if (callback == null)
        {
            return;
        }

        mCacheCallBack.Add(callback);
    }
Ejemplo n.º 2
0
    void addInvoke(FuncCall callback, GameObject go, object param, int endMillionSec, int startMillionSec = 0)
    {
        if (callback == null || endMillionSec <= 0 || startMillionSec < 0)
        {
            return;
        }

        FuncCallBack func = new FuncCallBack();

        func.callBack        = callback;
        func.startMillionSec = startMillionSec;
        func.endMillionSec   = endMillionSec;
        func.go    = go;
        func.param = param;

        addInvoke(func);
    }
Ejemplo n.º 3
0
    public override void Update(uint elapsed)
    {
        base.Update(elapsed);

        updateTimeCountDown();

        mLastMillionSec = (mLastMillionSec + elapsed) % uint.MaxValue;

        if ((mLastMillionSec - mOneSecNum) >= 1000)
        {
            mOneSecNum = mLastMillionSec;
            //updateTimeCountDown();
        }

        if (mCacheCallBack != null && mCacheCallBack.Count != 0)
        {
            for (int i = 0; i < mCacheCallBack.Count; i++)
            {
                FuncCallBack func = mCacheCallBack[i];
                if (func == null)
                {
                    continue;
                }

                if (func.startMillionSec < func.endMillionSec)
                {
                    func.startMillionSec += (int)elapsed;
                }
                else
                {
                    func.callBack(func.go, func.param);
                    mCacheCallBack.Remove(func);
                    i = 0; // 重新从头开始遍历数组;
                }
            }
        }
    }
Ejemplo n.º 4
0
 public static void AddListener <T, D, U, V, W>(string eventtype, FuncCallBack <T, D, U, V, W> handler)
 {
     OnListenerAdding(eventtype, handler);
     eventTable[eventtype] = (eventTable[eventtype] as FuncCallBack <T, D, U, V, W>) + (handler);
 }
Ejemplo n.º 5
0
 public static extern void RegisterDebugCallback(FuncCallBack callback);