当前位置: 首页>>代码示例>>C++>>正文


C++ CKBehavior::IsInputActive方法代码示例

本文整理汇总了C++中CKBehavior::IsInputActive方法的典型用法代码示例。如果您正苦于以下问题:C++ CKBehavior::IsInputActive方法的具体用法?C++ CKBehavior::IsInputActive怎么用?C++ CKBehavior::IsInputActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKBehavior的用法示例。


在下文中一共展示了CKBehavior::IsInputActive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BehaviourFunction

/*
 *******************************************************************
 * Function: int BehaviourFunction( const CKBehaviorContext& behaviorContext )
 *
 * Description : The execution function is the function that will be called 
 *               during the process loop of the behavior engine, if the behavior 
 *               is defined as using an execution function. This function is not 
 *               called if the behavior is defined as a graph. This function is the 
 *               heart of the behavior: it should compute the essence of the behavior, 
 *               in an incremental way. The minimum amount of computing should be 
 *               done at each call, to leave time for the other behaviors to run. 
 *               The function receives the delay in milliseconds that has elapsed 
 *               since the last behavioral process, and should rely on this value to 
 *               manage the amount of effect it has on its computation, if the effect 
 *               of this computation relies on time.
 *
 * Paramters :
 *    behaviourContext    r   Behavior context reference, which gives access to 
 *                            frequently used global objects ( context, level, manager, etc... )
 *
 * Returns : int, If it is done, it should return CKBR_OK. If it returns 
 *                CKBR_ACTIVATENEXTFRAME, the behavior will again be called 
 *                during the next process loop.
 *
 *******************************************************************
 */
int CGBLBuildCommand::BehaviourFunction(const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
  	CKContext* context = behaviorContext.Context;

	if( behavior->IsInputActive(EGBLBuildCommandBehInputs::BuildCommand) ) 
	{
		DeactivateInputs(behaviorContext);
		DeactivateOutputs(behaviorContext);
		return DoBuildCommand (behaviorContext);
	}

	if( behavior->IsInputActive(EGBLBuildCommandBehInputs::CancelOperation))
	{
		DeactivateInputs(behaviorContext);
		DeactivateOutputs(behaviorContext);
		ClearParameterOutputs (behaviorContext);

		int stateValue = EGBLBuildCommandState::Initial;
		behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);

		int initialParameterPosition = 0;
		behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &initialParameterPosition);

		char *emptyString = "";
		behavior->SetLocalParameterValue(commandStringLocalPos, emptyString, strlen(emptyString)+1);

		behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Cancelled);
	}

	if( behavior->IsInputActive(EGBLBuildCommandBehInputs::ReadNextParameterValue))
	{
		DeactivateInputs(behaviorContext);
		DeactivateOutputs(behaviorContext);

		int stateValue = 0;
		behavior->GetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);

		if (! ( (stateValue == EGBLBuildCommandState::AwaitingParametersForUntargeted) || (stateValue == EGBLBuildCommandState::AwaitingParametersForNetwork) || (stateValue == EGBLBuildCommandState::GetTargets) ) )
		{
			int stateValue = EGBLBuildCommandState::Initial;
			behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);

			int initialParameterPosition = 0;
			behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &initialParameterPosition);

			char *emptyString = "";
			behavior->SetLocalParameterValue(commandStringLocalPos, emptyString, strlen(emptyString)+1);

			CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
			TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE_DESC);

			behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
		}

		return DoReadNextParameterValue (behaviorContext);
	}

	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:86,代码来源:GBLBuildCommand.cpp

示例2: MidiEvent

