示例#1
0
void Game::processContainerAddItem(int containerId, const ItemPtr& item, int slot)
{
    ContainerPtr container = getContainer(containerId);
    if(!container) {
        g_logger.traceError("container not found");
        return;
    }

    container->onAddItem(item, slot);
}
示例#2
0
void Game::processContainerRemoveItem(int containerId, int slot)
{
    ContainerPtr container = getContainer(containerId);
    if(!container) {
        g_logger.traceError("container not found");
        return;
    }

    container->onRemoveItem(slot);
}
示例#3
0
void Game::processContainerUpdateItem(int containerId, int slot, const ItemPtr& item)
{
    ContainerPtr container = getContainer(containerId);
    if(!container) {
        g_logger.traceError("container not found");
        return;
    }

    container->onUpdateItem(slot, item);
}
bool Pull2RefreshTableView::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
	bool bRet = CCTableView::ccTouchBegan(pTouch, pEvent);
	if (bRet)
	{
		m_pointPullStart = getContainer()->convertToNodeSpace(pTouch->getLocation());
		// CCLOG("m_pointPullStart (%0.2f, %0.2f)", m_pointPullStart.x, m_pointPullStart.y);
	}
	return bRet;
}
示例#5
0
文件: EEDialog.cpp 项目: enrevol/ee-x
void Dialog::show(std::size_t level) {
    if (getContainer() == nullptr) {
        auto container = cocos2d::Node::create();
        container->setContentSize(_director->getWinSize());
        container->addChild(this);
    }

    dialogLevel_ = level;
    DialogManager::getInstance()->pushDialog(this, level);
}
示例#6
0
bool Item::canDecay()
{
	if(isRemoved())
		return false;

	if(loadedFromMap && (getUniqueId() || (getActionId() && getContainer())))
		return false;

	const ItemType& it = Item::items[id];
	return it.decayTo >= 0 && it.decayTime;
}
void Pull2RefreshTableView::addFooterArea()
{
	if (m_pFooter)
	{
		if (m_pFooter->getParent())
		{
			m_pFooter->removeFromParent();
		}
		getContainer()->addChild(m_pFooter);
	}
}
示例#8
0
void Game::processOpenContainer(int containerId, const ItemPtr& containerItem, const std::string& name, int capacity, bool hasParent, const std::vector<ItemPtr>& items)
{
    ContainerPtr previousContainer = getContainer(containerId);
    ContainerPtr container = ContainerPtr(new Container(containerId, capacity, name, containerItem, hasParent));
    m_containers[containerId] = container;
    container->onAddItems(items);

    container->onOpen(previousContainer);
    if(previousContainer)
        previousContainer->onClose();
}
示例#9
0
void Game::processCloseContainer(int containerId)
{
    ContainerPtr container = getContainer(containerId);
    if(!container) {
        g_logger.traceError("container not found");
        return;
    }

    m_containers[containerId] = nullptr;
    container->onClose();
}
示例#10
0
void fp_EndnoteContainer::setContainer(fp_Container * pContainer)
{
	if (pContainer == getContainer())
	{
		return;
	}

	if (getContainer() && (pContainer != NULL))
	{
		clearScreen();
	}
	if(pContainer != NULL)
	{
		m_bOnPage = true;
	}
	else
	{
		m_bOnPage = false;
	}
	fp_Container::setContainer(pContainer);
}
示例#11
0
void core::DotMatrix::setCols(int value)
{
	if(cols != value){
		cols = value;

		updateDotList();
		setContainerRect(getContainer());
		update();

		emit colCountChanged(value);
	}
}
示例#12
0
void core::DotMatrix::setDotSize(int size)
{
	if(this->size != size){
		this->size = size;

		setContainerRect(getContainer());

		update();

		emit dotSizeChanged(size);
	}
}
示例#13
0
void core::DotMatrix::setRows(int value)
{
	if(rows != value){
		rows = value;

		updateDotList();
		setContainerRect(getContainer());
		update();

		emit rowCountChanged(value);
	}
}
void OSBChunkBlockElement::preWrite(FieldContainer * const fc)
{
    OSG_OSB_LOG(("OSBChunkBlockElement::preWrite\n"));

    if(getContainer() == NULL || fc == NULL)
    {
        FWARNING(("OSBChunkBlockElement::prewrite: Attempt to write NULL.\n"));
        return;
    }

    preWriteFieldContainer(fc, "");
}
/*! Write the contents of the field with the given \a fieldId to the stream.

    \param[in] fieldId Id of the field to write.
 */
