2014-03-25 3 views
2

Google Play 게임 서비스를 사용하여 멀티 플레이어 게임을 제작할 계획입니다. 게임 서비스를 플레이하고 맞춤 스코어 저장

  • 총 내가 리더를 원하는
  • 점수

    • 일치는
    • 일치는 일치에
    • 가장 높은 점수를 획득했다 :

      나는 각 사용자에 대해 다음을 저장할 최고 점수에 대한 내림차순으로 데이터를 표시합니다. 이것이 가능한가? 다중 속성 점수를 제출하고 지도력위원회에 표시 할 수 있습니까? 플레이 | | 최고 | | 총

      사용자 1 수상

      사용자가 | :

      형식은 다소 등이 될 수있다 10 | 8 | 250 | 5000

      사용자 2 | 20 | 12 | 225 | 5400

    답변

    2

    가능한 한 개발 시간이 조금 걸리지는 않습니다.

    구글은이 점수를 저장하기위한 리더에게 그 문제를 사용하여 저장하는 두 가지가 있습니다 Google Developer

    공개 추상 무효 submitScore에서

    을 (GoogleApiClient apiClient, 문자열 leaderboardId, 긴 점수, 문자열 scoreTag)

    Submit a score to a leaderboard for the currently signed in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score for the same player. 
    
    This form of the API is a fire-and-forget form. Use this if you do not need to be notified of the results of submitting the score, though note that the update may not be sent to the server until the next sync. 
    
    The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats: 
    
    Fixed-point: score represents a raw value, and will be formatted based on the number of decimal places configured. A score of 1000 would be formatted as 1000, 100.0, or 10.00 for 0, 1, or 2 decimal places. 
    Time: score represents an elapsed time in milliseconds. The value will be formatted as an appropriate time value. 
    Currency: score represents a value in micro units. For example, in USD, a score of 100 would display as $0.0001, while a score of 1000000 would display as $1.00 
    

    은 자세한 내용은, 스코어 보드 개념을 참조하시기 바랍니다.

    Required API: API 
    Required Scopes: SCOPE_GAMES 
    
    Parameters 
    apiClient The GoogleApiClient to service the call. 
    leaderboardId The leaderboard to submit the score to. 
    score The raw score value. 
    scoreTag Optional metadata about this score. The value may contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986. 
    

    따라서 long 및 String을 사용하여 저장할 정보를 저장할 수 있습니다. 그러나 이는 또한 Google 리더 보드 디스플레이 방법을 사용할 수 없음을 의미합니다. 너에게 지어지는 모든 습관이어야한다.

    예를 들어, 점수를 저장/검색 할 때 섹션으로 길게 나눕니다. Long.MAX_VALUE = 9223372036854775807이므로 Score/Won/Played (점수 값은 여전히 ​​Google의 검색 시스템을 통해 플레이어를 정확하게 정렬 함)로 나눌 수 있으며 문자열에 최고 점수를 저장할 수도 있습니다. 당신의 최고는 같은 점수 분류 (그 총을 원하는 실제로 어떻게하면 지금

    User2 54000001200020 "225" 
    User1 50000000800010 "250" 
    

    : 당신이 점수를 원시 점수를 검색하고 scoreTag는 다음과 같이 저장 될 수 그래서

    를 (어떤 다른 당신은 할 수 있습니다) 나는 여기에 표시한다), 그 다음 그것을 앞쪽에 붙인다.

    그럼 각 점수 부분을 떼어 내고 표시 형식을 지정해야합니다.

    +1

    나는 이것이 유일한 방법이라고 두려워했습니다. 확인해 주셔서 감사합니다. 오히려 태그를 사용하여 CSV 문자열을 저장하고 값을 정렬하여 오래 사용할 수 있습니다. – PravinCG

    관련 문제