我一直在尋找幾個小時,我無法在互聯網上找到答案...希望你們能幫助我。Android Google Play遊戲服務startQuickGame,undefined makeBasicRoomConfigBuilder()
我想要實現在谷歌Play遊戲服務快速遊戲: https://developers.google.com/games/services/android/realtimeMultiplayer
我也跟着在谷歌網站上的說明。在我的應用程序中使用Google帳戶登錄成功。現在我想實現一個簡單的遊戲,但有一條錯誤信息:
makeBasicRoomConfigBuilder();
的方法makeBasicRoomConfigBuilder();是未定義類型GameActivity
下面是我的一些代碼:
import com.android.vending.billing.IInAppBillingService;
import com.google.android.gms.ads.*;
import com.google.android.gms.common.api.*;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.multiplayer.realtime.RoomConfig;
import com.google.example.games.basegameutils.BaseGameActivity;
public class GameActivity extends BaseGameActivity {
private static InterstitialAd interstitial;
private AdView adView;
private int FieldWidth;
private int FieldHeight;
private EditText playerEdit;
private Button settingsSave;
private GameView theGameView;
private static SoundPool soundPool;
private static HashMap<Integer, Integer> soundsMap;
IInAppBillingService mService;
private Sql2Player SqlArray2Player;
private Sql3Player SqlArray3Player;
private SqlQPlayer SqlArrayQPlayer;
public ConnectivityManager conMgr;
public GameLoopThread theGameLoopThread;
private void startQuickGame() {
// auto-match criteria to invite one random automatch opponent.
// You can also specify more opponents (up to 3).
Bundle am = RoomConfig.createAutoMatchCriteria(1, 1, 0);
// build the room config:
RoomConfig.Builder roomConfigBuilder = makeBasicRoomConfigBuilder();
roomConfigBuilder.setAutoMatchCriteria(am);
RoomConfig roomConfig = roomConfigBuilder.build();
// create room:
Games.RealTimeMultiplayer.create(getApiClient(), roomConfig);
}
....
任何想法?
謝謝!