Exemplo n.º 1
0
      public static void SerializableTable(string[] valuesList, int skey, Dictionary <int, List <object> > _hash)
      {
          if ((int)_ID.MAX_RECORD != valuesList.Length)
          {
              throw TableException.ErrorReader("Load {0} error as CodeSize:{1} not Equal DataSize:{2}", GetInstanceFile(), _ID.MAX_RECORD, valuesList.Length);
          }
          Tab_UnitTemplate _values = new Tab_UnitTemplate();

          _values.m_Attack          = Convert.ToSingle(valuesList[(int)_ID.ID_ATTACK] as string);
          _values.m_AttackSpaceTime = Convert.ToSingle(valuesList[(int)_ID.ID_ATTACKSPACETIME] as string);
          _values.m_AttackType      = Convert.ToInt32(valuesList[(int)_ID.ID_ATTACKTYPE] as string);
          _values.m_Id              = Convert.ToInt32(valuesList[(int)_ID.ID_ID] as string);
          _values.m_UnitArrowPath   = valuesList[(int)_ID.ID_UNITARROWPATH] as string;
          _values.m_UnitAttackRange = Convert.ToSingle(valuesList[(int)_ID.ID_UNITATTACKRANGE] as string);
          _values.m_UnitMaxHP       = Convert.ToSingle(valuesList[(int)_ID.ID_UNITMAXHP] as string);
          _values.m_UnitPath        = valuesList[(int)_ID.ID_UNITPATH] as string;
          _values.m_UnitRadius      = Convert.ToSingle(valuesList[(int)_ID.ID_UNITRADIUS] as string);
          _values.m_UnitSkillPath   = valuesList[(int)_ID.ID_UNITSKILLPATH] as string;
          _values.m_UnitSpaceH      = Convert.ToSingle(valuesList[(int)_ID.ID_UNITSPACEH] as string);
          _values.m_UnitSpaceL      = Convert.ToSingle(valuesList[(int)_ID.ID_UNITSPACEL] as string);
          _values.m_UnitType        = Convert.ToInt32(valuesList[(int)_ID.ID_UNITTYPE] as string);
          _values.m_UnitView        = Convert.ToSingle(valuesList[(int)_ID.ID_UNITVIEW] as string);

          if (_hash.ContainsKey(skey))
          {
              List <object> tList = _hash[skey];
              tList.Add(_values);
          }
          else
          {
              List <object> tList = new List <object>();
              tList.Add(_values);
              _hash.Add(skey, (List <object>)tList);
          }
      }
        public static bool InitTable_UnitTemplate()
        {
            g_UnitTemplate.Clear();
            Dictionary <int, List <object> > tmps = new Dictionary <int, List <object> >();

            if (!Tab_UnitTemplate.LoadTable(tmps))
            {
                return(false);
            }
            foreach (KeyValuePair <int, List <object> > kv in tmps)
            {
                List <Tab_UnitTemplate> values = new List <Tab_UnitTemplate>();
                foreach (object subit in kv.Value)
                {
                    values.Add((Tab_UnitTemplate)subit);
                }
                g_UnitTemplate.Add(kv.Key, values);
            }
            return(true);
        }