Пример #1
0
void Player::OnMouseMove(UI::MouseEventArgs* args)
{
	LDraw::PointD point = args->GetPosition(this);//ScreenToClient(evt->get_ScreenX(), evt->get_ScreenY());

	LDraw::Matrix3f* transform = LDraw::Matrix3f::GetScale(1/20.0, 1/20.0);
	PlacedCharacter* placed = HitTest(m_movie, point, transform);

	ButtonCharacter* button;
	if (placed)
	{
		button = dynamic_cast<ButtonCharacter*>(placed->m_character);
	}

	if (m_OverButton != placed)
	{
		if (m_OverButton != NULL)
		{
			ExecuteScripts(m_OverButton, (ButtonCharacter*)m_OverButton->m_character, CondOverUpToIdle);
		}

	//	if (button != NULL)
		{
			m_OverButton = placed;
		}

		if (m_OverButton != NULL)
		{
			ExecuteScripts(m_OverButton, (ButtonCharacter*)m_OverButton->m_character, CondIdleToOverUp);
		}

		Invalidate();
	}
}
Пример #2
0
nsresult
nsDOMWorkerScriptLoader::LoadScripts(JSContext* aCx,
                                     const nsTArray<nsString>& aURLs,
                                     PRBool aForWorker)
{
  NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
  NS_ASSERTION(aCx, "Null context!");

  mTarget = NS_GetCurrentThread();
  NS_ASSERTION(mTarget, "This should never be null!");

  if (mCanceled) {
    return NS_ERROR_ABORT;
  }

  mForWorker = aForWorker;

  mScriptCount = aURLs.Length();
  if (!mScriptCount) {
    return NS_ERROR_INVALID_ARG;
  }

  // Do all the memory work for these arrays now rather than checking for
  // failures all along the way.
  PRBool success = mLoadInfos.SetCapacity(mScriptCount);
  NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);

  // Need one runnable per script and then an extra for the finished
  // notification.
  success = mPendingRunnables.SetCapacity(mScriptCount + 1);
  NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);

  for (PRUint32 index = 0; index < mScriptCount; index++) {
    ScriptLoadInfo* newInfo = mLoadInfos.AppendElement();
    NS_ASSERTION(newInfo, "Shouldn't fail if SetCapacity succeeded above!");

    newInfo->url.Assign(aURLs[index]);
    if (newInfo->url.IsEmpty()) {
      return NS_ERROR_INVALID_ARG;
    }

    success = newInfo->scriptObj.Hold(aCx);
    NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
  }

  // Don't want timeouts, etc., from queuing up while we're waiting on the
  // network or compiling.
  AutoSuspendWorkerEvents aswe(this);

  nsresult rv = DoRunLoop(aCx);
  if (NS_FAILED(rv)) {
    return rv;
  }

  // Verify that all scripts downloaded and compiled.
  rv = VerifyScripts(aCx);
  if (NS_FAILED(rv)) {
    return rv;
  }

  rv = ExecuteScripts(aCx);
  if (NS_FAILED(rv)) {
    return rv;
  }

  return NS_OK;
}