Exemple #1
0
        /// <summary>
        /// 获取扩展buffer属性
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public double GetExtProp(int index)
        {
            long         nowTicks     = TimeUtil.NOW() * 10000;
            double       tempProp     = 0.0;
            TempPropItem tempPropItem = null;

            lock (_TempExtPropsDict)
            {
                //tempProp = _TempProp.BaseProps[index];
                //_TempProp.BaseProps[index] = 0.0;

                if (!_TempExtPropsDict.TryGetValue(index, out tempPropItem))
                {
                    return(tempProp);
                }

                if (nowTicks - tempPropItem.ToTicks < 0)
                {
                    tempProp = tempPropItem.PropValue;
                }
                else
                {
                    _TempExtPropsDict.Remove(index);
                }
            }

            return(tempProp);
        }
Exemple #2
0
        /// <summary>
        /// 添加临时的扩展属性
        /// </summary>
        /// <param name="index"></param>
        /// <param name="value"></param>
        public void AddTempExtProp(int index, double value, long toTicks)
        {
            lock (_TempExtPropsDict)
            {
                _TempExtPropsDict[index] = new TempPropItem()
                {
                    PropValue = value,
                    ToTicks   = toTicks,
                };

                //_TempExtPropsDict[index] = value;
                //_TempExtPropsDictPropsTick[index] = toTicks;
            }
        }
Exemple #3
0
        public double GetExtProp(int index)
        {
            long         nowTicks     = TimeUtil.NOW() * 10000L;
            double       tempProp     = 0.0;
            TempPropItem tempPropItem = null;

            lock (this._TempExtPropsDict)
            {
                if (!this._TempExtPropsDict.TryGetValue(index, out tempPropItem))
                {
                    return(tempProp);
                }
                if (nowTicks - tempPropItem.ToTicks < 0L)
                {
                    tempProp = tempPropItem.PropValue;
                }
                else
                {
                    this._TempExtPropsDict.Remove(index);
                }
            }
            return(tempProp);
        }