public void ItemSoldByPStore( body_SC_PRIVATESHOP_OWNER_ITEMBUY _item) { Debug.Log( "UIInvenDlg::ItemSoldByPStore: _item.nInvenSlot = " + _item.nInvenSlot + ", _item.nItemCount = " + _item.nItemCount); int iBeginSlotIndex = invenslots[0].slotIndex; int iIndex = _item.nInvenSlot - iBeginSlotIndex; InvenSlot slot = ItemMgr.HadItemManagement.Inven.GetInvenSlotItem( _item.nInvenSlot); if( slot == null) { Debug.LogError( "UIInvenDlg::ItemSoldByPStore: invalid slot access. [_item.nInvenSlot = " + _item.nInvenSlot + "]"); return; } // int curQuantity = invenslots[iIndex].slotItem.realItem.sItem.nOverlapped; int curQuantity = slot.realItem.sItem.nOverlapped; int resultCount = curQuantity - _item.nItemCount; if( resultCount < 1) invenslots[iIndex].DeleteSlotItem(); else { invenslots[iIndex].slotItem.realItem.sItem.nOverlapped = resultCount; invenslots[iIndex].slotItem.SetItemCountText( resultCount); } }
void PrivateShop_Owner_ItemBuy( byte[] _packet) { body_SC_PRIVATESHOP_OWNER_ITEMBUY buy = new body_SC_PRIVATESHOP_OWNER_ITEMBUY(); buy.PacketBytesToClass( _packet); AsPStoreManager.Instance.Recv_Owner_ItemBuy( buy); }
public void ItemSold(body_SC_PRIVATESHOP_OWNER_ITEMBUY _item) { Debug.Log("UIPStoreDlg::ItemSold: _item.nPrivateShopSlot = " + _item.nPrivateShopSlot + ", _item.nItemCount = " + _item.nItemCount); int curQuantity = slots[_item.nPrivateShopSlot].slotItem.realItem.sItem.nOverlapped; int resultCount = curQuantity - _item.nItemCount; if(resultCount < 1) slots[_item.nPrivateShopSlot].Clear(); else { // slots[_item.nPrivateShopSlot].slotItem.realItem.sItem.nOverlapped = resultCount; slots[_item.nPrivateShopSlot].slotItem.SetItemCountText(resultCount); } }
public void Recv_Owner_ItemBuy(body_SC_PRIVATESHOP_OWNER_ITEMBUY _buy) { if(AsHudDlgMgr.Instance.IsOpenPStore == true) AsHudDlgMgr.Instance.pstoreDlg.ItemSold(_buy); if(AsHudDlgMgr.Instance.IsOpenInven == true) AsHudDlgMgr.Instance.invenDlg.ItemSoldByPStore(_buy); foreach(KeyValuePair<int, body2_SC_PRIVATESHOP_OWNER_ITEMLIST> pair in m_dicPlayerShopItem) { if(pair.Value.nPrivateShopSlot == _buy.nPrivateShopSlot) { InvenSlot invenSlot = ItemMgr.HadItemManagement.Inven.GetInvenSlotItem( pair.Value.nInvenSlot ); if( null != invenSlot) { // string name = AsTableManager.Instance.GetTbl_String(invenSlot.realItem.item.ItemData.nameId); // string str = string.Format(AsTableManager.Instance.GetTbl_String(200), name, _buy.nItemCount, (int)_buy.nItemCount * (int)item.nItemGold ); // AsChatManager.Instance.InsertChat(str,eCHATTYPE.eCHATTYPE_SYSTEM); string name = AsTableManager.Instance.GetTbl_String(invenSlot.realItem.item.ItemData.nameId); double earn = (double)_buy.nItemCount * (double)pair.Value.nItemGold; // int commission = (int)(earn * AsTableManager.Instance.GetTbl_GlobalWeight_Record(14).Value * 0.01f + 0.5f); // string header = AsTableManager.Instance.GetTbl_String(126); // string body = string.Format(AsTableManager.Instance.GetTbl_String(214), name, _buy.nItemCount, earn - commission, commission); // AsNotify.Instance.MessageBox(header, body); double commission = (earn * AsTableManager.Instance.GetTbl_GlobalWeight_Record(14).Value * 0.01d + 0.5d); // int nCurrentChannel = AsUserInfo.Instance.currentChannel; // body2_GC_CHANNEL_LIST channel = AsChannelListData.Instance.GetDataByChannelIndex( nCurrentChannel); // // if( null != channel) // { // if( true == channel.bIsPrivateShop) // commission = (earn * (channel.nPrivateStore_Charge - channel.nPrivateStore_ChargeReduction) * 0.01d + 0.5d); // else // commission = (earn * channel.nPrivateStore_Charge * 0.01d + 0.5d); // } // else // Debug.LogError("AsPStoreManager::Recv_Owner_ItemBuy: current channel is not found. nCurrentChannel = " + nCurrentChannel); commission = (earn * _buy.nPrivateStore_Charge * 0.01d + 0.5d); string header = AsTableManager.Instance.GetTbl_String(126); string body = string.Format(AsTableManager.Instance.GetTbl_String(214), name, _buy.nItemCount, (ulong)earn - (ulong)commission, (ulong)commission); AsNotify.Instance.MessageBox(header, body); } pair.Value.sItem.nOverlapped -= _buy.nItemCount; if(pair.Value.sItem.nOverlapped < 1) { // AsHudDlgMgr.Instance.invenDlg.SetSlotMoveLock(pair.Value.nInvenSlot, false); ItemMgr.HadItemManagement.Inven.SetSlotMoveLock(pair.Value.nInvenSlot, false); if(AsHudDlgMgr.Instance.IsOpenInven == true) AsHudDlgMgr.Instance.invenDlg.ApplySlotMoveLock(); m_dicPlayerShopItem.Remove(pair.Key); } break; } } Debug.Log("AsPStoreManager::Recv_Owner_ItemBuy: m_dicPlayerShopItem.Count == " + m_dicPlayerShopItem.Count); if(m_dicPlayerShopItem.Count == 0) { Debug.Log("AsPStoreManager::Recv_Owner_ItemBuy: m_dicPlayerShopItem.Count == 0"); string str = AsTableManager.Instance.GetTbl_String(201); AsChatManager.Instance.InsertChat(str, eCHATTYPE.eCHATTYPE_SYSTEM); m_StoreState = ePStoreState.Closed; AsHudDlgMgr.Instance.ClosePStore(); } Debug.Log("AsPStoreManager::Recv_Owner_ItemBuy: " + _buy.eResult); }
public void RemovePStoreItem(body_SC_PRIVATESHOP_OWNER_ITEMBUY _item) { if( ( slots.Count - 1) < _item.nPrivateShopSlot || _item.nPrivateShopSlot < 0) return; slots[_item.nPrivateShopSlot].Clear(); SetRestoreSlot(); }