Ejemplo n.º 1
0
// ----------------------------------------------------------------------------
//
bool ActorSelectField::setValue( LPCSTR value ) {
    CString key( value );
    ActorList actors;

    int curPos = 0;
    while ( true ) {
        CString resToken = key.Tokenize( _T(" ,"), curPos );
        if ( resToken.IsEmpty() )
            break;

        resToken.MakeUpper();

        ActorSelectField::EntryMap::iterator it = m_entries.find( resToken );
        if ( it == m_entries.end() )
            throw FieldException( "Invalid fixture number %s", (LPCSTR)resToken );

        actors.push_back( (*it).second.m_actor );
    }

    if ( actors.size() == 0 )
        throw FieldException( "Select at least one fixture" );

    if ( actors.size() > 1 && !m_allow_multiple )
        throw FieldException( "Select a single fixture" );

    m_selected_actors = actors;

    return InputField::setValue( value );
}
Ejemplo n.º 2
0
	void LayersManager::loadInLayer(VirtualDataSceneBase::TransformableActor* layer, StringList loadExclusionList, StringList unLoadExclusionList)
	{
		if (_loadInLayer == layer)
			return;
		unLoadInLayer(unLoadExclusionList);
		dynamic_cast<SingleLayerActor*>(layer)->mandatoryLoadNodeAsynchronous(loadExclusionList);
		_loadInLayer = layer;
		SystemViewContext* currentcontext = getSystemViewContext(this);
		if (_loadInLayer->isInstanceOf(CLASS_EARTHLAYER))
		{
			currentcontext->_mainViewer->getCamera()->setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
			currentcontext->_mainViewer->getCamera()->setNearFarRatio(1e-9);
			_root->removeChild(_sceneSky);
		}
		else
		{
			currentcontext->_mainViewer->getCamera()->setClearColor(osg::Vec4(0.004f, 0.0902f, 0.1804f, 1.0f));
			currentcontext->_mainViewer->getCamera()->setNearFarRatio(1e-5);
			if (!_root->containsNode(_sceneSky))
				_root->addChild(_sceneSky);
			//reset
			dynamic_cast<SingleLayerActor*>(_loadInLayer.get())->resetZeroTransform();
			ActorList childLayerList;
			dynamic_cast<SingleLayerActor*>(_loadInLayer.get())->getAllChildren(childLayerList, CLASS_LAYER, true, false);
			for (unsigned int i = 0; i < childLayerList.size(); ++i)
			{
				dynamic_cast<SingleLayerActor*>(childLayerList.at(i))->resetDefaultTransform();
			}
		}
		osg::ref_ptr<UserEventData> userData = new UserEventData();
		userData->_eventObject = _loadInLayer.get();
		userData->_eventType = UserEventData::LAYERCHANGED;
		currentcontext->_mainViewer->getEventQueue()->userEvent(userData.get());
	}
Ejemplo n.º 3
0
	void LayersManager::deleteLayer(VirtualDataSceneBase::ActorBase* layerActor, bool deleteChild)
	{
		osg::Node* layerNode = dynamic_cast<osg::Node*>(layerActor);
		if (layerActor->isInstanceOf(CLASS_ENTERPRISELAYER))
		{
			_root->removeChild(layerNode);
			_enterpriseList.erase(std::find(_enterpriseList.begin(), _enterpriseList.end(), layerNode));
		}
		else
		{
			VirtualDataSceneKernel::SingleLayerActor* ppLayer = dynamic_cast<VirtualDataSceneKernel::SingleLayerActor*>(layerNode->getParent(0));
			if (!deleteChild)
			{
				ActorList returnValue;
				VirtualDataSceneKernel::DeviceGroup* parent = dynamic_cast<VirtualDataSceneKernel::DeviceGroup*>(layerActor);
				parent->getAllChildren(returnValue, CLASS_DEVICE);
				osg::ref_ptr<osg::Node> everyObj;
				for (unsigned int i = 0; i < returnValue.size(); ++i)
				{
					everyObj = dynamic_cast<osg::Node*>(returnValue.at(i));
					parent->removeChild(everyObj);
					ppLayer->addChild(everyObj);
				}
			}
			dynamic_cast<VirtualDataSceneKernel::SingleLayerActor*>(layerActor)->mandatoryUnLoadNode();
			ppLayer->removeChild(dynamic_cast<osg::Node*>(layerActor));
		}
	}
