mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-09 05:48:49 +00:00
format XUI
This commit is contained in:
@@ -8,83 +8,77 @@
|
||||
#include "XUI_Ctrl_EnchantButton.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData,
|
||||
BOOL& rfHandled) {
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
|
||||
m_fScreenWidth=(float)pMinecraft->width_phys;
|
||||
m_fRawWidth=(float)ssc.rawWidth;
|
||||
m_fScreenHeight=(float)pMinecraft->height_phys;
|
||||
m_fRawHeight=(float)ssc.rawHeight;
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
|
||||
pMinecraft->height_phys);
|
||||
m_fScreenWidth = (float)pMinecraft->width_phys;
|
||||
m_fRawWidth = (float)ssc.rawWidth;
|
||||
m_fScreenHeight = (float)pMinecraft->height_phys;
|
||||
m_fRawHeight = (float)ssc.rawHeight;
|
||||
|
||||
HXUIOBJ parent = m_hObj;
|
||||
HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiSceneEnchant" );
|
||||
HXUICLASS currentClass;
|
||||
HXUIOBJ parent = m_hObj;
|
||||
HXUICLASS hcInventoryClass = XuiFindClass(L"CXuiSceneEnchant");
|
||||
HXUICLASS currentClass;
|
||||
|
||||
do
|
||||
{
|
||||
XuiElementGetParent(parent,&parent);
|
||||
currentClass = XuiGetObjectClass( parent );
|
||||
} while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
|
||||
do {
|
||||
XuiElementGetParent(parent, &parent);
|
||||
currentClass = XuiGetObjectClass(parent);
|
||||
} while (parent != NULL &&
|
||||
!XuiClassDerivesFrom(currentClass, hcInventoryClass));
|
||||
|
||||
assert( parent != NULL );
|
||||
assert(parent != NULL);
|
||||
|
||||
void *pObj;
|
||||
XuiObjectFromHandle( parent, &pObj );
|
||||
m_containerScene = (CXuiSceneEnchant *)pObj;
|
||||
void* pObj;
|
||||
XuiObjectFromHandle(parent, &pObj);
|
||||
m_containerScene = (CXuiSceneEnchant*)pObj;
|
||||
|
||||
m_index = 0;
|
||||
m_lastCost = 0;
|
||||
m_iPad = 0;
|
||||
m_costString = L"";
|
||||
m_index = 0;
|
||||
m_lastCost = 0;
|
||||
m_iPad = 0;
|
||||
m_costString = L"";
|
||||
|
||||
return hr;
|
||||
return hr;
|
||||
}
|
||||
|
||||
void CXuiCtrlEnchantmentButton::SetData(int iPad, int index)
|
||||
{
|
||||
m_iPad = iPad;
|
||||
m_index = index;
|
||||
void CXuiCtrlEnchantmentButton::SetData(int iPad, int index) {
|
||||
m_iPad = iPad;
|
||||
m_index = index;
|
||||
}
|
||||
|
||||
HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData, BOOL& bHandled)
|
||||
{
|
||||
EnchantmentMenu *menu = m_containerScene->getMenu();
|
||||
HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(
|
||||
XUIMessageGetSourceText* pGetSourceTextData, BOOL& bHandled) {
|
||||
EnchantmentMenu* menu = m_containerScene->getMenu();
|
||||
|
||||
int cost = menu->costs[m_index];
|
||||
int cost = menu->costs[m_index];
|
||||
|
||||
if(cost != m_lastCost)
|
||||
{
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
if(cost > pMinecraft->localplayers[m_iPad]->experienceLevel && !pMinecraft->localplayers[m_iPad]->abilities.instabuild)
|
||||
{
|
||||
// Dark background
|
||||
SetEnable(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Light background and focus background
|
||||
SetEnable(TRUE);
|
||||
}
|
||||
m_costString = _toString<int>(cost);
|
||||
m_lastCost = cost;
|
||||
}
|
||||
if(cost == 0)
|
||||
{
|
||||
// Dark background
|
||||
SetEnable(FALSE);
|
||||
pGetSourceTextData->bDisplay = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pGetSourceTextData->szText = m_costString.c_str();
|
||||
pGetSourceTextData->bDisplay = TRUE;
|
||||
}
|
||||
if (cost != m_lastCost) {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (cost > pMinecraft->localplayers[m_iPad]->experienceLevel &&
|
||||
!pMinecraft->localplayers[m_iPad]->abilities.instabuild) {
|
||||
// Dark background
|
||||
SetEnable(FALSE);
|
||||
} else {
|
||||
// Light background and focus background
|
||||
SetEnable(TRUE);
|
||||
}
|
||||
m_costString = _toString<int>(cost);
|
||||
m_lastCost = cost;
|
||||
}
|
||||
if (cost == 0) {
|
||||
// Dark background
|
||||
SetEnable(FALSE);
|
||||
pGetSourceTextData->bDisplay = FALSE;
|
||||
} else {
|
||||
pGetSourceTextData->szText = m_costString.c_str();
|
||||
pGetSourceTextData->bDisplay = TRUE;
|
||||
}
|
||||
|
||||
bHandled = TRUE;
|
||||
bHandled = TRUE;
|
||||
|
||||
return S_OK;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user