Esempio n. 1
0
void
AddEffectInfoDialog::OnInitDialog(wxInitDialogEvent &e)
{
	wxDialog::OnInitDialog(e);

	wxSizer* sizer = new wxBoxSizer( wxVERTICAL );

	wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );

	wxComboBox *item2 = new wxComboBox( this, feID_COMBOCTRL_EFFECT, wxT(""), wxDefaultPosition, wxSize(200,-1), 0, NULL, wxCB_DROPDOWN );
	item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );

	wxComboBox *item3 = new wxComboBox( this, feID_COMBOCTRL_LOCATOR, wxT(""), wxDefaultPosition, wxSize(200,-1), 0, NULL, wxCB_DROPDOWN );
	item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );

	sizer->Add( item1, 0, wxALIGN_CENTER|wxALL, 10 );

	wxFlexGridSizer *item5 = new wxFlexGridSizer( 2, 0, 0 );

	wxButton *item6 = new wxButton( this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	item6->SetDefault();
	item5->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );

	wxButton *item7 = new wxButton( this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	item5->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );

	sizer->Add( item5, 0, wxALIGN_CENTER|wxALL, 10 );

	this->SetSizer( sizer );
	sizer->SetSizeHints( this );

	Fairy::EffectManager::EffectTemplateIterator it = 
		Fairy::EffectManager::getSingleton().getEffectTemplateIterator();

	while ( it.hasMoreElements() )
	{
		item2->AppendString(it.peekNextKey().c_str());

		it.moveNext();
	}

	item2->SetSelection(0);

	SkillObjectEditor* pEditor= static_cast<SkillObjectEditor*>(this->GetParent());
	if(!pEditor)
		return;
	Fairy::LogicModel *pMbject  = pEditor->GetParentFrame()->GetActorSettingEditor()->GetActorObject();
	assert (pMbject);

	Ogre::StringVector boneNameList;
	for ( unsigned short i=0; i<pMbject->getNumBones(); ++i )
	{
		boneNameList.push_back(pMbject->getBoneName(i));
	}

	Ogre::StringVector locatorNames;
	pMbject->getLocatorNames(locatorNames);

	for ( size_t i=0; i<locatorNames.size(); ++i )
	{
		Fairy::LogicModel::LocatorValue value;
		if(pMbject->getLocatorInfo(locatorNames[i], value))
		{
			if(value.mBoneName != "" )
			{
				for ( int index=0; index<(int)boneNameList.size(); ++index )
				{
					if (boneNameList[index] == value.mBoneName)
					{
						// info of the locator is valid
						item3->Append(locatorNames[i].c_str());
						break;
					}
				}						
			}
		}
	}

	item3->SetSelection(0);
}
Esempio n. 2
0
void
WeaponSelectorDialog::OnInitDialog(wxInitDialogEvent &e)
{
    wxDialog::OnInitDialog(e);
    wxSizer* sizer = WeaponSelector(this, true, true);

    if (false == mInitDialog)
    {
        // 读取武器表
        mWeaponData = new FairyConfig("../EditorConfigFiles/Weapon.cfg");

        // 根据武器表建立武器树
        mWeaponTree = wxDynamicCast(this->FindWindow(ID_TREECTRL_WEAPON), wxTreeCtrl);

        mWeaponTree->Freeze();
        mWeaponTree->DeleteAllItems();

        wxTreeItemId rootId = mWeaponTree->AddRoot(_("Weapons"));

        if (mWeaponData)
        {
            // 配置weapon tree
            int sectionCount = mWeaponData->startGetSections();

            for (int i=0; i<sectionCount; ++i)
            {
                const Ogre::String& sectionName = mWeaponData->getNextSection();

                wxTreeItemId sectionId = mWeaponTree->AppendItem(rootId, sectionName.c_str());

                std::vector<Ogre::String> valueList = 
                    mWeaponData->getList(sectionName, "Combo", ",");

                for (size_t j=0; j<valueList.size(); ++j)
                {
                    mWeaponTree->AppendItem(sectionId, valueList[j].c_str());
                }
            }

            mWeaponTree->Thaw();
            mWeaponTree->UnselectAll();
            mWeaponTree->Expand( mWeaponTree->GetRootItem() );
        }

        // 显示特效列表
        mWeaponEffectList = wxDynamicCast(this->FindWindow(ID_LISTBOX_WEAPON_EFFECT), wxListBox);

        Fairy::EffectManager::EffectTemplateIterator it = 
            Fairy::EffectManager::getSingleton().getEffectTemplateIterator();

        while ( it.hasMoreElements() )
        {
            mWeaponEffectList->AppendString(it.peekNextKey().c_str());

            it.moveNext();
        }

        mColourButton = wxDynamicCast(this->FindWindow(ID_BUTTON_WEAPON_EFFECT_COLOUR), wxButton);

        mColourText = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_COLOUR_TEXT), wxTextCtrl);
        mAlphaTextCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_ALPHA), wxTextCtrl);

        mInitDialog = true;
    }

  //  mWeaponEffectList->Refresh();

    unsigned char r, g, b;

    FColourToIColour(mCurrentColour.r, mCurrentColour.g, mCurrentColour.b,
        r, g, b);

    mColourButton->SetBackgroundColour(wxColour(r,g,b));
    setColourText();

    setAlphaText();
}