コード例 #1
0
ファイル: UITree.cpp プロジェクト: RocketersAlex/LCSource
void CUITree::addTree( CUITree* pTree, bool bAddBtn )
{
	if (pTree == NULL)
		return;

	// 기본 아이디 지정
	char buf[64];
	int		idx = m_vecTree.size();
	sprintf(buf, "tree_item_%03d", idx + 1);
	pTree->setID(buf);
	pTree->setControlIndex(idx);

	m_vecTree.push_back(pTree);
	addChild(pTree);

	CUICheckButton* pCheck = pTree->getCheck();
	if (bAddBtn == true && pCheck != NULL)
	{
		{
			int x, y;
			pCheck->GetPos(x, y);
		
			int h = getChildMaxHeight();

			h -= pCheck->GetHeight();

			if (h > 0)
			{
				y = y + (h / 2);
				pCheck->SetPos(x, y);
			}
		}
		
		pTree->addChild(pCheck);
		pTree->setAddCheck(true);
		CmdUncollapse* pCmd = new CmdUncollapse;
		pCmd->setData(pTree);
		pCheck->SetCommand(pCmd);
	}
}
コード例 #2
0
void CUIQuestBook::RefreshQuestListNew()
{
	CTString strTemp;

	m_pTreeRoot->deleteChildAll();
	m_pTreeRoot->clearChildList();
	m_mapQuestSelect.clear();

	CUIBase* pBase = m_pTreeDesign->findUI("tree_root");
	CUIBase* pTemp = m_pTreeDesign->findUI("tree_1");
	CUIBase* pTreeQuest = m_pTreeDesign->findUI("tree_quest");
	CUIText* pText = (CUIText*)pTemp->findUI("str_treename");
	int i;
	
	if (pBase == NULL || pTemp == NULL || pTreeQuest == NULL || pText == NULL)
		return;

	Quest* pQuest = GAMEDATAMGR()->GetQuest();

	if (pQuest == NULL)
		return;

	int nProceedCount = pQuest->GetListProceedCount();
	int nCompleteCount = pQuest->GetListCompleteCount();
	int nRaidCount = pQuest->GetListRaidCount();

	if (m_pstrQuestCnt != NULL)
	{
		strTemp.PrintF("%d / %d", nProceedCount + nCompleteCount, DEF_MAX_QUEST);
		m_pstrQuestCnt->SetText(strTemp);
	}

	// 진행중
	m_pTree[eTREE_PROCEED] = (CUITree*)pBase->Clone();
	m_pTree[eTREE_PROCEED]->InitPos(0, 0, 260, 20);
	if (pText != NULL)
	{
		strTemp.PrintF(_S( 1707, "진행중인 퀘스트 (%d)" ), nProceedCount);
		pText->InitPos(20, 0, 260, 16);
		pText->SetText(strTemp);
	}

	m_pTree[eTREE_PROCEED]->addChild(pTemp->Clone());
	m_pTreeRoot->addTree(m_pTree[eTREE_PROCEED]);

	// 진행중 퀘스트 내용 표시
	for (i = 0; i < nProceedCount; i++)
	{
		CUITree* pProceedQuest = (CUITree*)pTreeQuest->Clone();

		if (pProceedQuest == NULL)
			continue;

		CUIImage* pImg = (CUIImage*)m_pDesign->CloneSelectQuest();

		if (pImg != NULL)
		{
			pImg->Hide(TRUE);
			pProceedQuest->addChild(pImg);
		}

		CUICheckButton* pCheck = (CUICheckButton*)pProceedQuest->findUI("quest_veiw");
		CUIText* pQuestText = (CUIText*)pProceedQuest->findUI("quest_name");
		int nQuestIndex = pQuest->GetListProceedIndex(i);

		pImg = (CUIImage*)pProceedQuest->findUI("img_selectMenu");

		if (pImg != NULL)
		{
			pImg->SetPos(DEF_SELECT_QUEST_POSX, DEF_SELECT_QUEST_POSY);
			m_mapQuestSelect.insert(std::make_pair(nQuestIndex, pImg));
		}

		if (pCheck != NULL)
		{
			CmdQuestBookView* pCmd = new CmdQuestBookView;
			pCmd->setData(pCheck, nQuestIndex);
			pCheck->SetCommand(pCmd);
			if (pQuest->IsSelectedQuest(nQuestIndex) == true)
				pCheck->SetCheck(TRUE);
		}

		if (pQuestText != NULL)
		{			
			CTString strQuestTitle = pQuest->GetListProceedTitle(i);
			CQuestDynamicData* pQuestDD = CQuestSystem::Instance().GetDynamicDataByQuestIndex( nQuestIndex );

			if( pQuestDD )
			{
				strTemp.PrintF("[%d] %s", pQuestDD->GetNeedMinLevel(), strQuestTitle);
				strTemp = MakeTitleString(strTemp, 30);
			}
			else
			{
				strTemp = MakeTitleString(strQuestTitle, 30);			
			}

			pQuestText->SetText(strTemp);

			CmdQuestBookSelect* pCmd = new CmdQuestBookSelect;
			pCmd->setData(this, nQuestIndex);
			pQuestText->SetCommandUp(pCmd);
		}

		CUITree* pChildTree = (CUITree*)pBase->Clone();
		pChildTree->InitPos(0, 0, 260, 16);
		pChildTree->addChild(pProceedQuest);

		pProceedQuest->InitPos(15, 0, 220, 16);
		m_pTree[eTREE_PROCEED]->addTree(pChildTree, false);	
	}
	
	// 완료
	m_pTree[eTREE_COMPLETE] = (CUITree*)pBase->Clone();
	m_pTree[eTREE_COMPLETE]->InitPos(0, 25, 260, 20);
	
	if (pText != NULL)
	{
		strTemp.PrintF(_S( 1708, "완료된 퀘스트 (%d)" ), nCompleteCount);
		pText->InitPos(20, 0, 260, 16);
		pText->SetText(strTemp);
	}

	m_pTree[eTREE_COMPLETE]->addChild(pTemp->Clone());
	m_pTreeRoot->addTree(m_pTree[eTREE_COMPLETE]);

	// 완료된 퀘스트 내용 표시
	for (i = 0; i < nCompleteCount; i++)
	{
		CUITree* pCompleteQuest = (CUITree*)pTreeQuest->Clone();

		if (pCompleteQuest == NULL)
			continue;

		CUIImage* pImg = (CUIImage*)m_pDesign->CloneSelectQuest();

		if (pImg != NULL)
		{
			pImg->Hide(TRUE);
			pCompleteQuest->addChild(pImg);
		}

		CUICheckButton* pCheck = (CUICheckButton*)pCompleteQuest->findUI("quest_veiw");
		CUIText* pQuestText = (CUIText*)pCompleteQuest->findUI("quest_name");
		int nQuestIndex = pQuest->GetListCompleteIndex(i);

		pImg = (CUIImage*)pCompleteQuest->findUI("img_selectMenu");

		if (pImg != NULL)
		{
			pImg->SetPos(DEF_SELECT_QUEST_POSX, DEF_SELECT_QUEST_POSY);
			m_mapQuestSelect.insert(std::make_pair(nQuestIndex, pImg));
		}

		if (pCheck != NULL)
		{
			CmdQuestBookView* pCmd = new CmdQuestBookView;
			pCmd->setData(pCheck, nQuestIndex);
			pCheck->SetCommand(pCmd);

			if (pQuest->IsSelectedQuest(nQuestIndex) == true)
				pCheck->SetCheck(TRUE);
		}

		if (pQuestText != NULL)
		{
			CTString strQuestTitle = pQuest->GetListCompleteTitle(i);
			CQuestDynamicData* pQuestDD = CQuestSystem::Instance().GetDynamicDataByQuestIndex( nQuestIndex );

			if( pQuestDD )
			{
				strTemp.PrintF("[%d] %s", pQuestDD->GetNeedMinLevel(), strQuestTitle);
				strTemp = MakeTitleString(strTemp, 30);
			}
			else
			{
				strTemp = MakeTitleString(strQuestTitle, 30);
			}

			pQuestText->SetText(strTemp);
			CmdQuestBookSelect* pCmd = new CmdQuestBookSelect;
			pCmd->setData(this, nQuestIndex);
			pQuestText->SetCommandUp(pCmd);
		}

		CUITree* pChildTree = (CUITree*)pBase->Clone();
		pChildTree->InitPos(0, 0, 260, 16);
		pChildTree->addChild(pCompleteQuest);

		pCompleteQuest->InitPos(15, 0, 220, 16);
		m_pTree[eTREE_COMPLETE]->addTree(pChildTree, false);
	}

	// 레이드
	m_pTree[eTREE_RAID] = (CUITree*)pBase->Clone();
	m_pTree[eTREE_RAID]->InitPos(0, 50, 260, 20);
	
	if (pText != NULL)
	{
		strTemp.PrintF(_S( 4429, "레이드 진행 메시지 (%d)" ), nRaidCount);
		pText->InitPos(20, 0, 260, 16);
		pText->SetText(strTemp);
	}

	m_pTree[eTREE_RAID]->addChild(pTemp->Clone());
	m_pTreeRoot->addTree(m_pTree[eTREE_RAID]);

	// 레이드 내용 표시
	for (i = 0; i < nRaidCount; i++)
	{
		CUITree* pRaidQuest = (CUITree*)pTreeQuest->Clone();

		if (pRaidQuest == NULL)
			continue;

		CUIImage* pImg = (CUIImage*)m_pDesign->CloneSelectQuest();

		if (pImg != NULL)
		{
			pImg->Hide(TRUE);
			pRaidQuest->addChild(pImg);
		}

		CUICheckButton* pCheck = (CUICheckButton*)pRaidQuest->findUI("quest_veiw");
		CUIText* pQuestText = (CUIText*)pRaidQuest->findUI("quest_name");
		int nQuestIndex = pQuest->GetListRaidIndex(i);

		pImg = (CUIImage*)pRaidQuest->findUI("img_selectMenu");

		if (pImg != NULL)
		{
			pImg->SetPos(DEF_SELECT_QUEST_POSX, DEF_SELECT_QUEST_POSY);
			m_mapQuestSelect.insert(std::make_pair(nQuestIndex, pImg));
		}

		if (pCheck != NULL)
		{
			pCheck->Hide(TRUE);
		}

		if (pQuestText != NULL)
		{
			CTString strQuestTitle = pQuest->GetListRaidTitle(i);
			CQuestDynamicData* pQuestDD = CQuestSystem::Instance().GetDynamicDataByQuestIndex( nQuestIndex );

			if( pQuestDD )
				strTemp.PrintF("%s", strQuestTitle);

			pQuestText->SetText(strTemp);
			CmdQuestBookSelect* pCmd = new CmdQuestBookSelect;
			pCmd->setData(this, nQuestIndex);
			pQuestText->SetCommandUp(pCmd);
		}

		CUITree* pChildTree = (CUITree*)pBase->Clone();
		pChildTree->InitPos(0, 0, 260, 16);
		pChildTree->addChild(pRaidQuest);

		pRaidQuest->InitPos(15, 0, 220, 16);
		m_pTree[eTREE_RAID]->addTree(pChildTree, false);
	}
	
	for (i = 0; i < eTREE_MAX; i++)
	{
		if (m_pTree[i] != NULL)
		{
			m_pTree[i]->setUncollapse(pQuest->GetExtend((eTREE_TYPE)i));

			CUICheckButton* pCheck = m_pTree[i]->getCheck();

			if (pCheck != NULL)
			{
				CmdQuestBookExtend* pCmd = new CmdQuestBookExtend;
				pCmd->setData(m_pTree[i], (eTREE_TYPE)i);
				pCheck->SetCommand(pCmd);
			}
		}
	}
	
	m_pTreeRoot->updateTree();
}