当前位置: 首页 > 软件库 > 游戏/娱乐 > >

android-basic-samples

Google Play game services - Android samples
授权协议 Apache-2.0 License
开发语言 C/C++
所属分类 游戏/娱乐
软件类型 开源软件
地区 不详
投 递 者 谷涵容
操作系统 未知
开源组织
适用人群 未知
 软件概览

Google Play game services - Android Samples

Copyright (C) 2014 Google Inc.

Contents

These are the Android samples for Google Play game services.

  • CollectAllTheStars2. Demonstrates how to use the Snapshots feature to save game data. The sample signs the user in, synchronizes their data from a named Snapshot, then updates the UI to reflect the game state saved in the Snapshot.

  • TypeANumber. Demonstrates how to use leaderboards, achievements, events, and friends. In this exciting game, you type the score you think you deserve. But wait! There is a twist. If you are playing in easy mode, you get the score you requested. However, if you are playing in hard mode, you only get half! (tough game, we know). You can also check how your friends perform in this game by checking out social leaderboards.

How to run a sample

  1. Set up the project in the Developer Console by following these instructions.Note your package name and the application ID of the project!

  2. For the Type a Number sample, you need to create leaderboards/achievements.(You can see the ones that the sample needs in its res/values/ids.xml file.)You can create them two ways:

    1. Add them via the Developer console.
    2. Use this utility, which will automatically create them for you.

Building using Android Studio...

  1. Open Android Studio and launch the Android SDK manager from it (Tools | Android | SDK Manager)
  2. Ensure the following components are installed and updated to the latest version.
    1. Android SDK Platform-Tools
    2. Android Support Repository
    3. Google Repository
  3. Return to Android Studio and select Open an existing Android Studio project
  4. Select the android-basic-samples directory.

Modify IDs, compile and run

To set up a sample:

  1. Change the applicationId in the build.gradle file to your own package name (ie - com.example.package.name)(the same one you registered in Developer Console!). You will have to updatethe build.gradle file for each sample you want to run. There is no need toedit the AndroidManifest.xml file.
  2. In the Developer console, select a resource type(Achievements, Events, Leaderboards) and click "Get Resources". Copy thecontents from the console and replace the contents of res/values/ids.xml.
    1. If you are running Android Studio, check the TODO window to see if there are any remaining tasks.
  3. Compile and run.

IMPORTANT: make sure to sign your apk with the same certificateas the one whose fingerprint you configured on Developer Console, otherwiseyou will see errors.

IMPORTANT: if you are testing an unpublished game, make sure that the account you intendto sign in with (the account on the test device) is listed as a tester in theproject on your Developer Console setup (check the list in the "Testing"section), otherwise the server will act as though your project did not exist andreturn errors like 'Failed to sign in. Please check your network connection and try again.'

Building

To build the samples after you have applied the changes above, you can use the build/run option in Android Studio, or build directly from the command line if you prefer.

IMPORTANT Ensure you have set the ANDROID_HOME environment variable.

cd /path/to/android-basic-samples
export ANDROID_HOME = /path/to/android/sdk
./gradlew build

Support

First of all, take a look at our troubleshooting guide. Most setup issues can be solved by following this guide.

If your question is not answered by the troubleshooting guide, we encourage you to post your question to stackoverflow.com. Our team answers questions there regularly.

Samples written by Bruno Oliveira with contributions from Wolff.* Feel free to add us to your circles on Google Plus and pester us to fix stuff that's broken or answer a question on stackoverflow :-)

Special Thanks

  • To ligi for contributing the initial Gradle build files
  • To bechhansen for fixing a bug in GameHelper where the turn-based match was being lost when a non-Games client connected.
 相关资料
  • Random.boolean( min?, max?, current? ) Random.boolean() Random.boolean( min, max, current ) 返回一个随机的布尔值。 min 可选。 指示参数 current 出现的概率。概率计算公式为 min / (min + max)。该参数的默认值为 1,即有 50% 的概率返回参数 current。 max 可选。

  • 描述 (Description) 标准菜单语法用于向下钻取菜单。 对于每个嵌套菜单,属性data-drilldown都包含在根《ul》和.menu中。 例子 (Example) 以下示例演示了在Foundation中使用向下钻取下拉菜单 - <!DOCTYPE html> <html> <head> <title>Foundation Template</title>

  • A simple implementation of the @handsontable/vue component.import Vue from 'vue'; import { HotTable } from '@handsontable/vue'; import Handsontable from 'handsontable'; new Vue({ el: '#example1', data

  • An implementation of the @handsontable/angular wrapper.// app.component.ts import { Component } from '@angular/core'; import * as Handsontable from 'handsontable'; @Component({ selector: 'app-root', t

  • An implementation of the @handsontable/react wrapper.import React from 'react'; import ReactDOM from 'react-dom'; import { HotTable } from '@handsontable/react'; import Handsontable from 'handsontable

  • Basicauth 中间件提供了Http Basic认证,是一个 Tango 的中间件。 安装 go get github.com/tango-contrib/basicauth 示例 type AuthAction struct {} func (a *AuthAction) Get() string { return "200" } func main() { tg := ta