2 #include "mof/KeyFrameAnimation.h"
4 #include "TargetMenu.h"
5 #include "BattlerGroup.h"
6 #include "BattlerFacade.h"
9 mof::Window* et::IdealMenu::addSelectableTextItem(mof::Window* pOwner, std::vector<mof::Window*>& selectables , TCHAR* text , int size){
10 mof::Window* pSelectable = new et::MyWindow(mof::Sprite::createSpriteFromText(text , size) , m_pTextureManager);
11 pOwner->add(pSelectable);
12 selectables.push_back(pSelectable);
16 et::IdealMenu::IdealMenu( mof::TextureManager* pTextureManager , et::BattleData* pBattleData )
17 : et::MyFrame(mof::Line2D( 0 , 0 , 200 , 300) , true , pTextureManager->getResource(_T("image/frame0.png")) )
19 m_pBattleData = pBattleData;
22 m_pTextureManager = pTextureManager;
23 std::vector<mof::Window*> selectables;
25 mof::Window* pSelectable = NULL;
26 //
\90_
\97ì
\82Ì
\83\8a\83X
\83g
\8dì
\90¬
27 for(std::vector<et::BattlerFacade*>::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ;
28 itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){
29 if((*itr)->getType() != et::IDEAL || !(*itr)->getParameter().alive)continue;
30 pSelectable = addSelectableTextItem(this , selectables , (TCHAR*)(*itr)->getParameter().name.c_str() , 16);
31 if((*itr)->getParameter().actionPoint < 5)pSelectable->setAvailable(false);
34 m_pSelector = new mof::SelectionModel(selectables , mof::AnimationResource());
38 et::IdealMenu::~IdealMenu(void)
47 void et::IdealMenu::setVisible(bool visible){
48 et::MyFrame::setVisible(visible);
50 mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
51 pAnimation->setPosition(0 , mof::Vector2D(160 ,500));
52 pAnimation->setPosition(10 , mof::Vector2D(160 , 370));
53 mof::AnimationResource resource(pAnimation);
54 m_pSelector->setMenuAnimation(resource);
55 setAnimation(0 , resource);
58 mof::KeyFrameAnimation* pAnimation = new mof::KeyFrameAnimation();
59 pAnimation->setPosition(0 , mof::Vector2D(160 , 370));
60 pAnimation->setPosition(10 , mof::Vector2D(160 , 500));
61 mof::AnimationResource resource(pAnimation);
62 m_pSelector->setMenuAnimation(resource);
63 setAnimation(0 , resource);
67 et::MyFrame* et::IdealMenu::performAction(){
68 int index = getSelectionModel()->getSelectingIndex();
69 et::BattleAction action;
70 action.type = et::BattleAction::CAST;
72 for(std::vector<et::BattlerFacade*>::const_iterator itr = m_pBattleData->getBattlerGroup()->getBattlerList().begin() ;
73 itr != m_pBattleData->getBattlerGroup()->getBattlerList().end() ; ++itr){
74 if((*itr)->getType() != et::IDEAL || !(*itr)->getParameter().alive)continue;
75 else if(index == cntIdeal++)action.idealIndex = index;
78 if(action.idealIndex == 0)return new et::TargetMenu(m_pTextureManager , m_pBattleData , action , 300);//
\92P
\91Ì
79 else if(action.idealIndex == 1){
80 action.pTarget = NULL;
81 m_pBattleData->setBattleAction(action);
84 else if(action.idealIndex == 2){
85 action.pTarget = m_pBattleData->getBattlerGroup()->getHeroBattler();
86 m_pBattleData->setBattleAction(action);