//----------------------------------------------------------------------------------------
void BaseLevelBuilder::createSeer()
{
	// TODO : tile physics
	if(m_level->m_levelDataReference->mapFilePointer == NULL)
		return;

	unsigned int playerType = UserData::GetUserType();
	ASSERT(m_level->m_levelDataReference->mapFilePointer != NULL, "map file is empty");	

	SpriteSeer* seer = LevelObjectCreator::sCreateSeer(UserData::Get()->getUserId(),UserData::Get()->getUserName(),
		playerType ,
		true
		);

	seer->SetID(UserData::Get()->getUserId());
	seer->setTag(MAP_TAG_SEER);
	m_level->m_pObjectsLayer->addChild(seer, LevelLayer::sCalcZorder(seer->getPosition()));

	GameManager::Get()->setHero(seer);
	GameManager::Get()->setHeroTypeId(seer->GetTypeId());

	SkillDispMgr::Get()->Load("Data/skill.bin", "Data/animationMap.bin");
	SkillDispMgr::Get()->LoadFairy("Data/fairyskill.bin", "Data/fairyanimation.bin");


	// TODO : 实际上,影子可以放到LevelLayer里,不一定要放到ObjectLayer里。
	CATLObjectLayer* pObjLayer = dynamic_cast<CATLObjectLayer*>(m_level->m_pObjectsLayer);
	if(pObjLayer)
	{
		pObjLayer->AddRoleShadow(seer);
	}
}
void StoryInstanceDirector::LoadAllRoles()
{
	std::vector<unsigned int> vecOut;
	if (StoryDataCenter::Get()->GetOneItemAllRoleIds(vecOut))
	{
		size_t count = vecOut.size();
		for (size_t index = 0;index<count;index++)
		{
			unsigned int roleId = vecOut[index];
			SpriteSeer* pSeer = 0;
			if (roleId != 0)
			{
				pSeer = InsertOneRole(index+1,roleId);

				unsigned int seerTypeId = pSeer->GetTypeId();
				if (false == SpriteElfConfigFromLuaManager::getInstance()->TellIsElfId(seerTypeId))
				{
					ASprite* pAsprite = AspriteManager::getInstance()->getAsprite("spriteBin/shadow.bin");
					if(pAsprite != NULL)
					{
						CCPoint cp;
						CCSpriteBatchNode* pBatchNode = pAsprite->getSpriteBatchNodeFromFrame_Middle(0, 0, cp);
						if(pBatchNode != NULL)
						{
							pSeer->addChildToRoot(pBatchNode);
						}
					}
				}
			}
			else
			{
				pSeer = GameManager::Get()->getHero();
				pSeer = InsertOneRole(index+1,roleId,pSeer);
				if (pSeer)
				{
					m_heroIndex = index+1;
				}
			}
			if (pSeer)
			{
				pSeer->getRoot()->setVisible(false);
			}
		}
	}	
}
Example #3
0
bool StoryDataCenter::GetOneRoleLeftIcon(unsigned int roleIndex,std::string &iconName)
{
	std::map<unsigned int,StoryRoleBasicData>::iterator Iter = (*mCurIterator).mMapStoryRolesBasicData.find(roleIndex);
	if (Iter == (*mCurIterator).mMapStoryRolesBasicData.end())
	{
		return false;
	}

	StoryRoleBasicData basicData = (*Iter).second;
	iconName = basicData.getRoleLogoIcon();
	if (iconName == "")
	{
		SpriteSeer* pHero = GameManager::Get()->getHero();
		if (pHero)
		{
			unsigned int index = pHero->GetTypeId();
			iconName = LuaTinkerManager::Get()->getLuaConfig<const char *>("characterString", "Characters", index, "PictureFile");
		}		
	}

	return true;
}