Ejemplo n.º 4
0
bool GCAddItem::Update(const float ticks)
{
	ActorList partyList = ActorMgr::Instance().GetPartyList();
	const std::string leaderName = ActorMgr::Instance().GetActivePlayer().GetStatBlock().GetName();
	Item item = ItemDB::Instance().GetItem(m_itemName);

	//@TODO - better than before, not hard coded to chests, but can I do better?
	// for instance, still need a way to put the item back in the chest if there is no
	// room for anyone in the party to hold the item
	std::stringstream temp;
	temp << leaderName << " " << m_searchText << "^";
	temp << leaderName << " found\n" << item.GetName().c_str() << ".^";

	for (unsigned int i = 0; i < partyList.size(); ++i)
	{
		if (partyList[i]->GetStatBlock().AddItem(m_itemName))
		{
			if (i == 0)
			{
				temp << leaderName << " recieved\n" << m_itemName.c_str() << "."; 
			}
			else
			{
				temp << leaderName << " passed the\n" << m_itemName.c_str() 
					 << " to " << partyList[i]->GetStatBlock().GetName() << ".";
			}
			break;
		}
		if (i >= (partyList.size()-1))
		{
			temp << "But, everyone's hands are full.";
		}
	}

	WindowMgr::Instance().AddDialogueGrp(temp.str());
	/* Possible outcomes:
	DialogueWindow "BOWIE opened the chest.^BOWIE found\nITEM.^BOWIE recieved\nITEM."
	DialogueWindow "BOWIE opened the chest.^BOWIE found\nITEM.^BOWIE passed the\nITEM to OTHERMEMBER."
	DialogueWindow "BOWIE opened the chest.^BOWIE found\nITEM.^But, everyone's hands are full."
	*/

	return true;
}
Ejemplo n.º 5
0
	void LayersManager::getViewPointList(const std::string& targetID, ActorRefPtrList& viewPointList, int viewPointType)
	{
		ActorList childLayerList;
		dynamic_cast<SingleLayerActor*>(_loadInLayer.get())->getAllChildren(childLayerList, CLASS_VIEWPOINTDEFINE, false, false);
		for (unsigned int i = 0; i < childLayerList.size(); ++i)
		{
			std::string type = childLayerList.at(i)->getProperty(ACTOR_PROPERTY_VIEWPOINTTYPE)->toString();
			std::stringstream ss;
			ss << viewPointType;
			if (viewPointType < 0 || type == ss.str())
				viewPointList.push_back(dynamic_cast<VirtualDataSceneBase::TransformableActor*>(childLayerList.at(i)));
		}
	}
Ejemplo n.º 6
0
// ----------------------------------------------------------------------------
//
ActorSelectField::ActorSelectField( LPCSTR field_label, Venue* venue, bool include_groups ) :
        InputField( field_label, "" ),
        m_venue( venue ),
        m_allow_multiple( true )
{
    FixturePtrArray fixtures = venue->getFixtures();
    ActorList actors;

    for ( FixturePtrArray::iterator it=fixtures.begin(); it != fixtures.end(); ++it )
        actors.push_back( SceneActor( (*it) ) );

    if ( include_groups ) {
        FixtureGroupPtrArray fixture_groups = m_venue->getFixtureGroups();
        for ( FixtureGroupPtrArray:: iterator it=fixture_groups.begin(); it != fixture_groups.end(); ++it )
            actors.push_back( SceneActor( venue, (*it) ) );
    }

    ActorPtrArray actor_ptrs;

    for ( size_t i=0; i < actors.size(); i++)
        actor_ptrs.push_back( &actors[i] );

    init( actor_ptrs, UIDArray() );
}