Exemplo n.º 1
0
void GoodNPC::attckCallBackAction(Node* pSender){

	Rect attackRect = PublicFun::getAttackRect(this);//¹ÖÎï¹¥»÷ÇøÓò
	Rect hurtRect;
    
	for (NPC* npc : global->badNpcs)
	{
		if (!npc || npc->getActionState() == ActionStateDie)
		{
			continue;
		}

		hurtRect = PublicFun::getHurtRect(npc);// ÓѾüÊÜÉËÇøÓò
		if (attackRect.intersectsRect(hurtRect))
		{
			npc->setAllowMove(false);

			damageDisplay(StringUtils::format("-%d", getAP()).c_str(), npc);

			npc->hurt(getAP(), 10);
		}
	}

	this->setActionState(ActionStateNone);
	this->setAllowMove(true);
	this->runIdleAction();
}
bool fl_ContainerLayout::_getPropertiesAP(const PP_AttrProp*& pAP)
{
	pAP = NULL;
	FPVisibility eVisibility = getAP(pAP);
	UT_return_val_if_fail(pAP, false);

	setVisibility(eVisibility);
	
	//  Find the folded Level of the strux
	lookupFoldedLevel();
	if((isHidden() == FP_VISIBLE) && (getFoldedLevel() > 0) && (getLevelInList() > getFoldedLevel()) )
	{
		xxx_UT_DEBUGMSG(("Table set to hidden folded \n"));
		setVisibility(FP_HIDDEN_FOLDED);
	}
	// evaluate "display" property
	// display property
	const char* pszDisplay = NULL;
	pAP->getProperty("display", (const gchar *&)pszDisplay);
	if(isHidden() == FP_VISIBLE && pszDisplay && !strcmp(pszDisplay, "none"))
	{
		setVisibility(FP_HIDDEN_TEXT);
	}

	return true;
}
/*!
 * This Method looks up the folded level of the strux.
 */
void fl_ContainerLayout::lookupFoldedLevel(void)
{
 	const PP_AttrProp* pSectionAP = NULL;

	getAP(pSectionAP);

	const gchar *pszTEXTFOLDED = NULL;
	if(!pSectionAP || !pSectionAP->getProperty("text-folded",pszTEXTFOLDED))
	{
		m_iFoldedLevel = 0;
	}
	else
	{
		m_iFoldedLevel = atoi(pszTEXTFOLDED);
	}
	xxx_UT_DEBUGMSG(("FOlded Level is %d \n",m_iFoldedLevel));
    pszTEXTFOLDED = NULL;
	if(!pSectionAP || !pSectionAP->getProperty("text-folded-id",pszTEXTFOLDED))
	{
		m_iFoldedID = 0;
	}
	else
	{
		m_iFoldedID = atoi(pszTEXTFOLDED);
	}
}
Exemplo n.º 4
0
/*!
 * This method creates a new footnote with its properties initially set
 * from the Attributes/properties of this Layout
 */
void fl_FrameLayout::_createFrameContainer(void)
{	
	lookupProperties();
	fp_FrameContainer * pFrameContainer = new fp_FrameContainer(static_cast<fl_SectionLayout *>(this));
	setFirstContainer(pFrameContainer);
	setLastContainer(pFrameContainer);
	pFrameContainer->setWidth(m_iWidth);
	pFrameContainer->setHeight(m_iHeight);
	// Now do Frame image

	const PP_AttrProp* pSectionAP = NULL;
	// This is a real NO-NO: must *always* call getAP()
	// m_pLayout->getDocument()->getAttrProp(m_apIndex, &pSectionAP);
	getAP(pSectionAP);
	
	const gchar * pszDataID = NULL;
	pSectionAP->getAttribute(PT_STRUX_IMAGE_DATAID, (const gchar *&)pszDataID);
	DELETEP(m_pGraphicImage);
	DELETEP(m_pImageImage);
	//
	// Set the image size from the full width
	//
	setImageWidth(pFrameContainer->getFullWidth());
	setImageHeight(pFrameContainer->getFullHeight());
	if(pszDataID && *pszDataID)
	{
		UT_DEBUGMSG(("!!!Found image of file %s \n",pszDataID));
		m_pGraphicImage = FG_Graphic::createFromStrux(this);
	}

	setContainerProperties();
}
/*!
 * Return the value of the attribute keyed by pszName
 */
