UIMinimapForm.cpp "bool CMiniMapMgr::Init()"
Before the last "return true; }" u have to add this
// ================= INFO SYSTEM =================
if (InfoFrm = _FindForm("InfoFrm"); !InfoFrm)
return Error(g_oLangRec.GetString(45), "InfoFrm", "InfoFrm");
if (InfoTitle = dynamic_cast<CLabelEx*>(InfoFrm->Find("InfoTitle")); !InfoTitle)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "InfoTitle");
if (InfoDescription = dynamic_cast<CMemo*>(InfoFrm->Find("InfoDescription")); !InfoDescription)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "InfoDescription");
if (InfoMainImage = dynamic_cast<CImage*>(InfoFrm->Find("InfoMainImage")); !InfoMainImage)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "InfoMainImage");
if (btnInfoNext = dynamic_cast<CTextButton*>(InfoFrm->Find("btnInfoNext")); !btnInfoNext)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "btnInfoNext");
if (btnInfoPrev = dynamic_cast<CTextButton*>(InfoFrm->Find("btnInfoPrev")); !btnInfoPrev)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "btnInfoPrev");
if (InfoCategoryTitle = dynamic_cast<CLabelEx*>(InfoFrm->Find("InfoCategoryTitle")); !InfoCategoryTitle)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "InfoCategoryTitle");
if (btnCategoryNext = dynamic_cast<CTextButton*>(InfoFrm->Find("btnCategoryNext")); !btnCategoryNext)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "btnCategoryNext");
if (btnCategoryPrev = dynamic_cast<CTextButton*>(InfoFrm->Find("btnCategoryPrev")); !btnCategoryPrev)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "btnCategoryPrev");
if (InfoPageCounter = dynamic_cast<CLabelEx*>(InfoFrm->Find("InfoPageCounter")); !InfoPageCounter)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "InfoPageCounter");
if (InfoCategoryCounter = dynamic_cast<CLabelEx*>(InfoFrm->Find("InfoCategoryCounter")); !InfoCategoryCounter)
return Error(g_oLangRec.GetString(45), InfoFrm->GetName(), "InfoCategoryCounter");
btnCategoryNext->evtMouseClick = _evtNextCategory;
btnCategoryPrev->evtMouseClick = _evtPrevCategory;
btnInfoNext->evtMouseClick = _evtNextInfoPage;
btnInfoPrev->evtMouseClick = _evtPrevInfoPage;
LoadInfoData();
// ================= INFO SYSTEM =================
Add this into UIMinimapForm.cpp (wherever u want)
// ================= INFO SYSTEM =================
void CMiniMapMgr::LoadInfoData()
{
m_infoCategories.clear();
InfoCategory gems;
gems.name = "Blacksmith Guide";
gems.imagePrefix = "Combining_gems";
gems.pages.push_back({
"Combining Gems",
"You can combine gems at the blacksmith.Higher level gems reduce success chance.You can combine gems at the blacksmith.Higher level gems reduce success chance.You can combine gems at the blacksmith.Higher level gems reduce success chance.You can combine gems at the blacksmith.Higher level gems reduce success chance.You can combine gems at the blacksmith.Higher level gems reduce success chance."
});
gems.pages.push_back({
"Gem Success Rate",
"Use lucky charms to increase success rate."
});
m_infoCategories.push_back(gems);
InfoCategory FarmZones;
FarmZones.name = "Farm Zones";
FarmZones.imagePrefix = "FarmMaps";
FarmZones.pages.push_back({
"Demonic World",
"You Can Farm Kals, Money and Gems!."
});
m_infoCategories.push_back(FarmZones);
InfoCategory buffs;
buffs.name = "Buffs & Debuffs";
buffs.imagePrefix = "buffs";
buffs.pages.push_back({
"Buff System",
"Buffs increase stats temporarily."
});
m_infoCategories.push_back(buffs);
}
void CMiniMapMgr::UpdateInfoPage()
{
if (m_infoCategories.empty())
return;
auto& category = m_infoCategories[m_currentCategory];
auto& page = category.pages[m_currentPage];
InfoCategoryTitle->SetCaption(category.name.c_str());
InfoTitle->SetCaption(page.title.c_str());
InfoDescription->SetCaption(page.description.c_str());
InfoDescription->ProcessCaption();
InfoDescription->Refresh();
char buffer[64];
sprintf(buffer, "Page %d / %d",
m_currentPage + 1,
(int)category.pages.size());
InfoPageCounter->SetCaption(buffer);
sprintf(buffer, "Category %d / %d",
m_currentCategory + 1,
(int)m_infoCategories.size());
InfoCategoryCounter->SetCaption(buffer);
char path[256];
sprintf(path,
"texture/ui/new/DailyBuff/%s_%d.png",
//Here you can change the images folder
category.imagePrefix.c_str(),
m_currentPage + 1);
if (auto img = InfoMainImage->GetImage(); img)
{
img->UnLoadImage();
img->LoadImage(path,
img->GetWidth(),
img->GetHeight(),
0, 0, 0, 1.0f, 1.0f);
}
}
void CMiniMapMgr::NextPage()
{
auto& category = m_infoCategories[m_currentCategory];
if (m_currentPage < (int)category.pages.size() - 1)
{
m_currentPage++;
UpdateInfoPage();
}
}
void CMiniMapMgr:: PrevPage()
{
if (m_currentPage > 0)
{
m_currentPage--;
UpdateInfoPage();
}
}
void CMiniMapMgr::NextCategory()
{
if (m_currentCategory < (int)m_infoCategories.size() - 1)
{
m_currentCategory++;
}
else
{
m_currentCategory = 0; // loop
}
m_currentPage = 0;
UpdateInfoPage();
}
void CMiniMapMgr:: PrevCategory()
{
if (m_currentCategory > 0)
{
m_currentCategory--;
}
else
{
m_currentCategory = (int)m_infoCategories.size() - 1; // loop
}
m_currentPage = 0;
UpdateInfoPage();
}
void CMiniMapMgr::_evtNextCategory(CGuiData*, int, int, DWORD)
{
g_stUIMap.NextCategory();
}
void CMiniMapMgr::_evtPrevCategory(CGuiData*, int, int, DWORD)
{
g_stUIMap.PrevCategory();
}
void CMiniMapMgr::_evtNextInfoPage(CGuiData*, int, int, DWORD)
{
g_stUIMap.NextPage();
}
void CMiniMapMgr::_evtPrevInfoPage(CGuiData*, int, int, DWORD)
{
g_stUIMap.PrevPage();
}
// ================= INFO SYSTEM =================
At "void CMiniMapMgr::_MiniFormMouseEvent" add this before the last return
else if (name == "btnInfoZkaRu")
{
if (g_stUIMap.InfoFrm->GetIsShow())
{
g_stUIMap.InfoFrm->Hide();
}
else
{
g_stUIMap.m_currentCategory = 0;
g_stUIMap.m_currentPage = 0;
g_stUIMap.UpdateInfoPage();
g_stUIMap.InfoFrm->Show();
}
}
UIMinimapForm.h, add this at class CMiniMapMgr
// ================= INFO SYSTEM =================
struct InfoPage
{
std::string title;
std::string description;
};
struct InfoCategory
{
std::string name;
std::string imagePrefix;
std::vector<InfoPage> pages;
};
std::vector<InfoCategory> m_infoCategories;
int m_currentCategory = 0;
int m_currentPage = 0;
CForm* InfoFrm = nullptr;
CImage* InfoMainImage = nullptr;
CLabelEx* InfoTitle = nullptr;
CMemo* InfoDescription;
CTextButton* btnInfoNext = nullptr;
CTextButton* btnInfoPrev = nullptr;
CLabelEx* InfoCategoryTitle = nullptr;
CTextButton* btnCategoryNext = nullptr;
CTextButton* btnCategoryPrev = nullptr;
CLabelEx* InfoPageCounter = nullptr;
CLabelEx* InfoCategoryCounter = nullptr;
void LoadInfoData();
void UpdateInfoPage();
void NextPage();
void PrevPage();
void NextCategory();
void PrevCategory();
static void _evtNextInfoPage(CGuiData*, int, int, DWORD);
static void _evtPrevInfoPage(CGuiData*, int, int, DWORD);
static void _evtNextCategory(CGuiData*, int, int, DWORD);
static void _evtPrevCategory(CGuiData*, int, int, DWORD);
// ================= INFO SYSTEM =================
-- ================= INFO SYSTEM =================
btnInfoZkaRu = UI_CreateCompent( frmMinimap, BUTTON_TYPE, "btnInfoZkaRu", 41, 19, 87, 158+90 )
UI_LoadButtonImage( btnInfoZkaRu, "texture/ui/storenewbutton.tga", 41, 19, 0, 0, TRUE )
UI_SetHint( btnInfoZkaRu, "Open Info System" )
InfoFrm = UI_CreateForm( "InfoFrm", FALSE, 591, 467, 100, 100, TRUE, FALSE )
UI_ShowForm( InfoFrm, FALSE )
UI_AddFormToTemplete( InfoFrm, FORM_MAIN )
UI_FormSetIsEscClose( InfoFrm, TRUE )
UI_SetIsDrag( InfoFrm, TRUE )
InfoBK = UI_CreateCompent( InfoFrm, IMAGE_TYPE, "InfoBK", 591, 467, 0, 0 )
UI_LoadImage( InfoBK, "texture/ui/new/DailyBuff/dailybuff.png", NORMAL, 591, 467, 0, 0 )
btnClose = UI_CreateCompent( InfoFrm, BUTTON_TYPE, "btnClose", 14, 14, 582, 4 )
UI_LoadButtonImage( btnClose, "texture/ui/PublicC.tga", 14, 14, 116, 175, TRUE )
UI_SetButtonModalResult( btnClose, BUTTON_CLOSE )
InfoCategoryCounter = UI_CreateCompent( InfoFrm, LABELEX_TYPE, "InfoCategoryCounter", 400, 25, 253, 18 )
UI_SetLabelExFont( InfoCategoryCounter, SIMSUN16, TRUE, COLOR_BLACK )
UI_SetTextColor( InfoCategoryCounter, COLOR_WHITE )
InfoCategoryTitle = UI_CreateCompent( InfoFrm, LABELEX_TYPE, "InfoCategoryTitle", 400, 25, 253, 33 )
UI_SetLabelExFont( InfoCategoryTitle, SIMSUN24, TRUE, COLOR_BLACK )
UI_SetTextColor( InfoCategoryTitle, COLOR_WHITE )
btnCategoryPrev = UI_CreateCompent( InfoFrm, BUTTON_TYPE, "btnCategoryPrev", 20, 20, 197, 20 )
UI_LoadButtonImage( btnCategoryPrev, "texture/ui/new/DailyBuff/dailybuff.png", 20, 20, 625, 172, TRUE )
btnCategoryNext = UI_CreateCompent( InfoFrm, BUTTON_TYPE, "btnCategoryNext", 20, 20, 394, 20 )
UI_LoadButtonImage( btnCategoryNext, "texture/ui/new/DailyBuff/dailybuff.png", 20, 20, 625, 152, TRUE )
InfoPageCounter = UI_CreateCompent( InfoFrm, LABELEX_TYPE, "InfoPageCounter", 400, 25, 253, 414 )
UI_SetLabelExFont( InfoPageCounter, SIMSUN16, TRUE, COLOR_BLACK )
UI_SetTextColor( InfoPageCounter, COLOR_WHITE )
InfoTitle = UI_CreateCompent( InfoFrm, LABELEX_TYPE, "InfoTitle", 400, 25, 253, 432 )
UI_SetLabelExFont( InfoTitle, SIMSUN24, TRUE, COLOR_BLACK )
UI_SetTextColor( InfoTitle, COLOR_WHITE )
btnInfoPrev = UI_CreateCompent( InfoFrm, BUTTON_TYPE, "btnInfoPrev", 20, 20, 197, 420 )
UI_LoadButtonImage( btnInfoPrev, "texture/ui/new/DailyBuff/dailybuff.png", 20, 20, 625, 172, TRUE )
btnInfoNext = UI_CreateCompent( InfoFrm, BUTTON_TYPE, "btnInfoNext", 20, 20, 394, 420 )
UI_LoadButtonImage( btnInfoNext, "texture/ui/new/DailyBuff/dailybuff.png", 20, 20, 625, 152, TRUE )
InfoDescription = UI_CreateCompent( InfoFrm, MEMO_TYPE, "InfoDescription", 140, 300, 38, 77 )
UI_SetCaption( InfoDescription, "" )
UI_SetLabelExFont( InfoDescription, SIMSUN32, TRUE, COLOR_WHITE )
UI_SetTextColor( InfoDescription, COLOR_WHITE )
UI_SetMemoPageShowNum( InfoDescription, 15 )
UI_SetMemoMaxNumPerRow( InfoDescription, 20 )
scrollid = UI_GetScroll( InfoDescription )
UI_SetSize( scrollid, 11, 1 )
UI_LoadImage( scrollid, "texture/ui/PublicC.tga", COMPENT_BACK, 11, 1, 194, 13 )
id = UI_GetScrollObj( scrollid, SCROLL_UP )
UI_LoadButtonImage( id, "texture/ui/PublicC.tga", 11, 9, 166, 0, TRUE )
UI_SetSize( id, 11, 9 )
id = UI_GetScrollObj( scrollid, SCROLL_SCROLL )
UI_LoadImage( id, "texture/ui/PublicC.tga", COMPENT_BACK, 11, 33, 166, 10 )
UI_SetSize( id, 11, 15 )
id = UI_GetScrollObj( scrollid, SCROLL_DOWN )
UI_LoadButtonImage( id, "texture/ui/PublicC.tga", 11, 9, 166, 0, TRUE )
UI_SetSize( id, 11, 9 )
InfoMainImage = UI_CreateCompent( InfoFrm, IMAGE_TYPE, "InfoMainImage", 374, 327, 188, 64 )
UI_LoadImage( InfoMainImage, "texture/ui/new/DailyBuff/Combining_gems.png", NORMAL, 256, 327, 0, 0 )
-- ================= INFO SYSTEM =================
How To Add More Pages / Categories "void CMiniMapMgr::LoadInfoData()"
void CMiniMapMgr::LoadInfoData()
{
m_infoCategories.clear();
...
At the end of the function we have this:
InfoCategory buffs;
buffs.name = "Buffs & Debuffs";
buffs.imagePrefix = "buffs";
buffs.pages.push_back({
"Buff System",
"Buffs increase stats temporarily."
});
m_infoCategories.push_back(buffs);
JUST COPY AND PASTE A NEW CATEGORY, THEN RENAME IT, EXAMPLE:
InfoCategory Resources;-----"buffs" ->"Resources"
Resources.name = "Meteorite"; ------"buffs.name" -> "Resources.name" and "Buffs & Debuffs" -> "Meteorite" this is the category name
buffs.imagePrefix = "resources";---- "buffs.imagePrefix" -> "Resources.imagePrefix" and "buffs" -> "meteorite this is the name for the images (in this case gonna be "resources_1.png" at ur image folder the number gonna depend on the page, if u have 3 pages, u will have "resources_1.png","resources_2.png" and "resources_3.png"
buffs.pages.push_back({ "Buff System", "Buffs increase stats temporarily." });
"buffs.pages.push_back" -> "Resources.pages.push_back"
"Buff System" -> "Meteorite" This is the name page

"Buffs increase stats temporarily." Is the description of the page
m_infoCategories.push_back(buffs); -> m_infoCategories.push_back(Resources);
}
working good, if u have some bug, please reply here, the .clu can be modified by yourself, u can change the ui, i did it the simple way so there wouldnt be any complications, i hope that help u, thanks for ur time, keep ghrowing TOP Community. (Discord: zkaru1995)