Esempio n. 1
0
        // 查找表中的一项
        static public TableItemBase findDataItem(TableBase table, uint id)
		{
			int size = table.m_List.Count;
			int low = 0;
			int high = size - 1;
			int middle = 0;
			uint idCur = 0;
			
			while (low <= high)
			{
				middle = (low + high) / 2;
                idCur = table.m_List[middle].m_itemHeader.m_uID;
				if (idCur == id)
				{
					break;
				}
				if (id < idCur)
				{
					high = middle - 1;
				}
				else
				{
					low = middle + 1;
				}
			}
			
			if (low <= high)
			{
                return table.m_List[middle];
			}
			return null;
		}
Esempio n. 2
0
 // 加载一个表中一项的所有内容
 public void loadOneTableOneItemAll(TableID tableID, TableBase table, TableItemBase itemBase)
 {
     if (TableID.TABLE_OBJECT == tableID)
     {
         itemBase.parseBodyByteBuffer<TableObjectItemBody>(table.m_byteBuffer, itemBase.m_itemHeader.m_offset);
     }
     else if (TableID.TABLE_CARD == tableID)
     {
         itemBase.parseBodyByteBuffer<TableCardItemBody>(table.m_byteBuffer, itemBase.m_itemHeader.m_offset);
     }
     else if (TableID.TABLE_SKILL == tableID)  // 添加一个表的步骤四
     {
         itemBase.parseBodyByteBuffer<TableSkillItemBody>(table.m_byteBuffer, itemBase.m_itemHeader.m_offset);
     }
     else if (TableID.TABLE_JOB == tableID)
     {
         itemBase.parseBodyByteBuffer<TableJobItemBody>(table.m_byteBuffer, itemBase.m_itemHeader.m_offset);
     }
     else if (TableID.TABLE_SPRITEANI == tableID)
     {
         itemBase.parseBodyByteBuffer<TableSpriteAniItemBody>(table.m_byteBuffer, itemBase.m_itemHeader.m_offset);
     }
     else if (TableID.TABLE_RACE == tableID)
     {
         itemBase.parseBodyByteBuffer<TableRaceItemBody>(table.m_byteBuffer, itemBase.m_itemHeader.m_offset);
     }
     else if (TableID.TABLE_STATE == tableID)
     {
         itemBase.parseBodyByteBuffer<TableStateItemBody>(table.m_byteBuffer, itemBase.m_itemHeader.m_offset);
     }
 }