當前位置: 首頁>>代碼示例>>Java>>正文


Java Invitation類代碼示例

本文整理匯總了Java中com.google.android.gms.games.multiplayer.Invitation的典型用法代碼示例。如果您正苦於以下問題:Java Invitation類的具體用法?Java Invitation怎麽用?Java Invitation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Invitation類屬於com.google.android.gms.games.multiplayer包,在下文中一共展示了Invitation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
@Override
public void onConnected(Bundle connectionHint) {
  Log.d(TAG, "onConnected() called. Sign in successful!");

  Log.d(TAG, "Sign-in succeeded.");

  // register listener so we are notified if we receive an invitation to play
  // while we are in the game
  Games.Invitations.registerInvitationListener(mGoogleApiClient, this);

  if (connectionHint != null) {
    Log.d(TAG, "onConnected: connection hint provided. Checking for invite.");
    Invitation inv = connectionHint
        .getParcelable(Multiplayer.EXTRA_INVITATION);
    if (inv != null && inv.getInvitationId() != null) {
      // retrieve and cache the invitation ID
      Log.d(TAG,"onConnected: connection hint has a room invite!");
      acceptInviteToRoom(inv.getInvitationId());
      return;
    }
  }
  switchToMainScreen();

}
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:25,代碼來源:Example.java

示例2: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
@Override
public void onConnected(Bundle connectionHint) {
	Timber.d("Google login successful");

	// check if pending invitation
	Invitation invitation = null;
	if (connectionHint != null) {
		invitation = connectionHint.getParcelable(Multiplayer.EXTRA_INVITATION);
	}
	spinnerUtils.hideSpinner();

	// check for tutorial
	MenuFragment fragment = MenuFragment.createInstance(invitation);
	if (tutorialUtils.shouldShowTutorial()) {
		tutorialUtils.onShowTutorial();
		onTutorialStart();
		this.menuFragment = fragment;
	} else {
		showFragment(fragment, true);
	}
}
 
開發者ID:FauDroids,項目名稱:TeamBlocks,代碼行數:22,代碼來源:MainActivity.java

示例3: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
@Override
public void onConnected(Bundle bundle) {
    Log.i(TAG, "onConnected: sign-in successful.");

    // This is *NOT* required; if you do not register a handler for
    // invitation events, you will get standard notifications instead.
    // Standard notifications may be preferable behavior in many cases.
    Games.Invitations.registerInvitationListener(mGoogleApiClient, this);

    // Get invitation from Bundle
    if (bundle != null) {
        Invitation invitation = bundle.getParcelable(Multiplayer.EXTRA_INVITATION);
        if (invitation != null) {
            onInvitationReceived(invitation);
        }
    }

    updateViewVisibility();
}
 
開發者ID:playgameservices,項目名稱:8bitartist,代碼行數:20,代碼來源:DrawingActivity.java

示例4: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
public final void onConnected(Bundle paramBundle)
{
  if (paramBundle != null)
  {
    Invitation localInvitation = (Invitation)paramBundle.getParcelable("invitation");
    if ((localInvitation != null) && (localInvitation.getInvitationId() != null))
    {
      this.ʽ = localInvitation;
      this.ʽ.getInvitationId();
    }
    this.゙ = ((TurnBasedMatch)paramBundle.getParcelable("turn_based_match"));
  }
  this.ʻ = null;
  this.ᐝ = true;
  this.ـ = false;
  this.ˊ = false;
  if (this.ͺ != null)
  {
    this.ͺ.onSignInSucceeded();
    return;
  }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:23,代碼來源:Ô¨ª.java

示例5: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
開發者ID:AlexShafir,項目名稱:google-play-game-services-ane,代碼行數:24,代碼來源:GameHelper.java

示例6: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
@Override
public void onConnected(Bundle connectionHint) {
    Log.d(LOG_TAG, "onConnected() called. Sign in successful!");
    Log.d(LOG_TAG, "Sign-in succeeded.");

    // register listener so we are notified if we receive an invitation to play
    // while we are in the game
    Games.Invitations.registerInvitationListener(mGoogleApiClient, this);

    if (connectionHint != null) {
        Log.d(LOG_TAG, "onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            Log.d(LOG_TAG,"onConnected: connection hint has a room invite!");
            acceptInviteToRoom(inv.getInvitationId());
        }
    }
}
 
開發者ID:TylerCarberry,項目名稱:2048-Battles,代碼行數:21,代碼來源:MultiplayerActivity.java

示例7: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
開發者ID:freshplanet,項目名稱:ANE-Google-Play-Game-Services,代碼行數:25,代碼來源:GameHelper.java

示例8: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected! client=" + mClientCurrentlyConnecting);

    // Mark the current client as connected
    mConnectedClients |= mClientCurrentlyConnecting;
    debugLog("Connected clients updated to: " + mConnectedClients);

    // If this was the games client and it came with an invite, store it for
    // later retrieval.
    if (mClientCurrentlyConnecting == CLIENT_GAMES && connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint.getParcelable(GamesClient.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // accept invitation
            debugLog("onConnected: connection hint has a room invite!");
            mInvitationId = inv.getInvitationId();
            debugLog("Invitation ID: " + mInvitationId);
        }
    }

    // connect the next client in line, if any.
    connectNextClient();
}
 
