// 回收所有属性对象到对象池中. virtual public void RecycleAllAttribute() { Dictionary <int, GKCommonValue> .Enumerator it = _attrDict.GetEnumerator(); while (it.MoveNext()) { GKCommonValue attr = it.Current.Value; if (null != attr) { attr.Clear(); GKCommonValue.commonValuePool.Recycle(attr); } } _attrDict.Clear(); Dictionary <int, GKCommonListValue> .Enumerator it_ = _attrListDict.GetEnumerator(); while (it.MoveNext()) { GKCommonListValue attr = it_.Current.Value; if (null != attr) { attr.Clear(); GKCommonListValue.commonValuePool.Recycle(attr); } } _attrListDict.Clear(); }
// 只清除数据, 不清除事件. 调用频繁, 故使用新函数而不拓展参数. public void ClearValueWithOutEvent() { _longValue = 0; _floatValue = 0f; _stringValue = null; _bufferValue = null; if (null != _lastValue) { _lastValue.Clear(); commonValuePool.Recycle(_lastValue); _lastValue = null; } }