示例#1
0
    public void ReceiveItemList( body2_SC_ITEM_INVENTORY[] _list)
    {
        if ( null == _list)                   
            return;		
		
		foreach( body2_SC_ITEM_INVENTORY sitem in _list)
		{
			if( null == sitem)
				continue;
			
			SetItem( sitem.sItem, sitem.nSlot);			
		}  
		
		ItemMgr.HadItemManagement.Inven.isNewReceiveItems = false;
		for( int i=0; i< ItemMgr.HadItemManagement.Inven.newReceiveItemslots.Length; ++i )
		{
			ItemMgr.HadItemManagement.Inven.newReceiveItemslots[i] = false;
		}
		
    }
示例#2
0
	public new void PacketBytesToClass( byte[] data)
	{
		Type infotype = this.GetType();
		FieldInfo headerinfo = null;

		int index = ParsePacketHeader( data);

		// nExtendPageCount
		headerinfo = infotype.GetField( "nExtendPageCount", BINDING_FLAGS_PIG);
		headerinfo.SetValue( this, data[index++]);

		//Debug.Log( "ITEM_INVENTORY nExtendPageCount: " + nExtendPageCount);

		// nCount
		byte[] count = new byte[ sizeof( Int16)];
		headerinfo = infotype.GetField( "nCount", BINDING_FLAGS_PIG);
		Buffer.BlockCopy( data, index, count, 0, sizeof(Int16));
		headerinfo.SetValue( this, BitConverter.ToInt16( count, 0));
		index += sizeof( Int16);

		//Debug.Log( "ITEM_INVENTORY nCount: " + nCount);

 		if( 0 < nCount)
		{
			body = new body2_SC_ITEM_INVENTORY[nCount];
			for( int i = 0; i < nCount; i++)
			{
				body[i] = new body2_SC_ITEM_INVENTORY();
				
				byte[] tmpData = new byte[body2_SC_ITEM_INVENTORY.size];
				Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length);
				body[i].ByteArrayToClass( tmpData);
				index += body2_SC_ITEM_INVENTORY.size;

				//Debug.Log( "ITEM_INVENTORY idx: " + i + " id : " + body[i].sItem.nItemTableIdx + " slot : " + body[i].nSlot);
			}
		}

		//Debug.Log( "ITEM_INVENTORY end : " + index);
	}