開發者ID:dbaelz,項目名稱:Secludedness,代碼行數:26,代碼來源:GameHelper.java

示例9: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
/** Called when we successfully obtain a connection to a client. */
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected! client=" + mClientCurrentlyConnecting);

    // Mark the current client as connected
    mConnectedClients |= mClientCurrentlyConnecting;
    debugLog("Connected clients updated to: " + mConnectedClients);

    // If this was the games client and it came with an invite, store it for
    // later retrieval.
    if (mClientCurrentlyConnecting == CLIENT_GAMES && connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint.getParcelable(GamesClient.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // accept invitation
            debugLog("onConnected: connection hint has a room invite!");
            mInvitationId = inv.getInvitationId();
            debugLog("Invitation ID: " + mInvitationId);
        }
    }

    // connect the next client in line, if any.
    connectNextClient();
}
 
開發者ID:d3alek,項目名稱:TheHunt---Interactive-graphical-platform-for-AI-Experiments,代碼行數:25,代碼來源:GameHelper.java

示例10: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:34,代碼來源:GameHelper.java

示例11: onConnected

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
/**
 * Called when we successfully obtain a connection to a client.
 */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:36,代碼來源:GameHelper.java

示例12: handleInvitationInboxResult

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
private void handleInvitationInboxResult(int response, Intent data) {
    if (response != Activity.RESULT_OK) {
        Log.w(TAG, "*** invitation inbox UI cancelled, " + response);
        switchToMainScreen();
        return;
    }

    Log.d(TAG, "Invitation inbox UI succeeded.");
    Invitation inv = data.getExtras().getParcelable(Multiplayer.EXTRA_INVITATION);

    // accept invitation
    acceptInviteToRoom(inv.getInvitationId());
}
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:14,代碼來源:Example.java

示例13: onInvitationReceived

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
@Override
public void onInvitationReceived(Invitation invitation) {
    // We got an invitation to play a game! So, store it in
    // mIncomingInvitationId
    // and show the popup on the screen.
    mIncomingInvitationId = invitation.getInvitationId();
    ((TextView) findViewById(R.id.incoming_invitation_text)).setText(
            invitation.getInviter().getDisplayName() + " " +
                    getString(R.string.is_inviting_you));
    switchToScreen(mCurScreen); // This will show the invitation popup
}
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:12,代碼來源:Example.java

示例14: onInvitationReceived

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
@Override
public void onInvitationReceived(Invitation invitation) {
    // We got an invitation to play a game! So, store it in
    // incomingInvitationId
    // and show the popup on the screen.
    Log.d(TAG, "onInvitationReceived: ");
    incomingInvitationId = invitation.getInvitationId();
    Toast.makeText(activity, invitation.getInviter().getDisplayName() + " has invited you. ", Toast.LENGTH_LONG).show();
}
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:10,代碼來源:AndroidNetworkService.java

示例15: onInvitationReceived

import com.google.android.gms.games.multiplayer.Invitation; //導入依賴的package包/類
@Override
public void onInvitationReceived(@NonNull Invitation invitation) {
    // We got an invitation to play a game! So, store it in
    // mIncomingInvitationId
    // and show the popup on the screen.
    mIncomingInvitationId = invitation.getInvitationId();
    showPopUpNotification(true,
            invitation.getInviter().getDisplayName());
}
 
開發者ID:Augugrumi,項目名稱:SpaceRace,代碼行數:10,代碼來源:AbsRoomActivity.java


注:本文中的com.google.android.gms.games.multiplayer.Invitation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。