- Mesaj
- 98
- Çözümler
- 4
- Beğeni
- 7
- Puan
- 49
- Ticaret Puanı
- 0
merhaba arkadaşlar lonca lider ve lonca generali artı olarak nıck yanında bulunan turk bayragı ıconu sılmek ıstıyorum tamamen yanlız sılmeye kalkıstım devre dısı bıraktım yapay zeka destegı ıle yapmaya calıstım buıld alırken nedense karsılastıgım hatalar cok oldu sız degerlı ustadlarım kodu sıze paylaşıyorum bana duzenleme yapıp gonderebılırmısın pyton dılı uzerınde acemıyım yenı yenı yetısmeye calıstıgım ıcın baya kaldırma vakıtımı aldı tesekur ederım ılgınız ıcın allah razı olsun sımdıden
PythonTextTail:
//
// ij¸¯Å͸¦ µû¶ó´Ù´Ï´Â ÅؽºÆ® °ü·Ã ¼Ò½º (À̸§, ±æµåÀ̸§, ±æµå¸¶Å© µî)
//
#include "stdafx.h"
#include "InstanceBase.h"
#include "resource.h"
#include "PythonTextTail.h"
#include "PythonCharacterManager.h"
#include "PythonGuild.h"
#include "Locale.h"
#include "MarkManager.h"
const D3DXCOLOR c_TextTail_Player_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
const D3DXCOLOR c_TextTail_Monster_Color = D3DXCOLOR(1.0f, 0.0f, 0.0f, 1.0f);
const D3DXCOLOR c_TextTail_Item_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
const D3DXCOLOR c_TextTail_Chat_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
const D3DXCOLOR c_TextTail_Info_Color = D3DXCOLOR(1.0f, 0.785f, 0.785f, 1.0f);
const D3DXCOLOR c_TextTail_Guild_Name_Color = 0xFFEFD3FF;
const float c_TextTail_Name_Position = -10.0f;
const float c_fxMarkPosition = 1.5f;
#ifdef ENABLE_TITLE_SYSTEM
const float c_fyGuildNamePosition = 25.0f;
const float c_fyMarkPosition = 25.0f + 11.0f;
const float c_fysTitlePosition = 12.0f;
const float c_fyGuildNamePositionOld = 15.0f;
const float c_fyMarkPositionOld = 15.0f + 11.0f;
#else
const float c_fyGuildNamePosition = 15.0f;
const float c_fyMarkPosition = 15.0f + 11.0f;
#endif
BOOL bPKTitleEnable = TRUE;
// TEXTTAIL_LIVINGTIME_CONTROL
long gs_TextTail_LivingTime = 5000;
long TextTail_GetLivingTime()
{
assert(gs_TextTail_LivingTime>1000);
return gs_TextTail_LivingTime;
}
void TextTail_SetLivingTime(long livingTime)
{
gs_TextTail_LivingTime = livingTime;
}
// END_OF_TEXTTAIL_LIVINGTIME_CONTROL
CGraphicText * ms_pFont = NULL;
void CPythonTextTail::GetInfo(std::string* pstInfo)
{
char szInfo[256];
sprintf(szInfo, "TextTail: ChatTail %d, ChrTail (Map %d, List %d), ItemTail (Map %d, List %d), Pool %d",
m_ChatTailMap.size(),
m_CharacterTextTailMap.size(), m_CharacterTextTailList.size(),
m_ItemTextTailMap.size(), m_ItemTextTailList.size(),
m_TextTailPool.GetCapacity());
pstInfo->append(szInfo);
}
void CPythonTextTail::UpdateAllTextTail()
{
CInstanceBase * pInstance = CPythonCharacterManager::Instance().GetMainInstancePtr();
if (pInstance)
{
TPixelPosition pixelPos;
pInstance->NEW_GetPixelPosition(&pixelPos);
TTextTailMap::iterator itorMap;
for (itorMap = m_CharacterTextTailMap.begin(); itorMap != m_CharacterTextTailMap.end(); ++itorMap)
{
UpdateDistance(pixelPos, itorMap->second);
}
for (itorMap = m_ItemTextTailMap.begin(); itorMap != m_ItemTextTailMap.end(); ++itorMap)
{
UpdateDistance(pixelPos, itorMap->second);
}
for (TChatTailMap::iterator itorChat=m_ChatTailMap.begin(); itorChat!=m_ChatTailMap.end(); ++itorChat)
{
UpdateDistance(pixelPos, itorChat->second);
// NOTE : Chat TextTailÀÌ ÀÖÀ¸¸é ij¸¯ÅÍ À̸§µµ Ãâ·ÂÇÑ´Ù.
if (itorChat->second->bNameFlag)
{
DWORD dwVID = itorChat->first;
ShowCharacterTextTail(dwVID);
}
}
}
}
void CPythonTextTail::UpdateShowingTextTail()
{
TTextTailList::iterator itor;
for (itor = m_ItemTextTailList.begin(); itor != m_ItemTextTailList.end(); ++itor)
{
UpdateTextTail(*itor);
}
for (TChatTailMap::iterator itorChat=m_ChatTailMap.begin(); itorChat!=m_ChatTailMap.end(); ++itorChat)
{
UpdateTextTail(itorChat->second);
}
for (itor = m_CharacterTextTailList.begin(); itor != m_CharacterTextTailList.end(); ++itor)
{
TTextTail * pTextTail = *itor;
UpdateTextTail(pTextTail);
// NOTE : Chat TextTailÀÌ ÀÖÀ» °æ¿ì À§Ä¡¸¦ ¹Ù²Û´Ù.
TChatTailMap::iterator itor = m_ChatTailMap.find(pTextTail->dwVirtualID);
if (m_ChatTailMap.end() != itor)
{
TTextTail * pChatTail = itor->second;
if (pChatTail->bNameFlag)
{
pTextTail->y = pChatTail->y - 17.0f;
}
}
}
}
void CPythonTextTail::UpdateTextTail(TTextTail * pTextTail)
{
if (!pTextTail->pOwner)
return;
/////
CPythonGraphic & rpyGraphic = CPythonGraphic::Instance();
rpyGraphic.Identity();
const D3DXVECTOR3 & c_rv3Position = pTextTail->pOwner->GetPosition();
rpyGraphic.ProjectPosition(c_rv3Position.x,
c_rv3Position.y,
c_rv3Position.z + pTextTail->fHeight,
&pTextTail->x,
&pTextTail->y,
&pTextTail->z);
pTextTail->x = floorf(pTextTail->x);
pTextTail->y = floorf(pTextTail->y);
// NOTE : 13m ¹Û¿¡ ÀÖÀ»¶§¸¸ ±íÀ̸¦ ³Ö½À´Ï´Ù - [levites]
if (pTextTail->fDistanceFromPlayer < 1300.0f)
{
pTextTail->z = 0.0f;
}
else
{
pTextTail->z = pTextTail->z * CPythonGraphic::Instance().GetOrthoDepth() * -1.0f;
pTextTail->z += 10.0f;
}
}
void CPythonTextTail::ArrangeTextTail()
{
TTextTailList::iterator itor;
TTextTailList::iterator itorCompare;
DWORD dwTime = CTimer::Instance().GetCurrentMillisecond();
for (itor = m_ItemTextTailList.begin(); itor != m_ItemTextTailList.end(); ++itor)
{
TTextTail * pInsertTextTail = *itor;
int yTemp = 5;
int LimitCount = 0;
for (itorCompare = m_ItemTextTailList.begin(); itorCompare != m_ItemTextTailList.end();)
{
TTextTail * pCompareTextTail = *itorCompare;
if (*itorCompare == *itor)
{
++itorCompare;
continue;
}
if (LimitCount >= 20)
break;
if (isIn(pInsertTextTail, pCompareTextTail))
{
pInsertTextTail->y = (pCompareTextTail->y + pCompareTextTail->yEnd + yTemp);
itorCompare = m_ItemTextTailList.begin();
++LimitCount;
continue;
}
++itorCompare;
}
if (pInsertTextTail->pOwnerTextInstance)
{
pInsertTextTail->pOwnerTextInstance->SetPosition(pInsertTextTail->x, pInsertTextTail->y, pInsertTextTail->z);
pInsertTextTail->pOwnerTextInstance->Update();
pInsertTextTail->pTextInstance->SetColor(pInsertTextTail->Color.r, pInsertTextTail->Color.g, pInsertTextTail->Color.b);
pInsertTextTail->pTextInstance->SetPosition(pInsertTextTail->x, pInsertTextTail->y + 15.0f, pInsertTextTail->z);
pInsertTextTail->pTextInstance->Update();
}
else
{
pInsertTextTail->pTextInstance->SetColor(pInsertTextTail->Color.r, pInsertTextTail->Color.g, pInsertTextTail->Color.b);
pInsertTextTail->pTextInstance->SetPosition(pInsertTextTail->x, pInsertTextTail->y, pInsertTextTail->z);
pInsertTextTail->pTextInstance->Update();
}
}
for (itor = m_CharacterTextTailList.begin(); itor != m_CharacterTextTailList.end(); ++itor)
{
TTextTail * pTextTail = *itor;
float fxAdd = 0.0f;
#ifdef ENABLE_TITLE_SYSTEM
CGraphicTextInstance * psTitleNameInstance = pTextTail->psTitleNameTextInstance;
if (psTitleNameInstance)
{
int iWidth, iHeight;
psTitleNameInstance->GetTextSize(&iWidth, &iHeight);
psTitleNameInstance->SetPosition(pTextTail->x, pTextTail->y - c_fysTitlePosition, pTextTail->z);
psTitleNameInstance->Update();
}
#endif
CGraphicMarkInstance * pMarkInstance = pTextTail->pMarkInstance;
CGraphicTextInstance * pGuildNameInstance = pTextTail->pGuildNameTextInstance;
#ifdef ENABLE_TURKISH_FLAG
CGraphicImageInstance * pTunga = pTextTail->pTurkishFlagInstance;
#endif
if (pMarkInstance && pGuildNameInstance)
{
int iWidth, iHeight;
int iImageHalfSize = pMarkInstance->GetWidth() / 2 + c_fxMarkPosition;
pGuildNameInstance->GetTextSize(&iWidth, &iHeight);
#ifdef ENABLE_TITLE_SYSTEM
if (!psTitleNameInstance)
{
pMarkInstance->SetPosition(pTextTail->x - iWidth / 2 - iImageHalfSize, pTextTail->y - c_fyMarkPositionOld);
pGuildNameInstance->SetPosition(pTextTail->x + iImageHalfSize, pTextTail->y - c_fyGuildNamePositionOld, pTextTail->z);
}
else
{
pMarkInstance->SetPosition(pTextTail->x - iWidth / 2 - iImageHalfSize, pTextTail->y - c_fyMarkPosition);
pGuildNameInstance->SetPosition(pTextTail->x + iImageHalfSize, pTextTail->y - c_fyGuildNamePosition, pTextTail->z);
}
#else
pMarkInstance->SetPosition(pTextTail->x - iWidth / 2 - iImageHalfSize, pTextTail->y - c_fyMarkPosition);
pGuildNameInstance->SetPosition(pTextTail->x + iImageHalfSize, pTextTail->y - c_fyGuildNamePosition, pTextTail->z);
#endif
pGuildNameInstance->Update();
}
int iNameWidth, iNameHeight;
pTextTail->pTextInstance->GetTextSize(&iNameWidth, &iNameHeight);
// Title À§Ä¡ ¾÷µ¥ÀÌÆ®
CGraphicTextInstance * pTitle = pTextTail->pTitleTextInstance;
if (pTitle)
{
int iTitleWidth, iTitleHeight;
pTitle->GetTextSize(&iTitleWidth, &iTitleHeight);
fxAdd = 8.0f;
if (LocaleService_IsEUROPE()) // µ¶ÀϾî´Â ¸íĪÀÌ ±æ¾î ¿À¸¥Á¤·Ä
{
if( GetDefaultCodePage() == CP_ARABIC )
{
pTitle->SetPosition(pTextTail->x - (iNameWidth / 2) - iTitleWidth - 4.0f, pTextTail->y, pTextTail->z);
}
else
{
pTitle->SetPosition(pTextTail->x - (iNameWidth / 2), pTextTail->y, pTextTail->z);
}
}
else
{
pTitle->SetPosition(pTextTail->x - (iNameWidth / 2) - fxAdd, pTextTail->y, pTextTail->z);
}
pTitle->Update();
// Level À§Ä¡ ¾÷µ¥ÀÌÆ®
CGraphicTextInstance * pLevel = pTextTail->pLevelTextInstance;
if (pLevel)
{
int iLevelWidth, iLevelHeight;
pLevel->GetTextSize(&iLevelWidth, &iLevelHeight);
if (LocaleService_IsEUROPE()) // µ¶ÀϾî´Â ¸íĪÀÌ ±æ¾î ¿À¸¥Á¤·Ä
{
if( GetDefaultCodePage() == CP_ARABIC )
{
pLevel->SetPosition(pTextTail->x - (iNameWidth / 2) - iLevelWidth - iTitleWidth - 8.0f, pTextTail->y, pTextTail->z);
}
else
{
pLevel->SetPosition(pTextTail->x - (iNameWidth / 2) - iTitleWidth, pTextTail->y, pTextTail->z);
}
}
else
{
pLevel->SetPosition(pTextTail->x - (iNameWidth / 2) - fxAdd - iTitleWidth, pTextTail->y, pTextTail->z);
}
pLevel->Update();
}
}
else
{
fxAdd = 4.0f;
// Level À§Ä¡ ¾÷µ¥ÀÌÆ®
CGraphicTextInstance * pLevel = pTextTail->pLevelTextInstance;
if (pLevel)
{
int iLevelWidth, iLevelHeight;
pLevel->GetTextSize(&iLevelWidth, &iLevelHeight);
if (LocaleService_IsEUROPE()) // µ¶ÀϾî´Â ¸íĪÀÌ ±æ¾î ¿À¸¥Á¤·Ä
{
if( GetDefaultCodePage() == CP_ARABIC )
{
pLevel->SetPosition(pTextTail->x - (iNameWidth / 2) - iLevelWidth - 4.0f, pTextTail->y, pTextTail->z);
}
else
{
pLevel->SetPosition(pTextTail->x - (iNameWidth / 2), pTextTail->y, pTextTail->z);
}
}
else
{
pLevel->SetPosition(pTextTail->x - (iNameWidth / 2) - fxAdd, pTextTail->y, pTextTail->z);
}
pLevel->Update();
}
}
#ifdef ENABLE_TURKISH_FLAG
if (pTunga)
{
CGraphicTextInstance * pLevel = pTextTail->pLevelTextInstance;
if (pLevel)
{
int iLevelWidth, iLevelHeight, iTitleWidth, iTitleHeight;
pLevel->GetTextSize(&iLevelWidth, &iLevelHeight);
if (pTitle)
{
pTitle->GetTextSize (&iTitleWidth, &iTitleHeight);
pTunga->SetPosition (pTextTail->x - (iNameWidth / 2) - 4.0f - iTitleWidth - iLevelWidth - 15.0f- pTunga->GetWidth() / 2 + 8.5f, pTextTail->y - 10);
}
if (!pTitle)
pTunga->SetPosition (pTextTail->x - (iNameWidth / 2) - 4.0f - iLevelWidth - 15.0f - pTunga->GetWidth() / 2 + 8.5f, pTextTail->y - 10);
}
}
#endif
pTextTail->pTextInstance->SetColor(pTextTail->Color.r, pTextTail->Color.g, pTextTail->Color.b);
pTextTail->pTextInstance->SetPosition(pTextTail->x + fxAdd, pTextTail->y, pTextTail->z);
pTextTail->pTextInstance->Update();
}
for (TChatTailMap::iterator itorChat=m_ChatTailMap.begin(); itorChat!=m_ChatTailMap.end();)
{
TTextTail * pTextTail = itorChat->second;
if (pTextTail->LivingTime < dwTime)
{
DeleteTextTail(pTextTail);
itorChat = m_ChatTailMap.erase(itorChat);
continue;
}
else
++itorChat;
pTextTail->pTextInstance->SetColor(pTextTail->Color);
pTextTail->pTextInstance->SetPosition(pTextTail->x, pTextTail->y, pTextTail->z);
pTextTail->pTextInstance->Update();
}
}
void CPythonTextTail::Render()
{
TTextTailList::iterator itor;
for (itor = m_CharacterTextTailList.begin(); itor != m_CharacterTextTailList.end(); ++itor)
{
TTextTail * pTextTail = *itor;
pTextTail->pTextInstance->Render();
#ifdef ENABLE_TITLE_SYSTEM
if (pTextTail->psTitleNameTextInstance)
{
pTextTail->psTitleNameTextInstance->Render();
}
#endif
if (pTextTail->pMarkInstance && pTextTail->pGuildNameTextInstance)
{
pTextTail->pMarkInstance->Render();
pTextTail->pGuildNameTextInstance->Render();
}
if (pTextTail->pTitleTextInstance)
{
pTextTail->pTitleTextInstance->Render();
}
if (pTextTail->pLevelTextInstance)
{
pTextTail->pLevelTextInstance->Render();
}
#ifdef ENABLE_TURKISH_FLAG
if (pTextTail->pTurkishFlagInstance)
{
pTextTail->pTurkishFlagInstance->Render();
}
#endif
}
for (itor = m_ItemTextTailList.begin(); itor != m_ItemTextTailList.end(); ++itor)
{
TTextTail * pTextTail = *itor;
RenderTextTailBox(pTextTail);
pTextTail->pTextInstance->Render();
if (pTextTail->pOwnerTextInstance)
pTextTail->pOwnerTextInstance->Render();
}
for (TChatTailMap::iterator itorChat = m_ChatTailMap.begin(); itorChat!=m_ChatTailMap.end(); ++itorChat)
{
TTextTail * pTextTail = itorChat->second;
if (pTextTail->pOwner->isShow())
RenderTextTailName(pTextTail);
}
}
void CPythonTextTail::RenderTextTailBox(TTextTail * pTextTail)
{
// °ËÀº»ö Å׵θ®
CPythonGraphic::Instance().SetDiffuseColor(0.0f, 0.0f, 0.0f, 1.0f);
CPythonGraphic::Instance().RenderBox2d(pTextTail->x + pTextTail->xStart,
pTextTail->y + pTextTail->yStart,
pTextTail->x + pTextTail->xEnd,
pTextTail->y + pTextTail->yEnd,
pTextTail->z);
// °ËÀº»ö Åõ¸í¹Ú½º
CPythonGraphic::Instance().SetDiffuseColor(0.0f, 0.0f, 0.0f, 0.3f);
CPythonGraphic::Instance().RenderBar2d(pTextTail->x + pTextTail->xStart,
pTextTail->y + pTextTail->yStart,
pTextTail->x + pTextTail->xEnd,
pTextTail->y + pTextTail->yEnd,
pTextTail->z);
}
void CPythonTextTail::RenderTextTailName(TTextTail * pTextTail)
{
pTextTail->pTextInstance->Render();
}
void CPythonTextTail::HideAllTextTail()
{
// NOTE : Show AllÀ» ÇØÁØµÚ Hide AllÀ» ÇØÁÖÁö ¾ÊÀ¸¸é ¹®Á¦ ¹ß»ı °¡´É¼º ÀÖÀ½
// µğÀÚÀÎ ÀÚü°¡ ±×·¸°Ô ±ò²ûÇÏ°Ô µÇÁö ¾Ê¾ÒÀ½ - [levites]
m_CharacterTextTailList.clear();
m_ItemTextTailList.clear();
}
void CPythonTextTail::UpdateDistance(const TPixelPosition & c_rCenterPosition, TTextTail * pTextTail)
{
const D3DXVECTOR3 & c_rv3Position = pTextTail->pOwner->GetPosition();
D3DXVECTOR2 v2Distance(c_rv3Position.x - c_rCenterPosition.x, -c_rv3Position.y - c_rCenterPosition.y);
pTextTail->fDistanceFromPlayer = D3DXVec2Length(&v2Distance);
}
void CPythonTextTail::ShowAllTextTail()
{
TTextTailMap::iterator itor;
for (itor = m_CharacterTextTailMap.begin(); itor != m_CharacterTextTailMap.end(); ++itor)
{
TTextTail * pTextTail = itor->second;
if (pTextTail->fDistanceFromPlayer < 3500.0f)
ShowCharacterTextTail(itor->first);
}
for (itor = m_ItemTextTailMap.begin(); itor != m_ItemTextTailMap.end(); ++itor)
{
TTextTail * pTextTail = itor->second;
if (pTextTail->fDistanceFromPlayer < 3500.0f)
ShowItemTextTail(itor->first);
}
}
void CPythonTextTail::ShowCharacterTextTail(DWORD VirtualID)
{
TTextTailMap::iterator itor = m_CharacterTextTailMap.find(VirtualID);
if (m_CharacterTextTailMap.end() == itor)
return;
TTextTail * pTextTail = itor->second;
if (m_CharacterTextTailList.end() != std::find(m_CharacterTextTailList.begin(), m_CharacterTextTailList.end(), pTextTail))
{
//Tracef("ÀÌ¹Ì ¸®½ºÆ®¿¡ ÀÖÀ½ : %d\n", VirtualID);
return;
}
// NOTE : ShowAll ½Ã¿¡´Â ¸ğµç Instance ÀÇ Pointer ¸¦ ã¾Æ¼ üũÇϹǷΠºÎÇÏ°¡ °É¸± °¡´É¼ºµµ ÀÖ´Ù.
// CInstanceBase °¡ TextTail À» Á÷Á¢ °¡Áö°í ÀÖ´Â °ÍÀÌ °¡Àå ÁÁÀº ÇüÅÂÀÏ µí..
if (!pTextTail->pOwner->isShow())
return;
CInstanceBase * pInstance = CPythonCharacterManager::Instance().GetInstancePtr(pTextTail->dwVirtualID);
if (!pInstance)
return;
if (pInstance->IsGuildWall())
return;
if (pInstance->CanPickInstance())
m_CharacterTextTailList.push_back(pTextTail);
}
void CPythonTextTail::ShowItemTextTail(DWORD VirtualID)
{
TTextTailMap::iterator itor = m_ItemTextTailMap.find(VirtualID);
if (m_ItemTextTailMap.end() == itor)
return;
TTextTail * pTextTail = itor->second;
if (m_ItemTextTailList.end() != std::find(m_ItemTextTailList.begin(), m_ItemTextTailList.end(), pTextTail))
{
//Tracef("ÀÌ¹Ì ¸®½ºÆ®¿¡ ÀÖÀ½ : %d\n", VirtualID);
return;
}
m_ItemTextTailList.push_back(pTextTail);
}
bool CPythonTextTail::isIn(CPythonTextTail::TTextTail * pSource, CPythonTextTail::TTextTail * pTarget)
{
float x1Source = pSource->x + pSource->xStart;
float y1Source = pSource->y + pSource->yStart;
float x2Source = pSource->x + pSource->xEnd;
float y2Source = pSource->y + pSource->yEnd;
float x1Target = pTarget->x + pTarget->xStart;
float y1Target = pTarget->y + pTarget->yStart;
float x2Target = pTarget->x + pTarget->xEnd;
float y2Target = pTarget->y + pTarget->yEnd;
if (x1Source <= x2Target && x2Source >= x1Target &&
y1Source <= y2Target && y2Source >= y1Target)
{
return true;
}
return false;
}
void CPythonTextTail::RegisterCharacterTextTail(DWORD dwGuildID, BYTE dwNewIsGuildName, DWORD dwVirtualID, const D3DXCOLOR & c_rColor, float fAddHeight)
En son bir moderatör tarafından düzenlenmiş: