Example #1
0
	public void Recv_Registraion_Item(body_SC_PRIVATESHOP_REGISTRATION_ITEM _registration)
	{
		if(_registration.eResult != eRESULTCODE.eRESULT_SUCC)
		{
			Debug.Log(_registration.eResult);
			return;
		}
		
		/*Debug.Log("Recv_Registration_Item: " + 
			_registration.bAddOrDel + ", " + _registration.nInvenSlot + ", " + _registration.nPrivateShopSlot + ", " +
			_registration.sPrivateShopItem.nItemTableIdx + ", " + _registration.sPrivateShopItem.nAttribute);*/
		
		if(_registration.bAddOrDel == true)
		{
			AsHudDlgMgr.Instance.pstoreDlg.SetPStoreItem(_registration);         
			ItemMgr.HadItemManagement.Inven.SetSlotMoveLock(_registration.nInvenSlot, true);
			
			body2_SC_PRIVATESHOP_OWNER_ITEMLIST item = new body2_SC_PRIVATESHOP_OWNER_ITEMLIST();
			item.nInvenSlot = _registration.nInvenSlot;
			item.nItemGold = _registration.nItemSellGold;
			item.nPrivateShopSlot = _registration.nPrivateShopSlot;
			item.sItem = _registration.sPrivateShopItem;
			item.nMaxOverlapped = _registration.sPrivateShopItem.nOverlapped;
			
			if(m_dicPlayerShopItem.ContainsKey(item.nPrivateShopSlot) == true)
				m_dicPlayerShopItem.Remove(item.nPrivateShopSlot);
			
			m_dicPlayerShopItem.Add(item.nPrivateShopSlot, item);
		}
		else
		{
			AsHudDlgMgr.Instance.pstoreDlg.RemovePStoreItem(_registration);
			ItemMgr.HadItemManagement.Inven.SetSlotMoveLock(_registration.nInvenSlot, false);
			
			foreach(KeyValuePair<int, body2_SC_PRIVATESHOP_OWNER_ITEMLIST> pair in m_dicPlayerShopItem)
			{
				if(pair.Value.nPrivateShopSlot == _registration.nPrivateShopSlot)
				{
					Debug.Log("AsPStoreManager::Recv_Registration_Item: item[nPrivateShopSlot(" + _registration.nPrivateShopSlot + ")] in current shop list is deleted.");
					m_dicPlayerShopItem.Remove(pair.Key);
					break;
				}
			}
		}
		
		if( AsHudDlgMgr.Instance.IsOpenInven )
			AsHudDlgMgr.Instance.invenDlg.ApplySlotMoveLock();
	}
Example #2
0
	public bool CreateSlotItem( body2_SC_PRIVATESHOP_OWNER_ITEMLIST _item, Transform trmParent = null)
	{
		if( null == _item)
		{
			Debug.LogError( "UIPStoreSlot::CreateSlotItem() [ null == _item ]");
			return false;
		}

		return _CreateSlotItem( _item.sItem, _item.nInvenSlot, _item.nItemGold, trmParent);
	}
	public new void PacketBytesToClass( byte[] data)
	{
		Type infotype = this.GetType();
		FieldInfo headerinfo = null;

		int index = ParsePacketHeader( data);

		byte[] count = new byte[ sizeof( Int32)];
		headerinfo = infotype.GetField( "nItemCnt", BINDING_FLAGS_PIG);
		Buffer.BlockCopy( data, index, count, 0, sizeof( Int32));
		headerinfo.SetValue( this, BitConverter.ToInt32( count, 0));
		index += sizeof( Int32);

		if( 0 >= nItemCnt)
			return;

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