Example #1
0
    /// <summary>
    /// 创建本地Item
    /// </summary>
    /// <param name="intScore"></param>
    public void CreateLocalItem(long score)
    {
        int intScore = 0;

        if (score > int.MaxValue)
        {
            intScore = int.MaxValue;
        }
        else
        {
            intScore = (int)score;
        }
        GameDataBean gameData   = GameDataHandler.Instance.manager.GetGameData();
        string       innName    = gameData.GetInnAttributesData().innName;
        string       playerName = gameData.userCharacter.baseInfo.name;
        SteamLeaderboardEntryBean steamLeaderboardEntry = new SteamLeaderboardEntryBean();

        steamLeaderboardEntry.rank  = 0;
        steamLeaderboardEntry.score = intScore;
        try
        {
            //如果steam没有初始化
            steamLeaderboardEntry.steamID = SteamUser.GetSteamID();
        }
        catch
        {
        }

        steamLeaderboardEntry.details = TypeConversionUtil.StringToInt32(innName + "-" + playerName);
        itemRankForLocal.SetData(rankType, steamLeaderboardEntry);
    }
Example #2
0
 /// <summary>
 /// 设置排行榜数据
 /// </summary>
 /// <param name="leaderboardId"></param>
 /// <param name="score"></param>
 /// <param name="details"></param>
 /// <param name="callBack"></param>
 public void SetGetLeaderboardData(ulong leaderboardId, int score, string details, ISteamLeaderboardUpdateCallBack callBack)
 {
     if (!SteamManager.Initialized)
     {
         return;
     }
     if (steamLeaderboard == null)
     {
         steamLeaderboard = new SteamLeaderboardImpl();
     }
     if (details.Length > 64)
     {
         details = details.Substring(0, 64);
     }
     int[] intDetails     = TypeConversionUtil.StringToInt32(details);
     int[] intDetailsData = new int[64];
     intDetails.CopyTo(intDetailsData, 0);
     steamLeaderboard.UpdateLeaderboardScore(leaderboardId, score, intDetailsData, 64, callBack);
 }