int MidiEvent(const CKBehaviorContext& behcontext)
{
  CKBehavior *beh = behcontext.Behavior;

  if( beh->IsInputActive(1) ){ // OFF
    beh->ActivateInput(1, FALSE);

    return CKBR_OK;
  }
  
  CKBOOL combiWasOK = FALSE;
  if( beh->IsInputActive(0) ){ // ON
    beh->ActivateInput(0, FALSE);
    beh->SetLocalParameterValue(0, &combiWasOK);
  } else {
    beh->GetLocalParameterValue(0, &combiWasOK);
  }

  MidiManager *mm = (MidiManager *) behcontext.Context->GetManagerByGuid( MIDI_MANAGER_GUID );

  // Channel
  int channel=0;
  beh->GetInputParameterValue(0, &channel);

  int note, count = beh->GetInputParameterCount();
  //--- test if all input notes are activated or not
  for( int a=1 ; a<count ; a++ ){
    beh->GetInputParameterValue(a, &note);
    if( !mm->IsNoteActive(note, channel) ) break;
  }

  if( a==count ){ // All notes are pressed
    if( !combiWasOK ){
      beh->ActivateOutput(0);
      
      combiWasOK = TRUE;
      beh->SetLocalParameterValue(0, &combiWasOK);
      
      return CKBR_ACTIVATENEXTFRAME;
    }
  } else { // Not all notes are pressed
    if( combiWasOK ){
      beh->ActivateOutput(1);
      
      combiWasOK = FALSE;
      beh->SetLocalParameterValue(0, &combiWasOK);
      
      return CKBR_ACTIVATENEXTFRAME;
    }
  }

  return CKBR_ACTIVATENEXTFRAME;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:53,代码来源:MidiEvent.cpp

示例3: DirToArray

int DirToArray(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;

	XString filename((CKSTRING) beh->GetInputParameterReadDataPtr(0));
	XString Mask((CKSTRING) beh->GetInputParameterReadDataPtr(1));
		
	int rec;

	beh->GetInputParameterValue(2,&rec);

	

	if( beh->IsInputActive(0) ){
		beh->ActivateInput(0,FALSE);

		flist.erase(flist.begin(),flist.end());

		CKDirectoryParser MyParser(filename.Str(),Mask.Str(),rec);
		char* str = NULL;
		while(str = MyParser.GetNextFile())
			flist.push_back(XString(str));

		counter = 0;
		beh->ActivateInput(1,TRUE);

		
	}


	if( beh->IsInputActive(1) ){
		beh->ActivateInput(1,FALSE);

		if ( counter < flist.size() ){
			XString entry = flist.at(counter);
			CKParameterOut * pout = beh->GetOutputParameter(0);
			pout->SetStringValue(entry.Str() );
				
			counter++;
			beh->SetOutputParameterValue(1,&counter);
			beh->ActivateOutput(1);

		}else{

			beh->SetOutputParameterValue(1,&counter);
			counter = 0 ; 
			beh->ActivateOutput(0);
		}
	}
	return 0;
}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例4: FTPLogin

int FTPLogin(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;

		if( beh->IsInputActive(0)){
			beh->ActivateInput(0,FALSE);
	
			HWND win = (HWND)ctx->GetMainWindow();
			FtpInit(win);
			//HFILE hLogFile =  _lcreat (LOG_FILE, 0);
			//FtpLogTo (hLogFile);
			
			
	
			FtpSetDefaultTimeOut (30);
			FtpSetPassiveMode(TRUE);
			FtpSetAsynchronousMode();
	
			int Port;
			beh->GetInputParameterValue(3,&Port);
			


			XString Host((CKSTRING) beh->GetInputParameterReadDataPtr(0));
			XString User((CKSTRING) beh->GetInputParameterReadDataPtr(1));
			XString Pw((CKSTRING) beh->GetInputParameterReadDataPtr(2));
			
			int Login = FtpLogin(Host.Str(),User.Str(),Pw.Str(),win,0);
			beh->SetOutputParameterValue(0,&Login);
			

			if (Login == 0)beh->ActivateOutput(0);
				else{
					beh->ActivateOutput(2);
					return CKBR_OK;
				}
				return CKBR_ACTIVATENEXTFRAME;
			}

		if( beh->IsInputActive(1)){
			beh->ActivateInput(1,FALSE);

			FtpCloseConnection();
			FtpRelease ();
			beh->ActivateOutput(1);
			return CKBR_OK;
		}
	return CKBR_ACTIVATENEXTFRAME;
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例5: PCIgnorePair

//************************************
// Method:    PCIgnorePair
// FullName:  PCIgnorePair
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PCIgnorePair(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();
	
	pFactory *pf = pFactory::Instance();

	using namespace vtTools::BehaviorTools;
	
	if( beh->IsInputActive(0) )
	{

		//////////////////////////////////////////////////////////////////////////
		//the object : 
		CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
		if( !target ) return CKBR_OWNERERROR;


		CK3dEntity *targetA = (CK3dEntity *) beh->GetInputParameterObject(0);
		CK3dEntity *targetB = (CK3dEntity *) beh->GetInputParameterObject(1);
		int ignore = GetInputParameterValue<int>(beh,2);
		//////////////////////////////////////////////////////////////////////////
		// the world :  
		pWorld *world=GetPMan()->getWorld(target); 
		
		if(world){
			world->cIgnorePair(targetA,targetB,ignore);
		}
		
		beh->ActivateInput(0,FALSE);
		beh->ActivateOutput(0);
	}
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:43,代码来源:PCIgnorePair.cpp

示例6: PClothDestroy

//************************************
// Method:    PClothDestroy
// FullName:  PClothDestroy
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PClothDestroy(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();
	
	pFactory *pf = pFactory::Instance();

	using namespace vtTools::BehaviorTools;
	
	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);

		//////////////////////////////////////////////////////////////////////////
		//the object : 
		CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
		if( !target ) return CKBR_OWNERERROR;
		//////////////////////////////////////////////////////////////////////////
		pCloth *cloth  = GetPMan()->getCloth(target->GetID());
		if (!cloth)
		{
			beh->ActivateOutput(0);
			return CKBR_PARAMETERERROR;
		}

		pWorld *world = cloth->getWorld();
		world->destroyCloth(target->GetID());

		beh->ActivateOutput(0);
	}
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:41,代码来源:PCDestroy.cpp

示例7: Py_BuildValue

PyObject *vt_IsInputActive( PyObject * self, PyObject * args )
{
		
	PyObject *arg;

	int size = PyTuple_Size(args);

	int bid, index, value;
	PyArg_ParseTuple(args, "ii", &bid, &index); 

	CK_ID cid = bid; 

	if (size!=2)
	{
		pym->m_Context->OutputToConsole("PyError : This function only accepts 2 arguments : \n\t bid,index ");
		Py_RETURN_NONE;
	}

	CKBehavior *beh = static_cast<CKBehavior*>(pym->m_Context->GetObject(cid)); 
	if(beh && index < beh->GetInputCount())
	{
		return Py_BuildValue( "i", beh->IsInputActive(index) ? 1:0  );
	}
	Py_RETURN_NONE;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例8: LoadCIS

int LoadCIS(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	GBLConfigurationManager* cman=(GBLConfigurationManager*)ctx->GetManagerByGuid(CONFIGURATION_MAN_GUID);

	using namespace Customisation::typedefs;
	using namespace GBLCommon::BehaviorTools;


	int LA = GetInputParameterValue<int>(beh,0);
	Customisation::typedefs::CIS* currentCIS = cman->GetCISAccessInterface()->GetCIS(LA);

	if( beh->IsInputActive(0) ){
		beh->ActivateInput(0,FALSE);
		


		beh->ActivateOutput(0);	
		beh->ActivateOutput(1);	
		return CKBR_OK;
		}

	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:25,代码来源:LoadCIS.cpp

示例9: SetMousPos

int SetMousPos(const CKBehaviorContext& behcontext)
{
	

	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;

	if( beh->IsInputActive(0) ){
		beh->ActivateInput(0,FALSE);

 DWORD data = 0;
 DWORD flags = MOUSEEVENTF_ABSOLUTE;
 
 // - Has the pointer moved since the last event?
 
 
 flags |= MOUSEEVENTF_MOVE;

 mouse_event(flags, 100,100, data, 0);
 

		beh->ActivateOutput(0);
	

	}

	return 0;

}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例10: RegisterAttributeType

//************************************
// Method:    RegisterAttributeType
// FullName:  RegisterAttributeType
// Access:    public
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int RegisterAttributeType(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();

	CKAttributeManager* attman = ctx->GetAttributeManager();
	CKParameterManager *pMan  = ctx->GetParameterManager();

	using namespace vtTools::BehaviorTools;

	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);

		
		CKSTRING name = GetInputParameterValue<CKSTRING>(beh,bbI_Name);
		CKSTRING category = GetInputParameterValue<CKSTRING>(beh,bbI_Category);
		CKSTRING defValue = GetInputParameterValue<CKSTRING>(beh,bbI_DefValue);
		int pType = GetInputParameterValue<int>(beh,bbI_PType);
		CK_CLASSID classId = GetInputParameterValue<CK_CLASSID>(beh,bbI_Class);

		int attFlags = 0 ;
		int user = GetInputParameterValue<int>(beh,bbI_User);
		int save = GetInputParameterValue<int>(beh,bbI_Save);

		if(user)
			attFlags|=CK_ATTRIBUT_USER;

		if(save)
			attFlags|=CK_ATTRIBUT_TOSAVE;

		attFlags|=CK_ATTRIBUT_CAN_DELETE;

		CKAttributeType aIType = attman->GetAttributeTypeByName(name);
		if (aIType!=-1)
		{
			beh->ActivateOutput(1);
		}

		int att =  attman->RegisterNewAttributeType(name,pMan->ParameterTypeToGuid(pType),classId,(CK_ATTRIBUT_FLAGS)attFlags);

		if (strlen(category))
		{
			attman->AddCategory(category);
			attman->SetAttributeCategory(att,category);
		}
		if (strlen(defValue))
		{
			attman->SetAttributeDefaultValue(att,defValue);
		}

	}
	pm->populateAttributeFunctions();
	pm->_RegisterAttributeCallbacks();

	beh->ActivateOutput(0);
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:67,代码来源:xRegisterAttributeType.cpp

示例11: JDestroy

//************************************
// Method:    JDestroy
// FullName:  JDestroy
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int JDestroy(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();

	pFactory *pf = pFactory::Instance();

	using namespace vtTools::BehaviorTools;

	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);

		//////////////////////////////////////////////////////////////////////////
		//the object A: 
	
		int jointType = GetInputParameterValue<int>(beh,1); 

		CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
		CK3dEntity *targetB = (CK3dEntity *) beh->GetInputParameterObject(0);
		
		if (!pFactory::Instance()->jointCheckPreRequisites(target,targetB,jointType))
		{
			return CK_OK;
		}
	
		
		// the world :  
		pWorld *worldA=GetPMan()->getWorldByBody(target); 
		pWorld *worldB=GetPMan()->getWorldByBody(targetB); 
		if (!worldA)
		{
			worldA = worldB;
		}
		
		if (!worldA)
		{
			beh->ActivateOutput(0);
			return 0;
		}
		// the physic object A : 
		pRigidBody*bodyA= worldA->getBody(target);
		pRigidBody*bodyB= worldA->getBody(targetB);

		if(bodyA || bodyB)
		{

			pJoint *joint = worldA->getJoint(target,targetB,(JType)jointType);
			if (joint)
			{
				worldA->deleteJoint(joint);
			}
		}

		beh->ActivateOutput(0);
	}
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:67,代码来源:PJDestroy.cpp

示例12: SetCIConnectionDetails

int SetCIConnectionDetails(const CKBehaviorContext& behcontext)
{
	/************************************************************************/
	/*  collecting data : 													*/
	/*  																	*/
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;


	GBLConfigurationManager* cman=(GBLConfigurationManager*)ctx->GetManagerByGuid(CONFIGURATION_MAN_GUID);
	CGBLSyncInterface *CINetworkInterface = cman->GetSynInterface();

    
	
	/************************************************************************/
	/*  check interface :													*/
	/*  																	*/
	if (!CINetworkInterface->isValidInterface())
	{
		//try to init the network interface : 
		if (!CINetworkInterface->Init(ctx))
		{
			return CKBR_BEHAVIORERROR;
		}
	}

	/************************************************************************/
	/*  process building block events	:						*/
	/*  																	*/
	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);
		XString message((CKSTRING) beh->GetInputParameterReadDataPtr(0));
		int connectionID = -1; 
		beh->GetInputParameterValue(1,&CINetworkInterface->connectionID);
		CKAttributeManager *aMan = static_cast<CKAttributeManager*>(ctx->GetAttributeManager());
		
		//////////////////////////////////////////////////////////////////////////
		//store connection details in the scipt dummies attribute :
		CKAttributeType gblNetworkAtt = aMan->GetAttributeTypeByName( GBL_API_ENTRY("NetworkDetails"));
		if (!CINetworkInterface->messageDummy->HasAttribute(gblNetworkAtt) )
		{		
			CINetworkInterface->messageDummy->SetAttribute(gblNetworkAtt);
		}
		GBLCommon::ParameterTools::SetParameterStructureValue<int>(CINetworkInterface->messageDummy->GetAttributeParameter(gblNetworkAtt),0,CINetworkInterface->connectionID);
		GBLCommon::ParameterTools::SetParameterStructureValue<CKSTRING>(CINetworkInterface->messageDummy->GetAttributeParameter(gblNetworkAtt),1,CINetworkInterface->messageName.Str());
		
		//////////////////////////////////////////////////////////////////////////
		//activate and execute the script :
		behcontext.CurrentScene->Activate(CINetworkInterface->synchronizeScript,true);
		behcontext.CurrentScene->Activate(CINetworkInterface->messageDummy,FALSE);
		CINetworkInterface->synchronizeScript->Execute(1);
		
		beh->ActivateOutput(0);
	}
	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:57,代码来源:HIDDEN_SetConnectionDetails.cpp

示例13: PClothDetachFromShape

//************************************
// Method:    PClothDetachFromShape
// FullName:  PClothDetachFromShape
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PClothDetachFromShape(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();
	
	pFactory *pf = pFactory::Instance();

	using namespace vtTools::BehaviorTools;
	
	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);

		//////////////////////////////////////////////////////////////////////////
		//the object : 
		CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
		if( !target ) return CKBR_OWNERERROR;

		
		//////////////////////////////////////////////////////////////////////////

		CK3dEntity*shapeReference  = (CK3dEntity *) beh->GetInputParameterObject(bbI_ShapeReference);
		if (!shapeReference)
		{
			beh->ActivateOutput(0);
			return CKBR_PARAMETERERROR;
		}

		pCloth *cloth  = GetPMan()->getCloth(target->GetID());
		if (!cloth)
		{
			beh->ActivateOutput(0);
			return CKBR_PARAMETERERROR;
		}

		
		NxShape *shape  = cloth->getWorld()->getShapeByEntityID(shapeReference->GetID());
		if(shape)
		{
			cloth->detachFromShape((CKBeObject*)shapeReference);
		}

		
		beh->ActivateOutput(0);


		beh->ActivateOutput(0);
	}
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:59,代码来源:PCDetachFromShape.cpp