const char*	fl_ContainerLayout::getAttribute(const char * pszName) const
{
	const PP_AttrProp * pAP = NULL;
	getAP(pAP);
	UT_return_val_if_fail(pAP, NULL);
	
	const gchar* pszAtt = NULL;
	pAP->getAttribute(static_cast<const gchar*>(pszName), pszAtt);

	return pszAtt;
}
Exemplo n.º 6
0
/*!
 * This loads all the properties of the container found in the piecetable
 * into the physical frame container
 */
void 	fl_FrameLayout::setContainerProperties(void)
{
	fp_FrameContainer * pFrame = static_cast<fp_FrameContainer *>(getLastContainer());
	if(pFrame == NULL)
	{
		UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
		return;
	}
	pFrame->setBackground(m_background  );
	pFrame->setBottomStyle(m_lineBottom  );
	pFrame->setTopStyle(m_lineTop  );
	pFrame->setLeftStyle(m_lineLeft  );
	pFrame->setRightStyle(m_lineRight );
	pFrame->setXpad(m_iXpad);
	pFrame->setYpad(m_iYpad);
	pFrame->setTightWrapping(m_bIsTightWrap);
	if(FL_FRAME_BELOW_TEXT ==  m_iFrameWrapMode)
        {
	        pFrame->setAbove(false);
	}
	else if(FL_FRAME_WRAPPED_TO_RIGHT == m_iFrameWrapMode)
	{
	        pFrame->setRightWrapped(true);
	}
	else if(FL_FRAME_WRAPPED_TO_LEFT == m_iFrameWrapMode)
	{
	  pFrame->setLeftWrapped(true);
	}
	else if(FL_FRAME_WRAPPED_TOPBOT == m_iFrameWrapMode)
	{
	        pFrame->setTopBot(true);
	}
//
// Now do the image for this frame.
//
	if(m_pGraphicImage)
	{
		if(m_pImageImage == NULL)
		{
			const PP_AttrProp * pAP = NULL;
			getAP(pAP);
			GR_Graphics * pG = getDocLayout()->getGraphics();
			UT_sint32 iWidth = pG->tlu(100);
			UT_sint32 iHeight = pG->tlu(100);
			if(m_pGraphicImage->getType() == FGT_Raster)
			{
				iWidth = pG->tlu(m_pGraphicImage->getWidth());
				iHeight = pG->tlu(m_pGraphicImage->getHeight());
			}
			GR_Image * pImage = m_pGraphicImage->generateImage(pG,pAP,iWidth,iHeight);
			m_iDocImageWidth = pFrame->getFullWidth();
			m_iDocImageHeight = pFrame->getFullHeight();
			m_iGraphicTick = getDocLayout()->getGraphicTick();
			UT_Rect rec(0,0,pFrame->getFullWidth(),pFrame->getFullHeight());
			if(rec.width < pG->tlu(3))
			{
				rec.width = pG->tlu(3);
			}
			if(rec.height < pG->tlu(3))
			{
				rec.height = pG->tlu(3);
			}
			if(pImage)
			{
				pImage->scaleImageTo(pG,rec);
			}
			m_pImageImage = pImage;
		}
		pFrame->getFillType()->setImagePointer(&m_pGraphicImage,&m_pImageImage);
	}
	if(m_iFrameWrapMode >= FL_FRAME_WRAPPED_TO_RIGHT)
	{ 
//
// Set text wrapping around frame
//
		pFrame->setWrapping(true);
	}
	pFrame->setPreferedPageNo(m_iPrefPage);
}