void
OSBCommonElement::writeFieldContent(const UInt32 fieldId)
{
    OSG_OSB_LOG(("OSBCommonElement::writeFieldContent\n"));

    BinaryWriteHandler *wh = editRoot()->getWriteHandler();
    FieldContainer     *fc = getContainer();

    const FieldDescriptionBase *fieldDesc = fc->getFieldDescription(fieldId);
    const BitVector             fieldMask = fieldDesc->getFieldMask(       );

    fc->copyToBin(*wh, fieldMask);
}
示例#16
0
std::string VExprIntegerDeclaration::getString(unsigned int indentLevel) const {
    std::string s;
    s = indent(indentLevel) + "integer ";
    int pos = 0;
    CONST_FOR_EACH(x, getContainer()) {
        if (pos != 0)
            s += ", ";
        s = s += x->getString();
        ++pos;
    }
    s += ";\n";
    return s;
}
示例#17
0
void Game::processCloseContainer(int containerId)
{
    ContainerPtr container = getContainer(containerId);
    if(!container) {
        /* happens if you close and restart client with container opened
         * g_logger.traceError("container not found");
         */
        return;
    }

    m_containers[containerId] = nullptr;
    container->onClose();
}
示例#18
0
int CBGridView::__indexFromOffset(CCPoint offset) {
    int index = 0;
    CCSize cellSize;
    int col, row;
    float spaceWidth;
    
    cellSize = m_pDataSource->cellSizeForTable(this);
    switch(getDirection()) {
        case kCCScrollViewDirectionHorizontal:
            spaceWidth = getContainer()->getContentSize().height / m_colCount;
            col = (offset.y - (spaceWidth - cellSize.height) * 0.5) / spaceWidth;
            row = offset.x / cellSize.width;
            break;
        default:
            spaceWidth = getContainer()->getContentSize().width / m_colCount;
            col = (offset.x - (spaceWidth - cellSize.width) * 0.5) / spaceWidth;
            row = MAX(0, offset.y / cellSize.height);

            break;
    }
    index = col + row * m_colCount;
    return index;
}
示例#19
0
void core::DotMatrix::setMatrixSize(const QSize &size)
{
	if(rows != size.height() || cols != size.width()){
		rows = size.height();
		cols = size.width();

		setContainerRect(getContainer());
		updateDotList();

		update(getContainerRect());

		emit matrixSizeChanged(size);
	}
}
示例#20
0
bool CCScrollView::isNodeFullyVisible(CCNode* node) {
    const CCPoint offset = this->getContentOffset();
    const CCSize  size   = this->getViewSize();
    const float   scale  = this->getZoomScale();
    
    CCRect viewRect;
    
    viewRect = CCRectMake(-offset.x/scale, -offset.y/scale, size.width/scale, size.height/scale);
    
    CCRect nodeBound = CCRectMake(0, 0, node->getContentSize().width, node->getContentSize().height);
    CCAffineTransform t = node->nodeToAncestorTransform(getContainer());
    nodeBound = CCRectApplyAffineTransform(nodeBound, t);
    return viewRect.containsRect(nodeBound);
}
示例#21
0
void SceneManager::removeObjectFromScene( SceneObject* obj )
{
   AssertFatal( obj, "SceneManager::removeObjectFromScene - Object is not declared" );
   AssertFatal( obj->getSceneManager() == this, "SceneManager::removeObjectFromScene - Object not part of SceneManager" );

   // Notify the object.

   obj->onSceneRemove();

   // Remove the object from the container.

   if( getContainer() )
      getContainer()->removeObject( obj );

   // Remove the object from the zoning system.

   if( getZoneManager() )
      getZoneManager()->unregisterObject( obj );

   // Clear out the reference to us.

   obj->mSceneManager = NULL;
}
示例#22
0
void CBGridView::_updateContentSize() {
    CCSize size, cellSize, viewSize;
    unsigned int cellCount, rows;
    
    cellSize = m_pDataSource->cellSizeForTable(this);
    cellCount = m_pDataSource->numberOfCellsInTableView(this);
    viewSize = CCSizeMake(getViewSize().width/getContainer()->getScaleX(),
                          getViewSize().height / getContainer()->getScaleY());
    
    switch(getDirection()) {
        case kCCScrollViewDirectionHorizontal:
            rows = ceilf(cellCount / (float)m_colCount);
            size = CCSizeMake(MAX(rows * cellSize.width, viewSize.width),
                              m_colCount * cellSize.height);
            break;
        default:
            rows = ceilf(cellCount/((float)m_colCount));
            size = CCSizeMake(MAX(cellSize.width * m_colCount, viewSize.width),
                              MAX(rows * cellSize.height, viewSize.height));
            break;
    }
    setContentSize(size);
}
osg::Real32 FieldAnimationAdvancer::getValue(void) const
{
   if(getFieldId() == 0)
   {
      //Check if the Field Container is defined
      if(getContainer() == osg::NullFC)
      {
         SWARNING << "There is no Field Container defined to get Field Advancer"  << std::endl;
         return 0.0f;
      }
      //Check if the field in this container is defined
      FieldDescription * f = getContainer()->getType().findFieldDescription(getFieldName().c_str());
      if( f == NULL )
      {
         SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
         return 0.0f;
      }
      //Found the Field so set my Field Id
      beginEditCP(FieldAnimationAdvancerPtr(this), FieldIdFieldMask);
         const_cast<SFUInt32*>(&_sfFieldId)->setValue(f->getFieldId());
      endEditCP(FieldAnimationAdvancerPtr(this), FieldIdFieldMask);
      //The Field was not found
      if(getFieldId() == 0)
      {
         SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
         return 0.0f;
      }
      //Check if the field is a Real32
      if(getContainer()->getField( getFieldId() )->getType() != SFReal32::getClassType())
      {
         SWARNING << "Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName() << "Is not a SFReal32 Field."  << std::endl;
         return 0.0f;
      }
   }
   
   return static_cast<SFReal32*>(getContainer()->getField( getFieldId() ))->getValue();
}
void TransfersSyncronizer::save(std::ostream& os) {
  m_sync.save(os);

  StdOutputStream stream(os);
  CryptoNote::BinaryOutputStreamSerializer s(stream);
  s(const_cast<uint32_t&>(TRANSFERS_STORAGE_ARCHIVE_VERSION), "version");

  size_t subscriptionCount = m_consumers.size();

  s.beginArray(subscriptionCount, "consumers");

  for (const auto& consumer : m_consumers) {
    s.beginObject("");
    s(const_cast<PublicKey&>(consumer.first), "view_key");

    std::stringstream consumerState;
    // synchronization state
    m_sync.getConsumerState(consumer.second.get())->save(consumerState);

    std::string blob = consumerState.str();
    s(blob, "state");
    
    std::vector<AccountPublicAddress> subscriptions;
    consumer.second->getSubscriptions(subscriptions);
    size_t subCount = subscriptions.size();

    s.beginArray(subCount, "subscriptions");

    for (auto& addr : subscriptions) {
      auto sub = consumer.second->getSubscription(addr);
      if (sub != nullptr) {
        s.beginObject("");

        std::stringstream subState;
        assert(sub);
        sub->getContainer().save(subState);
        // store data block
        std::string blob = subState.str();
        s(addr, "address");
        s(blob, "state");

        s.endObject();
      }
    }

    s.endArray();
    s.endObject();
  }
}
void OSBChunkBlockElement::postRead(void)
{
    // _mfChunks and _mfSlots have to be kept consistent for ChunkBlock.
    // Also TextureChunk is split into TextureObjChunk and TextureObjChunk
    // on load, so the slot info has to be duplicated.
    // TODO:
    // It would be better if that handling could be confined to
    // TextureChunkElement, but I've not found a good way to do that and keep
    // the information in _mfSlots correct. -- cneumann

    const OSBRootElement *root   = getRoot();
          ChunkBlock     *chkMat = dynamic_cast<ChunkBlock *>(getContainer());
    
    // No chunks loaded
    if(_chunksPtrFieldItValid == false)
        return;

    PtrFieldInfo::PtrIdStoreConstIt idIt  = 
        _chunksPtrFieldIt->getIdStore().begin();
    PtrFieldInfo::PtrIdStoreConstIt idEnd = 
        _chunksPtrFieldIt->getIdStore().end  ();

    for(UInt32 i = 0; idIt != idEnd; ++idIt, ++i)
    {
        UInt32 uiId   =  (*idIt) & 0x00FFFFFF;
        UInt32 uiSlot = ((*idIt) & 0xFF000000) >> 24;

        OSBRootElement::IdElemMapConstIt mapIt = 
            root->getIdElemMap().find(uiId);

        if(mapIt == root->getIdElemMap().end())
        {
            continue;
        }

        OSBElementBase *chunkElem = mapIt->second;

        // other chunk
        StateChunk     *chunk     = 
            dynamic_cast<StateChunk *>(chunkElem->getContainer());
        

        chkMat->addChunk(chunk, uiSlot);
    }
    
    // pointer mapping is already done here for _mfChunks, clear info
    _chunksPtrFieldIt->editIdStore     ().clear();
    _chunksPtrFieldIt->editBindingStore().clear();
}
示例#26
0
bool DecalRoad::_getTerrainHeight( const F32 &x, const F32 &y, F32 &height )
{
   Point3F startPnt( x, y, 10000.0f );
   Point3F endPnt( x, y, -10000.0f );

   RayInfo ri;
   bool hit;         

   hit = getContainer()->castRay(startPnt, endPnt, TerrainObjectType, &ri);   

   if ( hit )
      height = ri.point.z;

   return hit;
}
示例#27
0
void Game::processOpenContainer(int containerId, const ItemPtr& containerItem, const std::string& name, int capacity, bool hasParent, const std::vector<ItemPtr>& items, bool isUnlocked, bool hasPages, int containerSize, int firstIndex)
{
    ContainerPtr previousContainer = getContainer(containerId);
    ContainerPtr container = ContainerPtr(new Container(containerId, capacity, name, containerItem, hasParent, isUnlocked, hasPages, containerSize, firstIndex));
    m_containers[containerId] = container;
    container->onAddItems(items);

    // we might want to close a container here
    enableBotCall();
    container->onOpen(previousContainer);
    disableBotCall();

    if(previousContainer)
        previousContainer->onClose();
}
示例#28
0
void RObject::updateFromR (RCommandChain *chain) {
	RK_TRACE (OBJECTS);

	RCommand *command;
	if (getContainer () == RObjectList::getGlobalEnv ()) {
#warning TODO: find a generic solution
// We handle objects directly in .GlobalEnv differently. That's to avoid forcing promises, when addressing the object directly. In the long run, .rk.get.structure should be reworked to simply not need the value-argument in any case.
		 command = new RCommand (".rk.get.structure.global (" + rQuote (getShortName ()) + ')', RCommand::App | RCommand::Sync | RCommand::GetStructuredData, QString::null, this, ROBJECT_UDPATE_STRUCTURE_COMMAND);
	} else {
		RK_ASSERT (false);	// non-catastrophic, but do we get here?

		command = new RCommand (".rk.get.structure (" + getFullName () + ", " + rQuote (getShortName ()) + ')', RCommand::App | RCommand::Sync | RCommand::GetStructuredData, QString::null, this, ROBJECT_UDPATE_STRUCTURE_COMMAND);
	}
	RKGlobals::rInterface ()->issueCommand (command, chain);
}
示例#29
0
void core::DotMatrix::setInputs(const vector<double> &inputs)
{
	GraphicObject::setInputs(inputs);
	setInputsSize((int)inputs.size());

	updateDotList();

	setContainerRect(getContainer());

	vector<int> intInputs(inputs.begin(), inputs.end());

	update();

	emit statusChanged(QVector<int>::fromStdVector(intInputs));
}
示例#30
0
    ColorCurveWindow(ColorCurveFilter& filter, FilterManagerImpl& filterMgr)
        : FilterWindow("Color Curve", "ColorCurve", &filterMgr,
                       WithChannelsSelector,
                       WithoutTiledCheckBox)
        , m_filter(filter)
        , m_editor(filter.getCurve(), 0, 0, 255, 255)
    {
        m_view.attachToView(&m_editor);
        m_view.setExpansive(true);
        jwidget_set_min_size(&m_view, 128, 64);

        getContainer()->addChild(&m_view);

        m_editor.CurveEditorChange.connect(&ColorCurveWindow::onCurveChange, this);
    }