コード例 #1
0
void UnlockPortals::AddParticle(int count)
{
	if (IsUnlocked())
		return;

	m_numParticlesLeft -= count;
	m_curParticleTotal += count;
	if (IsUnlocked())
	{
		setSpriteFrame(m_unlockImage);
		setPhysicsBody(m_unlockCollision);
		removeAllChildrenWithCleanup(true);
		if (m_boundaryImg != "none")
		{
			auto boundary = cocos2d::Sprite::create();
			boundary->setAnchorPoint(cocos2d::Vec2(0, 0));
			boundary->setTexture(m_boundaryImg);
			boundary->setTextureRect(m_unlockRect);
			cocos2d::Texture2D::TexParams params = cocos2d::Texture2D::TexParams();
			params.magFilter = GL_LINEAR;
			params.minFilter = GL_LINEAR;
			params.wrapS = GL_REPEAT;
			params.wrapT = GL_REPEAT;
			boundary->getTexture()->setTexParameters(params);
			boundary->setCameraMask(4);
			addChild(boundary,22);
			boundary->setPosition(m_unlockRect.origin + cocos2d::Vec2(m_imgXOffset, m_imgYOffset));
		}
	}
	else
	{
		setSpriteFrame(cocos2d::SpriteFrameCache::getInstance()->spriteFrameByName(m_particleBaseImg + std::to_string(m_curParticleTotal) + m_particleBaseImgExt));
	}
}
コード例 #2
0
ファイル: Progression.cpp プロジェクト: danishcake/ShokoTD
void Progression::GetRewards(std::string _level, std::vector<std::string>& _unlocked_skills, 
												 std::vector<std::string>& _locked_skills,
												 std::vector<std::string>& _unlocked_levels,
												 std::vector<std::string>& _locked_levels)
{
	for(std::vector<ProgressLevel*>::iterator it = levels_.begin(); it != levels_.end(); ++it)
	{
		if((*it)->GetName() == _level)
		{
			std::vector<std::string> reward_skills;
			std::vector<std::string> reward_levels;
			(*it)->GetUnlockables(reward_levels, reward_skills);
			for(std::vector<std::string>::iterator it = reward_levels.begin(); it != reward_levels.end(); ++it)
			{
				if(IsUnlocked(*it))
					_unlocked_levels.push_back(*it);
				else
					_locked_levels.push_back(*it);
			}
			for(std::vector<std::string>::iterator it = reward_skills.begin(); it != reward_skills.end(); ++it)
			{
				if(skill_manager_.SkillAvailable(*it))
					_unlocked_skills.push_back(*it);
				else
					_locked_skills.push_back(*it);
			}

		}
	}
}
コード例 #3
0
RasterImage::WillDrawOpaqueNow()
{
  if (!IsOpaque()) {
    return false;
  }

  if (mAnimationState) {
    // We never discard frames of animated images.
    return true;
  }

  // If we are not locked our decoded data could get discard at any time (ie
  // between the call to this function and when we are asked to draw), so we
  // have to return false if we are unlocked.
  if (IsUnlocked()) {
    return false;
  }

  LookupResult result =
    SurfaceCache::LookupBestMatch(ImageKey(this),
                                  RasterSurfaceKey(mSize,
                                                   DefaultSurfaceFlags(),
                                                   PlaybackType::eStatic));
  MatchType matchType = result.Type();
  if (matchType == MatchType::NOT_FOUND || matchType == MatchType::PENDING ||
      !result.Surface()->IsFinished()) {
    return false;
  }

  return true;
}
コード例 #4
0
void UnlockPortals::SetUnlockCollision(cocos2d::Vec2 collBoxSize, cocos2d::Vec2 collBoxOffset)
{
	m_unlockCollision = cocos2d::PhysicsBody::createBox(cocos2d::Size(collBoxSize), cocos2d::PhysicsMaterial(1.0f, 0.0f, 0.0f), collBoxOffset);
	m_lockCollision->setContactTestBitmask(0x0);
	m_lockCollision->setCollisionBitmask(0x1 << curOffset);
	m_unlockCollision->setDynamic(false);
	m_unlockCollision->setGravityEnable(true);
	m_unlockCollision->setRotationEnable(false);
	m_unlockCollision->retain();
	m_unlockRect = cocos2d::Rect(collBoxOffset.x - collBoxSize.x / 2, collBoxOffset.y - collBoxSize.y /3, collBoxSize.x, collBoxSize.y);

	if (curOffset < 30)
		++curOffset;
	else
		curOffset = 27;

	if (IsUnlocked() && m_boundaryImg != "none")
	{
		setPhysicsBody(m_unlockCollision);
		removeAllChildrenWithCleanup(true);
		auto boundary = cocos2d::Sprite::create();
		boundary->setAnchorPoint(cocos2d::Vec2(0, 0));
		boundary->setTexture(m_boundaryImg);
		boundary->setTextureRect(m_unlockRect);
		cocos2d::Texture2D::TexParams params = cocos2d::Texture2D::TexParams();
		params.magFilter = GL_LINEAR;
		params.minFilter = GL_LINEAR;
		params.wrapS = GL_REPEAT;
		params.wrapT = GL_REPEAT;
		boundary->getTexture()->setTexParameters(params);
		boundary->setCameraMask(4);
		addChild(boundary,22);
		boundary->setPosition(m_unlockRect.origin + cocos2d::Vec2(m_imgXOffset, m_imgYOffset));
	}
}
コード例 #5
0
FSlateColor SSettingsEditorCheckoutNotice::HandleBorderBackgroundColor() const
{
	static FColor Orange(166, 137, 0);

	const FLinearColor FinalColor = (IsUnlocked() || DefaultConfigQueryInProgress) ? FColor(60, 60, 60) : Orange;
	return FinalColor;
}
コード例 #6
0
RasterImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aManager);
  MOZ_ASSERT((aFlags & ~(FLAG_SYNC_DECODE |
                         FLAG_SYNC_DECODE_IF_FAST |
                         FLAG_ASYNC_NOTIFY))
               == FLAG_NONE,
             "Unsupported flag passed to GetImageContainer");

  int32_t maxTextureSize = aManager->GetMaxTextureSize();
  if (!mHasSize ||
      mSize.width > maxTextureSize ||
      mSize.height > maxTextureSize) {
    return nullptr;
  }

  if (IsUnlocked() && mProgressTracker) {
    mProgressTracker->OnUnlockedDraw();
  }

  RefPtr<layers::ImageContainer> container = mImageContainer.get();

  bool mustRedecode =
    (aFlags & (FLAG_SYNC_DECODE | FLAG_SYNC_DECODE_IF_FAST)) &&
    mLastImageContainerDrawResult != DrawResult::SUCCESS &&
    mLastImageContainerDrawResult != DrawResult::BAD_IMAGE;

  if (container && !mustRedecode) {
    return container.forget();
  }

  // We need a new ImageContainer, so create one.
  container = LayerManager::CreateImageContainer();

  DrawResult drawResult;
  RefPtr<layers::Image> image;
  Tie(drawResult, image) = GetCurrentImage(container, aFlags);
  if (!image) {
    return nullptr;
  }

  // |image| holds a reference to a SourceSurface which in turn holds a lock on
  // the current frame's VolatileBuffer, ensuring that it doesn't get freed as
  // long as the layer system keeps this ImageContainer alive.
  AutoTArray<ImageContainer::NonOwningImage, 1> imageList;
  imageList.AppendElement(ImageContainer::NonOwningImage(image, TimeStamp(),
                                                         mLastFrameID++,
                                                         mImageProducerID));
  container->SetCurrentImagesInTransaction(imageList);

  mLastImageContainerDrawResult = drawResult;
  mImageContainer = container;

  return container.forget();
}
コード例 #7
0
ファイル: main.c プロジェクト: FTCr/Siemens
int KeyHook(int key, int type)
{
	if (type == KEY_DOWN && key == (int)cfg_key)
	{
		#define idlegui_id(icsm) (((int *)icsm)[DISPLACE_OF_IDLEGUI_ID/4])
		void *icsm = FindCSMbyID(CSM_root()->idle_id);
		if (icsm)
		{
			if (IsGuiOnTop(idlegui_id(icsm)) && IsUnlocked()) //Если IdleGui на самом верху
			{
				CreateTurnOffMenu();
				return KEYHOOK_BREAK;
			}
		}
	}
	return KEYHOOK_NEXT;
}
コード例 #8
0
/**
 * Handle a RDM UID Message
 */
