// 新增\数量改变,不包括删除 public void psstNotifyOneCardTujianInfoCmd(uint id, byte num) { TableItemBase tableItem = Ctx.m_instance.m_tableSys.getItem(TableID.TABLE_CARD, id); if (tableItem != null) { if (!m_id2CardDic.ContainsKey(id)) { CardItemBase item = new CardItemBase(); item.m_tujian = new t_Tujian(); item.m_tujian.id = id; item.m_tujian.num = num; item.m_tableItemCard = tableItem.m_itemBody as TableCardItemBody; m_cardListArr[item.m_tableItemCard.m_career].Add(item); m_id2CardDic[id] = item; } m_id2CardDic[id].m_tujian.num = num; } else { Ctx.m_instance.m_logSys.error("psstNotifyOneCardTujianInfoCmd 不能查找到卡牌 Item"); } // 更新卡牌图鉴中的显示 IUITuJian uiTuJian = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUITuJian) as IUITuJian; if (uiTuJian != null) { uiTuJian.updateMidCardModel(); } }
// 读取一个表,仅仅读取表头 private void readTable(TableID tableID, ByteBuffer bytes) { TableBase table = m_dicTable[tableID]; table.m_byteBuffer = bytes; bytes.setEndian(Endian.LITTLE_ENDIAN); uint len = 0; bytes.readUnsignedInt32(ref len); uint i = 0; TableItemBase item = null; for (i = 0; i < len; i++) { //if (TableID.TABLE_OBJECT == tableID) //{ // item = new TableItemObject(); //} item = new TableItemBase(); item.parseHeaderByteBuffer(bytes); // 加载完整数据 //loadOneTableOneItemAll(tableID, table, item); //if (TableID.TABLE_OBJECT == tableID) //{ //item.parseAllByteBuffer<TableObjectItemBody>(bytes); //} table.m_List.Add(item); } }
// 加载一个表中一项的所有内容 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); } }
// 返回一个表中一项,返回的时候表中数据全部加载到 Item 中 public TableItemBase getItem(TableID tableID, uint itemID) { TableBase table = m_dicTable[tableID]; if (null == table.m_byteBuffer) { loadOneTable(tableID); table = m_dicTable[tableID]; } TableItemBase ret = TableSys.findDataItem(table, itemID); if (null != ret && null == ret.m_itemBody) { loadOneTableOneItemAll(tableID, table, ret); } if (null == ret) { Ctx.m_instance.m_logSys.log(string.Format("table name: {0}, table Item {1} 加载失败", (int)tableID, itemID)); } return(ret); }
public void psstNotifyAllCardTujianInfoCmd(List <t_Tujian> list) { clearAllTuJian(); CardItemBase item = null; int idx = 0; TableItemBase tableItem = null; while (idx < list.Count) { tableItem = Ctx.m_instance.m_tableSys.getItem(TableID.TABLE_CARD, list[idx].id); if (tableItem != null) { item = new CardItemBase(); item.m_tujian = list[idx]; item.m_tableItemCard = tableItem.m_itemBody as TableCardItemBody; m_cardListArr[item.m_tableItemCard.m_career].Add(item); m_id2CardDic[list[idx].id] = item; } else { Ctx.m_instance.m_logSys.log("表格读取失败"); } ++idx; } // 更新卡牌图鉴中的显示 IUITuJian uiTuJian = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUITuJian) as IUITuJian; if (uiTuJian != null) { uiTuJian.updateMidCardModel(); } }