Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (isPause)
        {
            return;
        }

        CheckDel();
        int len = ForceHandleList.Count;

        if (len > 0)
        {
            for (int i = 0; i < len; i++)
            {
                ForceHandleList[i]();
            }
        }

        len = HandleList.Count;
        if (len > 0)
        {
            for (int i = 0; i < len; i++)
            {
                HandleList[i]();
            }
        }
    }
Beispiel #2
0
    private int AddHandle2ForceList(UpdateHandle handle)
    {
        int id = GetHandleId();

        ForceHandleList.Add(handle);
        IndexDict.Add(id, handle);
        return(id);
    }
Beispiel #3
0
    /// <summary>
    /// 删除处理
    /// </summary>
    /// <param name="handle"></param>
    private void RemoveHandleFormList(UpdateHandle handle)
    {
        int ind = HandleList.IndexOf(handle);

        if (ind >= 0)
        {
            HandleList.RemoveAt(ind);
        }
        else
        {
            ind = ForceHandleList.IndexOf(handle);
            if (ind >= 0)
            {
                ForceHandleList.RemoveAt(ind);
            }
        }
        ind = FixedUpdateHandle.IndexOf(handle);
        if (ind > 0)
        {
            ForceHandleList.RemoveAt(ind);
        }
        //else
        //{
        //    GameLogger.LogError("找不到已经注册的handle删除");
        //}
        if (IndexDict.ContainsValue(handle))
        {
            int id = -1;
            foreach (KeyValuePair <int, UpdateHandle> item in IndexDict)
            {
                if (item.Value == handle)
                {
                    id = item.Key;
                    break;
                }
            }
            if (id >= 0)
            {
                IndexDict.Remove(id);
            }
        }
    }