CUICheckButton* CScriptXmlInit::InitCheck(LPCSTR path, CUIWindow* parent){ CUICheckButton* pWnd = xr_new<CUICheckButton>(); CUIXmlInit::InitCheck(m_xml, path, 0, pWnd); pWnd->SetAutoDelete(true); _attach_child(pWnd, parent); //. if(parent) parent->AttachChild(pWnd); return pWnd; }
CUICheckButton* UIHelper::CreateCheck( CUIXml& xml, LPCSTR ui_path, CUIWindow* parent ) { CUICheckButton* ui = new CUICheckButton(); parent->AttachChild ( ui ); ui->SetAutoDelete ( true ); CUIXmlInit::InitCheck ( xml, ui_path, 0, ui ); return ui; }
CUIBase* CUICheckButton::Clone() { CUICheckButton* pCheckBtn = new CUICheckButton(*this); if (pCheckBtn == NULL) return NULL; pCheckBtn->setTexString(getTexString()); CUIBase::CloneChild(pCheckBtn); return (CUIBase*)pCheckBtn; }
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); } }
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(); }
void DETOUR_CScreenCharGen::DETOUR_KitPanelOnUpdate(CPanel& panel, CCreatureObject& cre) { CUIScrollBar& scroll = (CUIScrollBar&)panel.GetUIControl(6); pScrollActive = &scroll; Object& o = cre.oBase; CUIScrollBarChargenKit& scrollKit = (CUIScrollBarChargenKit&)panel.GetUIControl(15); CUICheckButtonChargenKit& option1 = (CUICheckButtonChargenKit&)panel.GetUIControl(1); CUICheckButtonChargenKit& option2 = (CUICheckButtonChargenKit&)panel.GetUIControl(2); CUICheckButtonChargenKit& option3 = (CUICheckButtonChargenKit&)panel.GetUIControl(3); CUICheckButtonChargenKit& option4 = (CUICheckButtonChargenKit&)panel.GetUIControl(4); CUICheckButtonChargenKit& option5 = (CUICheckButtonChargenKit&)panel.GetUIControl(9); CUICheckButtonChargenKit& option6 = (CUICheckButtonChargenKit&)panel.GetUIControl(10); CUICheckButtonChargenKit& option7 = (CUICheckButtonChargenKit&)panel.GetUIControl(11); CUICheckButtonChargenKit& option8 = (CUICheckButtonChargenKit&)panel.GetUIControl(12); CUICheckButtonChargenKit& option9 = (CUICheckButtonChargenKit&)panel.GetUIControl(13); CUICheckButtonChargenKit& option10 = (CUICheckButtonChargenKit&)panel.GetUIControl(14); CUICheckButtonChargenKit& option11 = (CUICheckButtonChargenKit&)panel.GetUIControl(16); CScreenCharGen* pCreateChar = g_pChitin->pCreateChar; CInfGame* pGame = g_pChitin->pGame; assert(&option1 != NULL); assert(&option2 != NULL); assert(&option3 != NULL); assert(&option4 != NULL); assert(&option5 != NULL); assert(&option6 != NULL); assert(&option7 != NULL); assert(&option8 != NULL); assert(&option9 != NULL); assert(&option10 != NULL); assert(pCreateChar != NULL); assert(pGame != NULL); if (&scrollKit == NULL || &option11 == NULL) { LPCTSTR lpsz = "DETOUR_CScreenCharGen::DETOUR_KitPanelOnUpdate(): Kit selection scroll bar or button 11 not found\r\n"; console.write(lpsz); L.timestamp(); L.append(lpsz); return (this->*Tramp_CScreenCharGen_KitPanelOnUpdate)(panel, cre); } IECString sClass, sRace, sKitName, sAlignment, sRowName, sKitFile; if (m_class) { sClass = pGame->GetClassString(m_class, KIT_TRUECLASS); } else { sClass = pGame->GetClassString(o.GetClass(), KIT_TRUECLASS); } sRace = pGame->GetRaceString(o.m_cRace); sKitFile = pGame->KITTABLE.GetValue(sRace, sClass); if (Kit_Class_Race.m_2da.name != sKitFile) { Kit_Class_Race.LoadTable(ResRef(sKitFile)); } for (int row = 0; row < Kit_Class_Race.nRows; row++) { int col = 0; IECString sKit; if (col < g_pChitin->pCreateChar->Kit_Class_Race.nCols && row < g_pChitin->pCreateChar->Kit_Class_Race.nRows && col >= 0 && row >= 0) { sKit = *((g_pChitin->pCreateChar->Kit_Class_Race.pDataArray) + (g_pChitin->pCreateChar->Kit_Class_Race.nCols * row + col)); } else { sKit = g_pChitin->pCreateChar->Kit_Class_Race.defaultVal; } unsigned int nKitId; sscanf_s((LPCTSTR)sKit, "%d", &nKitId); if (nKitId == 0) { //true class if (m_class) { pGame->GetDetailedClassString(m_class, KIT_TRUECLASS, 0, sKitName, cre); } else { pGame->GetDetailedClassString(o.GetClass(), KIT_TRUECLASS, 0, sKitName, cre); } } else { int col = 1; IECString sKitLowerStrRef; if (col < g_pChitin->pGame->KITLIST.nCols && nKitId < g_pChitin->pGame->KITLIST.nRows && col >= 0 && nKitId >= 0) { sKitLowerStrRef = *((g_pChitin->pGame->KITLIST.pDataArray) + (g_pChitin->pGame->KITLIST.nCols * nKitId + col)); } else { sKitLowerStrRef = g_pChitin->pGame->KITLIST.defaultVal; } STRREF strrefLower; sscanf_s((LPCTSTR)sKitLowerStrRef, "%d", &strrefLower); sKitName = GetTlkString(strrefLower); } switch (row - scrollKit.nCurrentValue) { case 0: option1.SetText(sKitName); break; case 1: option2.SetText(sKitName); break; case 2: option3.SetText(sKitName); break; case 3: option4.SetText(sKitName); break; case 4: option5.SetText(sKitName); break; case 5: option6.SetText(sKitName); break; case 6: option7.SetText(sKitName); break; case 7: option8.SetText(sKitName); break; case 8: option9.SetText(sKitName); break; case 9: option10.SetText(sKitName); break; case 10: option11.SetText(sKitName); break; } } //for (row) for (int index = 0; index < 11; index++) { CUICheckButton* pButton; switch (index) { case 0: pButton = &option1; break; case 1: pButton = &option2; break; case 2: pButton = &option3; break; case 3: pButton = &option4; break; case 4: pButton = &option5; break; case 5: pButton = &option6; break; case 6: pButton = &option7; break; case 7: pButton = &option8; break; case 8: pButton = &option9; break; case 9: pButton = &option10; break; case 10: pButton = &option11; break; } index += scrollKit.nCurrentValue; BOOL bKitAllowedByAlignment = FALSE; BOOL bAlignmentChecked = FALSE; unsigned int nKitId = 0; if ((index < Kit_Class_Race.nRows) && (nChargenProgress == 5)) { sAlignment = pGame->GetAlignmentString(o.m_cAlignment); int col = 0; IECString sKit; if (col < g_pChitin->pCreateChar->Kit_Class_Race.nCols && index < g_pChitin->pCreateChar->Kit_Class_Race.nRows && col >= 0 && index >= 0) { sKit = *((g_pChitin->pCreateChar->Kit_Class_Race.pDataArray) + (g_pChitin->pCreateChar->Kit_Class_Race.nCols * index + col)); } else { sKit = g_pChitin->pCreateChar->Kit_Class_Race.defaultVal; } sscanf_s((LPCTSTR)sKit, "%d", &nKitId); col = 0; if (col < g_pChitin->pGame->KITLIST.nCols && nKitId < g_pChitin->pGame->KITLIST.nRows && col >= 0 && nKitId >= 0) { sRowName = *((g_pChitin->pGame->KITLIST.pDataArray) + (g_pChitin->pGame->KITLIST.nCols * nKitId + col)); } else { sRowName = g_pChitin->pGame->KITLIST.defaultVal; } IECString sKitAllowedByAlignment = pGame->ALIGNMNT.GetValue(sAlignment, sRowName); sscanf_s((LPCTSTR)sKitAllowedByAlignment, "%d", &bKitAllowedByAlignment); bAlignmentChecked = TRUE; } if (index < Kit_Class_Race.nRows) { pButton->SetEnabled(TRUE); if (bAlignmentChecked && nKitId) { //not true class if (bAlignmentChecked && bKitAllowedByAlignment) { pButton->SetActive(TRUE); } else { pButton->SetActive(FALSE); } } else { pButton->SetActive(TRUE); } } else { pButton->SetEnabled(FALSE); pButton->SetActive(FALSE); pButton->SetVisible(FALSE); } index -= scrollKit.nCurrentValue; } //for (index) unsigned int dwKit = cre.m_header.m_wKit[1] | (cre.m_header.m_wKit[0] << 16); option1.SetToggleState(false); option2.SetToggleState(false); option3.SetToggleState(false); option4.SetToggleState(false); option5.SetToggleState(false); option6.SetToggleState(false); option7.SetToggleState(false); option8.SetToggleState(false); option9.SetToggleState(false); option10.SetToggleState(false); option11.SetToggleState(false); if ((dwKit & KIT_TRUECLASS) && (dwKit & 0xBFFF)) { //has a kit unsigned int dwKitOnly = dwKit & 0xBFFF; for (int row = 0; row < Kit_Class_Race.nRows; row++ ) { int col = 0; IECString sKit; if (col < g_pChitin->pCreateChar->Kit_Class_Race.nCols && row < g_pChitin->pCreateChar->Kit_Class_Race.nRows && col >= 0 && row >= 0) { sKit = *((g_pChitin->pCreateChar->Kit_Class_Race.pDataArray) + (g_pChitin->pCreateChar->Kit_Class_Race.nCols * row + col)); } else { sKit = g_pChitin->pCreateChar->Kit_Class_Race.defaultVal; } unsigned int nKitId; sscanf_s((LPCTSTR)sKit, "%d", &nKitId); if (nKitId == dwKitOnly) { switch (row - scrollKit.nCurrentValue) { case 0: option1.SetToggleState(TRUE); break; case 1: option2.SetToggleState(TRUE); break; case 2: option3.SetToggleState(TRUE); break; case 3: option4.SetToggleState(TRUE); break; case 4: option5.SetToggleState(TRUE); break; case 5: option6.SetToggleState(TRUE); break; case 6: option7.SetToggleState(TRUE); break; case 7: option8.SetToggleState(TRUE); break; case 8: option9.SetToggleState(TRUE); break; case 9: option10.SetToggleState(TRUE); break; case 10: option11.SetToggleState(TRUE); break; } } } //for } else { switch (dwKit) { case KIT_TRUECLASS: switch (scrollKit.nCurrentValue) { case 0: option1.SetToggleState(TRUE); break; default: break; } break; case KIT_BERSERKER: case KIT_CAVALIER: case KIT_FERALAN: case KIT_ASSASIN: case KIT_BLADE: case KIT_GODTALOS: case KIT_TOTEMIC: switch (scrollKit.nCurrentValue) { case 0: option2.SetToggleState(TRUE); break; case 1: option1.SetToggleState(TRUE); break; default: break; } break; case KIT_WIZARDSLAYER: case KIT_INQUISITOR: case KIT_STALKER: case KIT_BOUNTYHUNTER: case KIT_JESTER: case KIT_GODHELM: case KIT_SHAPESHIFTER: switch (scrollKit.nCurrentValue) { case 0: option1.SetToggleState(TRUE); break; case 1: option2.SetToggleState(TRUE); break; case 2: option3.SetToggleState(TRUE); break; default: break; } break; case KIT_KENSAI: case KIT_UNDEADHUNTER: case KIT_BEASTMASTER: case KIT_SWASHBUCKLER: case KIT_SKALD: case KIT_GODLATHANDER: case KIT_BEASTFRIEND: switch (scrollKit.nCurrentValue) { case 0: option1.SetToggleState(TRUE); break; case 1: option2.SetToggleState(TRUE); break; case 2: option3.SetToggleState(TRUE); break; case 3: option4.SetToggleState(TRUE); break; default: break; } break; default: break; } } //has a kit CUIButton& buttonDone = (CUIButton&)panel.GetUIControl(7); buttonDone.SetActive(CanContinue(cre)); scrollKit.nValues = Kit_Class_Race.nRows; scrollKit.nRows = 11; if (Kit_Class_Race.nRows > 11) { scrollKit.SetEnabled(TRUE); scrollKit.SetVisible(TRUE); } else { scrollKit.SetEnabled(FALSE); scrollKit.SetVisible(FALSE); } if (pGameOptionsEx->GetOption("Debug_Verbose")) { LPCTSTR lpsz = "DETOUR_CScreenCharGen::DETOUR_KitPanelOnUpdate(): nKits(%d), nScrollValues(%d), wKit(0x%X)\r\n"; console.writef(lpsz, Kit_Class_Race.nRows, max(scrollKit.nValues - scrollKit.nRows, 0), dwKit); L.timestamp(); L.appendf(lpsz, Kit_Class_Race.nRows, scrollKit.nValues, dwKit); } return; };