Exemplo n.º 1
0
void CUIImageBox::SetImageByType(eImageType type, int index, int nSyndiType /* = 0 */)
{
	FLOAT fTexWidth;
	FLOAT fTexHeight;
	int nTexRow, nTexCol;
	int nTextureID;
	
	switch(type)
	{
	case IT_EXP://hardcoding	
		{
			nTextureID = 1;
			nTexRow = 15;
			nTexCol = 5;
			m_eUBType = UBET_ITEM;
		} break;
	case IT_SP:	// [090617: selo] SP 이미지 추가 하드코딩
		{
			// only russia sp icon [9/9/2010 rumist]
#if defined (G_RUSSIA)
			nTextureID = 12;
			nTexRow = 0;
			nTexCol = 2;
			m_eUBType = UBET_ITEM;
#else
			nTextureID = 9;
			nTexRow = 12;
			nTexCol = 11;
			m_eUBType = UBET_ITEM;
#endif			
		} break;
	case IT_MONEY:
	case IT_ITEM:
		{
			if(IT_MONEY == type) index = 19;//hardcoding
			CItemData*	pItemData = _pNetwork->GetItemData( index );
			nTextureID = pItemData->GetIconTexID();
			nTexRow = pItemData->GetIconTexRow();
			nTexCol = pItemData->GetIconTexCol();
			m_eUBType = UBET_ITEM;
		} break;
	case IT_SKILL:
		{
			CSkill	&rSkillData = _pNetwork->GetSkillData( index );
			nTextureID = rSkillData.GetIconTexID();
			nTexRow = rSkillData.GetIconTexRow();
			nTexCol = rSkillData.GetIconTexCol();
			m_eUBType = UBET_SKILL;
		} break;
	case IT_SSKILL:// Special Skill
		{
			CSpecialSkill* pSSkillData = CSpecialSkill::getData(index);
			if (pSSkillData == NULL)
				return;
			nTextureID = pSSkillData->GetIconTexID();
			nTexRow = pSSkillData->GetIconTexRow();
			nTexCol = pSSkillData->GetIconTexCol();
			m_eUBType = UBET_SKILL;
		} break;
	case IT_ACTION:
		{
			CAction* pActionData = CAction::getData(index);
			if (pActionData == NULL)
				return;
			nTextureID = pActionData->GetTexID();
			nTexRow = pActionData->GetTexRow();
			nTexCol = pActionData->GetTexCol();
			m_eUBType = UBET_ACTION;
		} break;
	case IT_RVR_POINT:
		{
			nTextureID = 19;
			nTexRow = 2;
			nTexCol = 3;
			m_eUBType = UBET_ITEM;

			// 딜라문 npc면
			if (nSyndiType == 2)	
				nTexCol = 4;
		} break;
	case IT_CORPS:
		{
			InitCorpsImageBox();
			SetImageForCorps( type, index );
			return;
		} break;

	case IT_AFFINITY: // 친화도 개편2 이미지 박스에 친화도 추가 [2/6/2013 Ranma]
		{
			CAffinityData*	rAffinityData = _pNetwork->GetAffinityData();
					
			nTextureID = rAffinityData->GetAffinityDataByIndex(index)->nIconTextureID;
			nTexRow = rAffinityData->GetAffinityDataByIndex(index)->nIconTextureRow;
			nTexCol = rAffinityData->GetAffinityDataByIndex(index)->nIconTextureCol;
			m_eUBType = UBET_SKILL;
		} break;

	case IT_AFFINITY_MONSTER: // 친화도 개편2 이미지 박스에 친화도 추가 [2/6/2013 Ranma]
		{
			CAffinityData* pTempAffinityData = _pNetwork->GetAffinityData();
				
			// 맵은 키값으로 소팅이 되기 때문에 값이 뒤에서부터 들어가 있다. 그래서 뒤에서 부터 값을 가져도록 하자 최대한 근접하게 [2/7/2013 Ranma]
			CAffinityData::mapAffReverseIter itermapBegin = pTempAffinityData->mapAffinity_Data.rbegin();
			CAffinityData::mapAffReverseIter itermapEnd = pTempAffinityData->mapAffinity_Data.rend();
			CAffinityData::mapAffReverseIter itermapP = itermapBegin;
			
			for (; itermapP != itermapEnd; itermapP++)
			{
				int pInfoIndex = (*itermapP).first;

				int nNPCIndex = _pNetwork->GetAffinityData()->GetAdminNPCIndex(pInfoIndex);
							
				std::vector<CAffinityData::_AffinityMonsterInfo>::iterator b, e;
				b = _pNetwork->GetAffinityData()->GetAffinityData(nNPCIndex)->vecMonsterList.begin();
				e = _pNetwork->GetAffinityData()->GetAffinityData(nNPCIndex)->vecMonsterList.end();
				for (int i = 0; b != e; b++, i++)
				{
					if ( b->index ==  index)
					{
						nTextureID = b->TextureID;
						nTexRow = b->TextureRow;
						nTexCol = b->TextureCol;
						m_eUBType = UBET_COMBO;

						fTexWidth = _pUIBtnTexMgr->GetTexWidth( UIBtnExType(m_eUBType), nTextureID );
						fTexHeight = _pUIBtnTexMgr->GetTexHeight( UIBtnExType(m_eUBType), nTextureID );
						m_ptdBaseTexture = _pUIBtnTexMgr->GetTex( UIBtnExType(m_eUBType), nTextureID );
						m_ptdBaseTexture->AddReference();
						
						int	nUVSX = 50 * nTexCol;
						int	nUVSY = 50 * nTexRow;
						SetUV( nUVSX, nUVSY, nUVSX + 50, nUVSY + 50, fTexWidth, fTexHeight );
						
						m_eImageType = type;
						m_nTextureID = nTextureID;
						return;
					}
				}
			}
		} break;

	default:
		{
			ASSERTALWAYS("Somthing wrong");
		} break;
	}

	fTexWidth = _pUIBtnTexMgr->GetTexWidth( UIBtnExType(m_eUBType), nTextureID );
	fTexHeight = _pUIBtnTexMgr->GetTexHeight( UIBtnExType(m_eUBType), nTextureID );
	m_ptdBaseTexture = _pUIBtnTexMgr->GetTex( UIBtnExType(m_eUBType), nTextureID );
	m_ptdBaseTexture->AddReference();

	int	nUVSX = BTN_SIZE * nTexCol;
	int	nUVSY = BTN_SIZE * nTexRow;
	SetUV( nUVSX, nUVSY, nUVSX + BTN_SIZE, nUVSY + BTN_SIZE, fTexWidth, fTexHeight );

	m_eImageType = type;
	m_nTextureID = nTextureID;
}