#include "stdafx.h" #include "UI.h" #include "UIScene_CreateBattleMenu.h" UIScene_CreateBattleMenu::UIScene_CreateBattleMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { // Load the SWF and set up all mapped elements initialiseMovie(); // Initialize controls with labels and IDs m_buttonOk.init(NULL, 0); m_buttonCancel.init(NULL, 1); m_checkOption.init(L"Central Spawn", 2, false); m_checkPoint.init(L"Online Game", 3, false); m_mariotomato.init(L"Public Game", 4, false); m_sliderValue.init(L"Difficulty", 5, 0, 100, 50); m_labelTitle.init(L"My Custom Menu"); m_labelStatus.init(L"Ready"); } wstring UIScene_CreateBattleMenu::getMoviePath() { // Return the base SWF name (resolution suffix added automatically) return L"UIScene_CreateBattleGame"; } void UIScene_CreateBattleMenu::handleReload() { // Re-initialize controls after a skin reload m_buttonOk.init(NULL, 0); m_buttonCancel.init(NULL, 1); m_checkOption.init(L"Central Spawn", 2, false); m_checkPoint.init(L"Online Game", 3, false); m_mariotomato.init(L"Public Game", 4, false); m_sliderValue.init(L"Amount", 5, 0, 100, 50); m_labelTitle.init(L"My Custom Menu"); m_labelStatus.init(L"Ready"); } void UIScene_CreateBattleMenu::handleGainFocus(bool navBack) { UIScene::handleGainFocus(navBack); // Update state when we gain focus } void UIScene_CreateBattleMenu::updateTooltips() { ui.SetTooltips(m_iPad, eToolTipExit); } void UIScene_CreateBattleMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { if (!pressed) return; switch (key) { case ACTION_MENU_B: // B button: go back navigateBack(); handled = true; break; default: // Let the SWF handle other input (focus navigation, button presses) sendInputToMovie(key, repeat, pressed, released); handled = true; break; } } void UIScene_CreateBattleMenu::handlePress(F64 controlId, F64 childId) { int id = (int)controlId; switch (id) { case 0: // OK button // Do your thing m_labelStatus.setLabel(L"OK pressed!"); ui.PlayUISFX(eSFX_Focus); navigateBack(); break; case 1: // Cancel button navigateBack(); break; } } void UIScene_CreateBattleMenu::handleCheckboxToggled(F64 controlId, bool selected) { int id = (int)controlId; if (id == 2) { // Feature checkbox was toggled if (selected) m_labelStatus.setLabel(L"Feature enabled"); else m_labelStatus.setLabel(L"Feature disabled"); } } void UIScene_CreateBattleMenu::handleSliderMove(F64 sliderId, F64 currentValue) { int id = (int)sliderId; if (id == 3) { int value = (int)currentValue; m_labelStatus.setLabel(L"Value: " + to_wstring(value)); } }