// // Copyright (C) 2014 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #if UNITY_ANDROID namespace GooglePlayGames { using System; using UnityEngine.SocialPlatforms; /// /// Represents a Google Play Games score that can be sent to a leaderboard. /// public class PlayGamesScore : IScore { private string mLbId = null; private long mValue = 0; private ulong mRank = 0; private string mPlayerId = string.Empty; private string mMetadata = string.Empty; private DateTime mDate = new DateTime(1970, 1, 1, 0, 0, 0); internal PlayGamesScore(DateTime date, string leaderboardId, ulong rank, string playerId, ulong value, string metadata) { this.mDate = date; mLbId = leaderboardID; this.mRank = rank; this.mPlayerId = playerId; this.mValue = (long) value; this.mMetadata = metadata; } /// /// Reports the score. Equivalent to . /// public void ReportScore(Action callback) { PlayGamesPlatform.Instance.ReportScore(mValue, mLbId, mMetadata, callback); } /// /// Gets or sets the leaderboard id. /// /// /// The leaderboard id. /// public string leaderboardID { get { return mLbId; } set { mLbId = value; } } /// /// Gets or sets the score value. /// /// /// The value. /// public long value { get { return mValue; } set { mValue = value; } } /// /// Not implemented. Returns Jan 01, 1970, 00:00:00 /// public DateTime date { get { return mDate; } } /// /// Not implemented. Returns the value converted to a string, unformatted. /// public string formattedValue { get { return mValue.ToString(); } } /// /// Not implemented. Returns the empty string. /// public string userID { get { return mPlayerId; } } /// /// Not implemented. Returns 1. /// public int rank { get { return (int) mRank; } } /// /// Gets the metaData (scoreTag). /// /// /// The metaData. /// public string metaData { get { return mMetadata; } } } } #endif