示例14: PBSetTriggerMask

//************************************
// Method:    PBSetTriggerMask
// FullName:  PBSetTriggerMask
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PBSetTriggerMask(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;
	PhysicManager *pm = GetPMan();
	
	pFactory *pf = pFactory::Instance();

	using namespace vtTools::BehaviorTools;
	
	if( beh->IsInputActive(0) )
	{
		beh->ActivateInput(0,FALSE);

		//////////////////////////////////////////////////////////////////////////
		//the object : 
		CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
		if( !target ) return CKBR_OWNERERROR;


		//////////////////////////////////////////////////////////////////////////
		// the world :  
		
		pWorld *world  = GetPMan()->getWorldByShapeReference(target);
		if (!world)
		{
			beh->ActivateOutput(0);
			return 0;
		}

		if (world)
		{
			NxShape *shape  = world->getShapeByEntityID(target->GetID());
			if (shape)
			{

				int onEnter = GetInputParameterValue<int>(beh,bbI_OnEnter);
				int onStay = GetInputParameterValue<int>(beh,bbI_OnStay);
				int onLeave = GetInputParameterValue<int>(beh,bbI_OnLeave);

				shape->setFlag(NX_TRIGGER_ON_ENTER,onEnter);
				shape->setFlag(NX_TRIGGER_ON_STAY,onStay);
				shape->setFlag(NX_TRIGGER_ON_LEAVE,onLeave);

			}
		}
			
		beh->ActivateOutput(0);
	}
	return 0;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:59,代码来源:PBSetTriggerMask.cpp

示例15: GetFile

int GetFile(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
  	CKContext* ctx = behcontext.Context;

	int Length=0;

	// Start by In0
	if( beh->IsInputActive(0)){
		beh->ActivateInput(0,FALSE);

		
		XString RemoteFile((CKSTRING) beh->GetInputParameterReadDataPtr(0));
		XString LocalFile((CKSTRING) beh->GetInputParameterReadDataPtr(1));
		
		char *Type = "Type_B";
		int Get = FtpRecvFile (	RemoteFile.Str(),LocalFile.Str(),*Type, FALSE,NULL,NULL);
		Length = FtpBytesToBeTransferred();

		if ( Get !=0 ){
			beh->SetOutputParameterValue(3,&Get);
			beh->ActivateOutput(2);
			return CKBR_OK;
		}

		beh->SetOutputParameterValue(0,&Length);
		beh->ActivateOutput(0);
		return CKBR_ACTIVATENEXTFRAME;
	}


	beh->GetOutputParameterValue(0,&Length);

	int down=FtpBytesTransferred(); 
	beh->SetOutputParameterValue(1,&down);
	float progress=(float)(down*100.0f/Length); // percentage of file downloaded
	progress /=100.0f;
	beh->SetOutputParameterValue(2,&progress);


	
	if ( down == Length){

			beh->ActivateOutput(1);
			return CKBR_OK;
	}

	return CKBR_ACTIVATENEXTFRAME;
	
}
开发者ID:,项目名称:,代码行数:50,代码来源:


注:本文中的CKBehavior::IsInputActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。