void RobeWidgetDetector::HandleUidMessage(DispatchingRobeWidget *widget,
                                          const uint8_t *data,
                                          unsigned int length) {
  WidgetStateMap::iterator iter = m_widgets.find(widget);
  if (iter == m_widgets.end())
    return;

  if (length != ola::rdm::UID::UID_SIZE) {
    OLA_INFO << "Robe widget returned invalid UID size: " << length;
    return;
  }

  iter->second.information.uid = ola::rdm::UID(data);

  if (!IsUnlocked(iter->second.information)) {
    OLA_WARN << "This Robe widget isn't unlocked, please visit "
      "http://www.robe.cz/nc/support/search-for/DSU%20RUNIT/ to download "
      "the new firmware.";
    return;
  }

  // ok this is a good interface at this point
  RemoveTimeout(&iter->second);

  const RobeWidgetInformation *widget_info = new RobeWidgetInformation(
      iter->second.information);
  m_widgets.erase(iter);

  OLA_INFO << "Detected Robe Device, UID : " << widget_info->uid <<
    ", Hardware version: 0x" << std::hex <<
    static_cast<int>(widget_info->hardware_version) << ", software version: 0x"
    << static_cast<int>(widget_info->software_version) << ", eeprom version 0x"
    << static_cast<int>(widget_info->eeprom_version);

  // given that we've been called via the widget's stack, schedule execution of
  // the method that deletes the widget.
  m_scheduler->Execute(
      NewSingleCallback(this,
                        &RobeWidgetDetector::DispatchWidget,
                        widget,
                        widget_info));
}
コード例 #9
0
RasterImage::Draw(gfxContext* aContext,
                  const IntSize& aSize,
                  const ImageRegion& aRegion,
                  uint32_t aWhichFrame,
                  SamplingFilter aSamplingFilter,
                  const Maybe<SVGImageContext>& /*aSVGContext - ignored*/,
                  uint32_t aFlags)
{
  if (aWhichFrame > FRAME_MAX_VALUE) {
    return DrawResult::BAD_ARGS;
  }

  if (mError) {
    return DrawResult::BAD_IMAGE;
  }

  // Illegal -- you can't draw with non-default decode flags.
  // (Disabling colorspace conversion might make sense to allow, but
  // we don't currently.)
  if (ToSurfaceFlags(aFlags) != DefaultSurfaceFlags()) {
    return DrawResult::BAD_ARGS;
  }

  if (!aContext) {
    return DrawResult::BAD_ARGS;
  }

  if (IsUnlocked() && mProgressTracker) {
    mProgressTracker->OnUnlockedDraw();
  }

  // If we're not using SamplingFilter::GOOD, we shouldn't high-quality scale or
  // downscale during decode.
  uint32_t flags = aSamplingFilter == SamplingFilter::GOOD
                 ? aFlags
                 : aFlags & ~FLAG_HIGH_QUALITY_SCALING;

  DrawableSurface surface =
    LookupFrame(aSize, flags, ToPlaybackType(aWhichFrame));
  if (!surface) {
    // Getting the frame (above) touches the image and kicks off decoding.
    if (mDrawStartTime.IsNull()) {
      mDrawStartTime = TimeStamp::Now();
    }
    return DrawResult::NOT_READY;
  }

  bool shouldRecordTelemetry = !mDrawStartTime.IsNull() &&
                               surface->IsFinished();

  auto result = DrawInternal(Move(surface), aContext, aSize,
                             aRegion, aSamplingFilter, flags);

  if (shouldRecordTelemetry) {
      TimeDuration drawLatency = TimeStamp::Now() - mDrawStartTime;
      Telemetry::Accumulate(Telemetry::IMAGE_DECODE_ON_DRAW_LATENCY,
                            int32_t(drawLatency.ToMicroseconds()));
      mDrawStartTime = TimeStamp();
  }

  return result;
}