/// <summary> /// 添加FixedUpdate /// </summary> /// <param name="handle"></param> private int AddFixedUpdate(UpdateHandle handle) { int id = GetHandleId(); FixedUpdateHandle.Add(handle); IndexDict.Add(id, handle); return(id); }
private int AddHandle2ForceList(UpdateHandle handle) { int id = GetHandleId(); ForceHandleList.Add(handle); IndexDict.Add(id, handle); return(id); }
private void RemoveHandleFormListById(int id) { //GameFramework.Util.Log("-------RemoveHandleFormListById--------" + id); if (IndexDict.ContainsKey(id)) { RemoveHandleFormList(IndexDict[id]); if (updateDatas.ContainsKey(id)) { updateDatas.Remove(id); } } }
private int GetHandleId() { int id = handleIndex + 1; int errorCount = 0; while (IndexDict.ContainsKey(id) && errorCount < int.MaxValue - 1) { id++; } handleIndex = id; if (handleIndex >= int.MaxValue - 1) { handleIndex = 0; } return(id); }
/// <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); } } }
/// <summary> /// 是否包含某一列 /// </summary> /// <param name="name"></param> /// <returns></returns> public bool ContainColumn(string name) { return(IndexDict.ContainsKey(name)); }