本文整理汇总了C++中cPlayer::GetClientHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ cPlayer::GetClientHandle方法的具体用法?C++ cPlayer::GetClientHandle怎么用?C++ cPlayer::GetClientHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cPlayer
的用法示例。
在下文中一共展示了cPlayer::GetClientHandle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenedByPlayer
void cBeaconWindow::OpenedByPlayer(cPlayer & a_Player)
{
super::OpenedByPlayer(a_Player);
a_Player.GetClientHandle()->SendWindowProperty(*this, 0, m_Beacon->GetBeaconLevel());
a_Player.GetClientHandle()->SendWindowProperty(*this, 1, m_Beacon->GetPrimaryEffect());
a_Player.GetClientHandle()->SendWindowProperty(*this, 2, m_Beacon->GetSecondaryEffect());
}
示例2: OnRightPaintEnd
void cWindow::OnRightPaintEnd(cPlayer & a_Player)
{
// Process the entire action stored in the internal structures for inventory painting
// distribute one item into each slot
const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots();
cItem ToDistribute(a_Player.GetDraggingItem());
int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, 1, SlotNums);
// Remove the items distributed from the dragging item:
a_Player.GetDraggingItem().m_ItemCount -= NumDistributed;
if (a_Player.GetDraggingItem().m_ItemCount == 0)
{
a_Player.GetDraggingItem().Empty();
}
SendWholeWindow(*a_Player.GetClientHandle());
// To fix #2345 (custom recipes don't work when inventory-painting), we send the result slot explicitly once again
// This is a fix for what seems like a client-side bug
a_Player.GetClientHandle()->SendInventorySlot(m_WindowID, 0, *GetSlot(a_Player, 0));
}
示例3: OpenedByPlayer
void cWindow::OpenedByPlayer(cPlayer & a_Player)
{
{
cCSLock Lock(m_CS);
// If player is already in OpenedBy remove player first
m_OpenedBy.remove(&a_Player);
// Then add player
m_OpenedBy.push_back(&a_Player);
for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
{
(*itr)->OnPlayerAdded(a_Player);
} // for itr - m_SlotAreas[]
}
a_Player.GetClientHandle()->SendWindowOpen(*this);
}
示例4: Lock
void cProtocol125::SendPlayerListItem(const cPlayer & a_Player, bool a_IsOnline)
{
cCSLock Lock(m_CSPacket);
AString PlayerName(a_Player.GetColor());
PlayerName.append(a_Player.GetName());
if (PlayerName.length() > 14)
{
PlayerName.erase(14);
}
PlayerName += cChatColor::White;
WriteByte ((unsigned char)PACKET_PLAYER_LIST_ITEM);
WriteString(PlayerName);
WriteBool (a_IsOnline);
WriteShort (a_IsOnline ? a_Player.GetClientHandle()->GetPing() : 0);
Flush();
}
示例5: OnRightPaintEnd
void cWindow::OnRightPaintEnd(cPlayer & a_Player)
{
// Process the entire action stored in the internal structures for inventory painting
// distribute one item into each slot
const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots();
cItem ToDistribute(a_Player.GetDraggingItem());
int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, 1, SlotNums);
// Remove the items distributed from the dragging item:
a_Player.GetDraggingItem().m_ItemCount -= NumDistributed;
if (a_Player.GetDraggingItem().m_ItemCount == 0)
{
a_Player.GetDraggingItem().Empty();
}
SendWholeWindow(*a_Player.GetClientHandle());
}
示例6: OnMiddlePaintEnd
void cWindow::OnMiddlePaintEnd(cPlayer & a_Player)
{
if (!a_Player.IsGameModeCreative())
{
// Midle click paint is only valid for creative mode
return;
}
// Fill available slots with full stacks of the dragging item
const auto & DraggingItem = a_Player.GetDraggingItem();
auto StackSize = ItemHandler(DraggingItem.m_ItemType)->GetMaxStackSize();
if (0 < DistributeItemToSlots(a_Player, DraggingItem, StackSize, a_Player.GetInventoryPaintSlots(), false))
{
// If any items were distibuted, set dragging item empty
a_Player.GetDraggingItem().Empty();
}
SendWholeWindow(*a_Player.GetClientHandle());
}
示例7: OnLeftPaintEnd
void cWindow::OnLeftPaintEnd(cPlayer & a_Player)
{
// Process the entire action stored in the internal structures for inventory painting
// distribute as many items as possible
const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots();
cItem ToDistribute(a_Player.GetDraggingItem());
int ToEachSlot = (int)ToDistribute.m_ItemCount / (int)SlotNums.size();
int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, ToEachSlot, SlotNums);
// Remove the items distributed from the dragging item:
a_Player.GetDraggingItem().m_ItemCount -= NumDistributed;
if (a_Player.GetDraggingItem().m_ItemCount == 0)
{
a_Player.GetDraggingItem().Empty();
}
SendWholeWindow(*a_Player.GetClientHandle());
}
示例8: SetOwner
void cMobHeadEntity::SetOwner(const cPlayer & a_Owner)
{
if (m_Type != SKULL_TYPE_PLAYER)
{
return;
}
m_OwnerName = a_Owner.GetName();
m_OwnerUUID = a_Owner.GetUUID();
const Json::Value & Properties = a_Owner.GetClientHandle()->GetProperties();
for (auto & Node : Properties)
{
if (Node.get("name", "").asString() == "textures")
{
m_OwnerTexture = Node.get("value", "").asString();
m_OwnerTextureSignature = Node.get("signature", "").asString();
break;
}
}
}
示例9: ClosedByPlayer
bool cWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse)
{
// Checks whether the player is still holding an item
if (a_Player.IsDraggingItem())
{
LOGD("Player holds item! Dropping it...");
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
}
cClientHandle * ClientHandle = a_Player.GetClientHandle();
if (ClientHandle != NULL)
{
ClientHandle->SendWindowClose(*this);
}
{
cCSLock Lock(m_CS);
for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
{
(*itr)->OnPlayerRemoved(a_Player);
} // for itr - m_SlotAreas[]
m_OpenedBy.remove(&a_Player);
if ((m_WindowType != wtInventory) && m_OpenedBy.empty())
{
Destroy();
}
}
if (m_IsDestroyed)
{
delete this;
}
return true;
}
示例10: SendSlot
void cWindow::SendSlot(cPlayer & a_Player, cSlotArea * a_SlotArea, int a_RelativeSlotNum)
{
int SlotBase = 0;
bool Found = false;
for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
{
if (*itr == a_SlotArea)
{
Found = true;
break;
}
SlotBase += (*itr)->GetNumSlots();
} // for itr - m_SlotAreas[]
if (!Found)
{
LOGERROR("cWindow::SendSlot(): unknown a_SlotArea");
ASSERT(!"cWindow::SendSlot(): unknown a_SlotArea");
return;
}
a_Player.GetClientHandle()->SendInventorySlot(
m_WindowID, a_RelativeSlotNum + SlotBase, *(a_SlotArea->GetSlot(a_RelativeSlotNum, a_Player))
);
}
示例11: SetProperty
void cWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Player)
{
a_Player.GetClientHandle()->SendWindowProperty(*this, a_Property, a_Value);
}