/// <summary> /// 移除数据节点 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> public void Remove <T>(string key) { int hashCode = typeof(T).GetHashCode(); PEINode_DataOrigin nodeDataBase; if (_allNodeDatas.TryGetValue(hashCode, out nodeDataBase)) { PEINode_Data <T> nodeData = nodeDataBase as PEINode_Data <T>; nodeData.Remove(key); } }
/// <summary> /// 是否包含数据节点 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> public bool Has <T>(string key) { int hashCode = typeof(T).GetHashCode(); PEINode_DataOrigin nodeDataBase; if (_allNodeDatas.TryGetValue(hashCode, out nodeDataBase)) { PEINode_Data <T> nodeData = nodeDataBase as PEINode_Data <T>; return(nodeData.Has(key)); } return(false); }
/// <summary> /// 获取数据节点 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="defaultValue"></param> /// <returns></returns> public T Get <T>(string key, T defaultValue = default(T)) { int hashCode = typeof(T).GetHashCode(); PEINode_DataOrigin nodeDataBase; if (_allNodeDatas.TryGetValue(hashCode, out nodeDataBase)) { PEINode_Data <T> nodeData = nodeDataBase as PEINode_Data <T>; return(nodeData.Get(key, defaultValue)); } return(defaultValue); }
/// <summary> /// 设置数据节点 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="value"></param> public void Set <T>(string key, T value) { PEINode_DataOrigin nodeDataBase; int hashCode = typeof(T).GetHashCode(); if (!_allNodeDatas.TryGetValue(hashCode, out nodeDataBase)) { nodeDataBase = new PEINode_Data <T>(); _allNodeDatas[hashCode] = nodeDataBase; } PEINode_Data <T> nodeData = nodeDataBase as PEINode_Data <T>; nodeData.Set(key, value); }