예제 #1
0
void BulletTree::AddBulletSystemToTree(Fairy::BulletSystem *pBulletSystem,const Ogre::String &templateName)
{
	int iBulletSystemImage = BulletTree::TreeCtrlIcon_BulletSystem;

	wxTreeItemId rootId = this->GetRootItem();
	if(!rootId.IsOk())
		return;
	wxTreeItemId BulletSystemRootId = AppendItem(rootId,templateName,
		iBulletSystemImage, iBulletSystemImage,
		new BulletTreeItemData(wxT("BulletSystem item"),templateName,pBulletSystem));

	int iAnimEfectImage = BulletTree::TreeCtrlIcon_AnimEffect;
	int iRibbinImage = BulletTree::TreeCtrlIcon_Ribbon;
	int iCameraShakeImage = BulletTree::TreeCtrlIcon_CameraShake;
	int iSoundImage = BulletTree::TreeCtrlIcon_Sound;
	int iSceneLightImage = BulletTree::TreeCtrlIcon_SceneLight;
	int iLineImage = BulletTree::TreeCtrlIcon_Line;
	int iPorpertyImage = BulletTree::TreeCtrlIcon_BulletProperty;


	// ÉèÖÃeffectÊôÐÔ
	for ( unsigned short i=0; i < pBulletSystem->getNumAnimationEffectInfos(); ++i )
	{
		Fairy::AnimationEffectInfo *effectInfo = pBulletSystem->getAnimationEffectInfo(i);
		assert (effectInfo);

		Ogre::String effectIndexStr = "Effect Info " + Ogre::StringConverter::toString(i);
		wxTreeItemId AnimEffectId= AppendItem(BulletSystemRootId,effectIndexStr.c_str(),
			iAnimEfectImage, iAnimEfectImage,
			new BulletTreeItemData(wxT("BulletSystem Element"),wxT("AnimEffect"),effectInfo));

		if ( AnimEffectId.IsOk() )
		{

			const Ogre::ParameterList &paraList = effectInfo->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = effectInfo->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( AnimEffectId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new BulletTreeItemData(wxT("BulletSystem Element item"),name,effectInfo));

			}
		}
	}

	for ( unsigned short i=0; i < pBulletSystem->getNumAnimationRibbons(); ++i )
	{
		Fairy::AnimationRibbon *ribbon = pBulletSystem->getAnimationRibbon(i);

		assert (ribbon);

		Ogre::String ribbonIndexStr = "Ribbon " + Ogre::StringConverter::toString(i);

		wxTreeItemId RibbonId= AppendItem(BulletSystemRootId,ribbonIndexStr.c_str(),
			iRibbinImage, iRibbinImage,
			new BulletTreeItemData(wxT("BulletSystem Element"),wxT("Ribbon"),ribbon));

		if ( RibbonId.IsOk() )
		{

			const Ogre::ParameterList &paraList = ribbon->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = ribbon->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( RibbonId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new BulletTreeItemData(wxT("BulletSystem Element item"),name,ribbon));

			}
		}		
	}
	for ( unsigned short i=0; i < pBulletSystem->getNumAnimationCameraShake(); ++i )
	{
		Fairy::AnimationCameraShake *cameraShake = pBulletSystem->getAnimationCameraShake(i);

		assert (cameraShake);

		Ogre::String soundIndexStr = "CameraShake " + Ogre::StringConverter::toString(i);

		wxTreeItemId CamaerShakeId= AppendItem(BulletSystemRootId,soundIndexStr.c_str(),
			iCameraShakeImage, iCameraShakeImage,
			new BulletTreeItemData(wxT("BulletSystem Element"),wxT("CameraShake"),cameraShake));

		if ( CamaerShakeId.IsOk() )
		{

			const Ogre::ParameterList &paraList = cameraShake->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = cameraShake->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( CamaerShakeId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new BulletTreeItemData(wxT("BulletSystem Element item"),name,cameraShake));

			}
		}	
	}

	for ( unsigned short i=0; i < pBulletSystem->getNumAnimationSounds(); ++i )
	{
		Fairy::AnimationSound *sound = pBulletSystem->getAnimationSound(i);

		assert (sound);

		Ogre::String soundIndexStr = "Sound " + Ogre::StringConverter::toString(i);

		wxTreeItemId SoundId= AppendItem(BulletSystemRootId,soundIndexStr.c_str(),
			iSoundImage, iSoundImage,
			new BulletTreeItemData(wxT("BulletSystem Element"),wxT("Sound"),sound));

		if ( SoundId.IsOk() )
		{

			const Ogre::ParameterList &paraList = sound->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = sound->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( SoundId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new BulletTreeItemData(wxT("BulletSystem Element item"),name,sound));

			}
		}	
	}

	for ( unsigned short i=0; i < pBulletSystem->getNumAnimationSceneLightInfos(); ++i )
	{
		Fairy::AnimationSceneLightInfo *light = pBulletSystem->getAnimationSceneLightInfo(i);

		assert (light);

		Ogre::String lightIndexStr = "SceneLight " + Ogre::StringConverter::toString(i);

		wxTreeItemId LightId= AppendItem(BulletSystemRootId,lightIndexStr.c_str(),
			iSceneLightImage, iSceneLightImage,
			new BulletTreeItemData(wxT("BulletSystem Element"),wxT("SceneLight"),light));

		if ( LightId.IsOk() )
		{

			const Ogre::ParameterList &paraList = light->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = light->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( LightId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new BulletTreeItemData(wxT("BulletSystem Element item"),name,light));

			}
		}		
	}

	for ( unsigned short i=0; i < pBulletSystem->getNumAnimationLines(); ++i )
	{
		Fairy::AnimationLine *line = pBulletSystem->getAnimationLine(i);

		assert (line);

		Ogre::String lineIndexStr = "Line " + Ogre::StringConverter::toString(i);

		wxTreeItemId LineId= AppendItem(BulletSystemRootId,lineIndexStr.c_str(),
			iLineImage, iLineImage,
			new BulletTreeItemData(wxT("BulletSystem Element"),wxT("Line"),line));

		if ( LineId.IsOk() )
		{

			const Ogre::ParameterList &paraList = line->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = line->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( LineId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new BulletTreeItemData(wxT("BulletSystem Element item"),name,line));

			}
		}		
	}

	Expand(BulletSystemRootId);
}
예제 #2
0
void SkillObjectTree::AddSkillToTree(Fairy::Skill *pSkill)
{
	// 更新模板
	Fairy::Skill *skill = Fairy::EffectManager::getSingleton().getSkill(pSkill->getSkillName());
    skill = pSkill;

	int iSkillImage = SkillObjectTree::TreeCtrlIcon_Skill;
	wxTreeItemId SkillRootId = AddRoot(skill->getSkillName(),
		iSkillImage, iSkillImage,
		new SkillTreeItemData(wxT("Skill root item"),skill->getSkillName(),skill));

	int iPorpertyImage = SkillObjectTree::TreeCtrlIcon_SkilltProperty;

	wxTreeItemId BasicSettingId= AppendItem(SkillRootId,wxT("BasicSetting"),
		iPorpertyImage, iPorpertyImage,
		new SkillTreeItemData(wxT("Skill BasicSetting"),wxT("Skill BasicSetting"),pSkill));

	if ( BasicSettingId.IsOk() )
	{
		const Ogre::ParameterList &paraList = pSkill->getParameters();

		for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
		{
			Ogre::String name = paraList[paraCount].name;
			Ogre::String value = pSkill->getParameter(paraList[paraCount].name);

			wxTreeItemId itemId =AppendItem( BasicSettingId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
				new SkillTreeItemData(wxT("Skill property item"),name,skill));
		}
	}

	int iAnimEfectImage = SkillObjectTree::TreeCtrlIcon_AnimEffect;
	int iCameraShakeImage = SkillObjectTree::TreeCtrlIcon_CameraShake;
	int iRibbinImage = SkillObjectTree::TreeCtrlIcon_Ribbon;
	int iSoundImage = SkillObjectTree::TreeCtrlIcon_Sound;
	int iSceneLightImage = SkillObjectTree::TreeCtrlIcon_SceneLight;
	int iBulletFlowImage = SkillObjectTree::TreeCtrlIcon_BulletFlow;


	// 设置effect属性
	for ( unsigned short i=0; i < skill->getNumAnimationEffectInfos(); ++i )
	{
		Fairy::AnimationEffectInfo *effectInfo = skill->getAnimationEffectInfo(i);
		assert (effectInfo);

		Ogre::String effectIndexStr = "Effect Info " + Ogre::StringConverter::toString(i);
		wxTreeItemId AnimEffectId= AppendItem(SkillRootId,effectIndexStr.c_str(),
			iAnimEfectImage, iAnimEfectImage,
			new SkillTreeItemData(wxT("Skill Element"),wxT("AnimEffect"),effectInfo));

		if ( AnimEffectId.IsOk() )
		{

			const Ogre::ParameterList &paraList = effectInfo->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = effectInfo->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( AnimEffectId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new SkillTreeItemData(wxT("Skill Element item"),name,effectInfo));

			}
		}
	}

	for ( unsigned short i=0; i < skill->getNumAnimationCameraShake(); ++i )
	{
		Fairy::AnimationCameraShake *cameraShake = skill->getAnimationCameraShake(i);

		assert (cameraShake);

		Ogre::String cameraShakeIndexStr = "CameraShake " + Ogre::StringConverter::toString(i);

		wxTreeItemId CameraShakeId= AppendItem(SkillRootId,cameraShakeIndexStr.c_str(),
			iCameraShakeImage, iCameraShakeImage,
			new SkillTreeItemData(wxT("Skill Element"),wxT("CameraShake"),cameraShake));

		if ( CameraShakeId.IsOk() )
		{

			const Ogre::ParameterList &paraList = cameraShake->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = cameraShake->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( CameraShakeId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new SkillTreeItemData(wxT("Skill Element item"),name,cameraShake));

			}
		}		
	}

	for ( unsigned short i=0; i < skill->getNumAnimationRibbons(); ++i )
	{
		Fairy::AnimationRibbon *ribbon = skill->getAnimationRibbon(i);

		assert (ribbon);

		Ogre::String ribbonIndexStr = "Ribbon " + Ogre::StringConverter::toString(i);

		wxTreeItemId RibbonId= AppendItem(SkillRootId,ribbonIndexStr.c_str(),
			iRibbinImage, iRibbinImage,
			new SkillTreeItemData(wxT("Skill Element"),wxT("Ribbon"),ribbon));

		if ( RibbonId.IsOk() )
		{

			const Ogre::ParameterList &paraList = ribbon->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = ribbon->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( RibbonId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new SkillTreeItemData(wxT("Skill Element item"),name,ribbon));

			}
		}		
	}

	for ( unsigned short i=0; i < skill->getNumAnimationSounds(); ++i )
	{
		Fairy::AnimationSound *sound = skill->getAnimationSound(i);

		assert (sound);

		Ogre::String soundIndexStr = "Sound " + Ogre::StringConverter::toString(i);

		wxTreeItemId SoundId= AppendItem(SkillRootId,soundIndexStr.c_str(),
			iSoundImage, iSoundImage,
			new SkillTreeItemData(wxT("Skill Element"),wxT("Sound"),sound));

		if ( SoundId.IsOk() )
		{

			const Ogre::ParameterList &paraList = sound->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = sound->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( SoundId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new SkillTreeItemData(wxT("Skill Element item"),name,sound));

			}
		}	
	}

	for ( unsigned short i=0; i < skill->getNumAnimationSceneLightInfos(); ++i )
	{
		Fairy::AnimationSceneLightInfo *light = skill->getAnimationSceneLightInfo(i);

		assert (light);

		Ogre::String lightIndexStr = "SceneLight " + Ogre::StringConverter::toString(i);

		wxTreeItemId LightId= AppendItem(SkillRootId,lightIndexStr.c_str(),
			iSceneLightImage, iSceneLightImage,
			new SkillTreeItemData(wxT("Skill Element"),wxT("SceneLight"),light));

		if ( LightId.IsOk() )
		{

			const Ogre::ParameterList &paraList = light->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = light->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( LightId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new SkillTreeItemData(wxT("Skill Element item"),name,light));

			}
		}		
	}

	for ( unsigned short i=0; i < skill->getNumAnimationBulletFlows(); ++i )
	{
		Fairy::AnimationBulletFlow *bulletFlow = skill->getAnimationBulletFlow(i);

		assert (bulletFlow);

		Ogre::String bulletFlowIndexStr = "BulletFlow " + Ogre::StringConverter::toString(i);

		wxTreeItemId BulletFlowId= AppendItem(SkillRootId,bulletFlowIndexStr.c_str(),
			iBulletFlowImage, iBulletFlowImage,
			new SkillTreeItemData(wxT("Skill Element"),wxT("BulletFlow"),bulletFlow));

		if ( BulletFlowId.IsOk() )
		{

			const Ogre::ParameterList &paraList = bulletFlow->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String name = paraList[paraCount].name;
				Ogre::String value = bulletFlow->getParameter(paraList[paraCount].name);

				wxTreeItemId itemId =AppendItem( BulletFlowId,(name + ":" + value).c_str(),iPorpertyImage,iPorpertyImage,
					new SkillTreeItemData(wxT("Skill Element item"),name,bulletFlow));

			}
		}		
	}

	Expand(SkillRootId);

}
예제 #3
0
void SkillObjectEditor::saveSkill(Fairy::Skill *skill, const Ogre::String &templateName, std::ofstream &of)
{
	assert (skill);

	of << "\n";
	of << "skill " << templateName << "\n";
	of << "{\n";

	const Ogre::ParameterList &paraList = skill->getParameters();

	for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
	{
		of << "\t" << paraList[paraCount].name << " " << skill->getParameter(paraList[paraCount].name) << "\n";
	}

	for (unsigned short i=0; i<skill->getNumAnimationEffectInfos(); ++i)
	{
		of << "\tAnimEffect\n" << "\t{\n";

		Fairy::AnimationEffectInfo *effectInfo = skill->getAnimationEffectInfo(i);
		assert (effectInfo);

		const Ogre::ParameterList &effectInfoList = effectInfo->getParameters();

		for ( size_t paraCount = 0; paraCount < effectInfoList.size(); ++paraCount )
		{
			of << "\t\t" << effectInfoList[paraCount].name.c_str() 
				<< " " << effectInfo->getParameter( effectInfoList[paraCount].name.c_str() ) << "\n";
		}

		of << "\t}\n";
	}

	for (unsigned short i=0; i<skill->getNumAnimationRibbons(); ++i)
	{
		of << "\tRibbon\n" << "\t{\n";

		Fairy::AnimationRibbon *ribbon = skill->getAnimationRibbon(i);
		assert (ribbon);

		const Ogre::ParameterList &ribbonList = ribbon->getParameters();

		for ( size_t paraCount = 0; paraCount < ribbonList.size(); ++paraCount )
		{
			of << "\t\t" << ribbonList[paraCount].name.c_str() 
				<< " " << ribbon->getParameter( ribbonList[paraCount].name.c_str() ) << "\n";
		}

		of << "\t}\n";
	}

	for (unsigned short i=0; i<skill->getNumAnimationCameraShake(); ++i)
	{
		of << "\tCameraShake\n" << "\t{\n";

			Fairy::AnimationCameraShake *cameraShake = skill->getAnimationCameraShake(i);
		assert (cameraShake);

		const Ogre::ParameterList &cameraShakeList = cameraShake->getParameters();

		for ( size_t paraCount = 0; paraCount < cameraShakeList.size(); ++paraCount )
		{
			of << "\t\t" << cameraShakeList[paraCount].name.c_str() 
				<< " " << cameraShake->getParameter( cameraShakeList[paraCount].name.c_str() ) << "\n";
		}

		of << "\t}\n";
	}

	for (unsigned short i=0; i<skill->getNumAnimationSounds(); ++i)
	{
		of << "\tSound\n" << "\t{\n";

		Fairy::AnimationSound *sound = skill->getAnimationSound(i);
		assert (sound);

		const Ogre::ParameterList &soundList = sound->getParameters();

		for ( size_t paraCount = 0; paraCount < soundList.size(); ++paraCount )
		{
			of << "\t\t" << soundList[paraCount].name.c_str() 
				<< " " << sound->getParameter( soundList[paraCount].name.c_str() ) << "\n";
		}

		of << "\t}\n";
	}

	for (unsigned short i=0; i<skill->getNumAnimationSceneLightInfos(); ++i)
	{
		of << "\tSceneLight\n" << "\t{\n";

		Fairy::AnimationSceneLightInfo *light = skill->getAnimationSceneLightInfo(i);
		assert (light);

		const Ogre::ParameterList &lightList = light->getParameters();

		for ( size_t paraCount = 0; paraCount < lightList.size(); ++paraCount )
		{
			of << "\t\t" << lightList[paraCount].name.c_str() 
				<< " " << light->getParameter( lightList[paraCount].name.c_str() ) << "\n";
		}

		of << "\t}\n";
	}

	for (unsigned short i=0; i<skill->getNumAnimationBulletFlows(); ++i)
	{
		of << "\tAnimBulletFlow\n" << "\t{\n";

		Fairy::AnimationBulletFlow *bulletFlow = skill->getAnimationBulletFlow(i);
		assert (light);

		const Ogre::ParameterList &bulletFlowList = bulletFlow->getParameters();

		for ( size_t paraCount = 0; paraCount < bulletFlowList.size(); ++paraCount )
		{
			of << "\t\t" << bulletFlowList[paraCount].name.c_str() 
				<< " " << bulletFlow->getParameter( bulletFlowList[paraCount].name.c_str() ) << "\n";
		}

		of << "\t}\n";
	}
	of << "}\n";

}