void CUISkinSelectorWnd::SendMessage(CUIWindow *pWnd, s16 msg, void *pData) { game_cl_mp *game = NULL; //game_cl_Deathmatch * dm = NULL; switch (msg){ case BUTTON_CLICKED: game = smart_cast<game_cl_mp*>(&(Game())); //dm = smart_cast<game_cl_Deathmatch *>(&(Game())); /* if (pWnd == m_pButtons[0]) OnKeyLeft(); else if (pWnd == m_pButtons[1]) OnKeyRight(); else */if (pWnd == m_pBtnAutoSelect) { m_iActiveIndex = -1; OnBtnOK(); } else if (pWnd == m_pBtnSpectator) { HideDialog(); game->OnSpectatorSelect(); } else if (pWnd == m_pBtnBack) { HideDialog(); game->OnSkinMenuBack(); } else for (int i = 0; i<6; i++) if (pWnd == m_pImage[i]) { m_iActiveIndex = m_firstSkin+i; OnBtnOK(); } break; case WINDOW_FOCUS_RECEIVED: /* if (pWnd == m_pButtons[0]) { m_pAnims[0]->Rewind(0); m_pAnims[0]->Play(); } else if (pWnd == m_pButtons[1]) { m_pAnims[1]->Rewind(0); m_pAnims[1]->Play(); } */ break; } }
void CUISkinSelectorWnd::SendMessage(CUIWindow *pWnd, s16 msg, void *pData) { game_cl_Deathmatch * dm = NULL; switch (msg){ case BUTTON_CLICKED: dm = smart_cast<game_cl_Deathmatch *>(&(Game())); if (pWnd == m_pButtons[0]) OnKeyLeft(); else if (pWnd == m_pButtons[1]) OnKeyRight(); else if (pWnd == m_pBtnAutoSelect) { m_iActiveIndex = -1; OnBtnOK(); } else if (pWnd == m_pBtnSpectator) { Game().StartStopMenu(this,true); dm->OnSpectatorSelect(); } else if (pWnd == m_pBtnBack) { Game().StartStopMenu(this,true); dm->OnSkinMenuBack(); } else for (int i = 0; i<4; i++) if (pWnd == m_pImage[i]) { m_iActiveIndex = m_firstSkin+i; OnBtnOK(); } break; case STATIC_FOCUS_RECEIVED: if (pWnd == m_pButtons[0]) { m_pAnims[0]->Rewind(0); m_pAnims[0]->Play(); } else if (pWnd == m_pButtons[1]) { m_pAnims[1]->Rewind(0); m_pAnims[1]->Play(); } break; } }
bool CUISkinSelectorWnd::OnKeyboard(int dik, EUIMessages keyboard_action) { if (WINDOW_KEY_PRESSED != keyboard_action) { if (dik == DIK_TAB) { ShowChildren(true); game_cl_mp* game = smart_cast<game_cl_mp*>(&Game()); game->OnKeyboardRelease(kSCORES); UI()->GetUICursor()->Show(); } return false; } if (dik == DIK_TAB) { ShowChildren(false); game_cl_mp* game = smart_cast<game_cl_mp*>(&Game()); game->OnKeyboardPress(kSCORES); UI()->GetUICursor()->Hide(); return false; } int right_border = (int)m_skins.size(); if (right_border > 9) right_border = 9; if (dik >= DIK_1 && dik < (int)right_border + DIK_1) { int NewIndex = dik - DIK_1; // Msg("Selected %d", NewIndex); // for (u32 i=0; i<m_skinsEnabled.size(); i++) // Msg("Enabled - %d", m_skinsEnabled[i]); xr_vector<int>::iterator It = std::find(m_skinsEnabled.begin(), m_skinsEnabled.end(), NewIndex); if (It != m_skinsEnabled.end()) { m_iActiveIndex = NewIndex; OnBtnOK(); } return true; } // game_cl_Deathmatch * dm = smart_cast<game_cl_Deathmatch *>(&(Game())); switch (dik){ case DIK_ESCAPE: // Game().StartStopMenu(this,true); // dm->OnSkinMenuBack(); OnBtnCancel(); return true; case DIK_SPACE: // do autoselect m_iActiveIndex = -1; case DIK_RETURN: OnBtnOK(); return true; case DIK_LEFT: OnKeyLeft(); return true; case DIK_RIGHT: OnKeyRight(); return true; } return false; }