예제 #1
0
        /// <summary>
        /// 初始次数表,一般是新号或新功能开启
        /// </summary>
        private void InitCounter()
        {
            List <StdCounterInfo> list = new List <StdCounterInfo>();

            ///1.收集当前已经开启的
            Dictionary <int, StdCounterInfo> infos = CounterConfig.Instance.infos;

            foreach (var obj in infos)
            {
                //TODO:判断当前功能是否开启
                list.Add(obj.Value);
            }

            ///2.初始化列表信息
            foreach (var info in list)
            {
                CounterInfo counter_info;
                if (!m_counters.TryGetValue((eCounterType)info.idx, out counter_info))
                {
                    counter_info         = new CounterInfo();
                    counter_info.type    = (eCounterType)info.idx;
                    counter_info.count   = this.GetMaxCounterByType((eCounterType)info.idx);
                    counter_info.cd_time = Time.second_time;
                    m_counters.Add((eCounterType)info.idx, counter_info);
                }
            }

            ///修正次数和cd
            List <CounterInfo> list_counter = new List <CounterInfo>(m_counters.Values);

            foreach (var obj in list_counter)
            {
                this.GetAndModifyCounter(obj.type);
            }
        }
예제 #2
0
 public void Derialize(ByteArray by)
 {
     while (by.Available > 0 && by.Available >= RelationInfo.BaseSize)
     {
         CounterInfo info = new CounterInfo();
         info.Read(by);
         m_counters.Add(info.type, info);
     }
 }