/// <summary> /// 创建排名Item /// </summary> /// <param name="itemData"></param> protected void CreateRankItem(SteamLeaderboardEntryBean itemData) { GameObject objItem = Instantiate(objRankContainer, objRankModel); ItemTownGuildRankCpt rankItem = objItem.GetComponent <ItemTownGuildRankCpt>(); rankItem.SetData(rankType, itemData); }
private void OnLeaderboardScoresDownloadedForUserList(LeaderboardScoresDownloaded_t itemResult, bool bIOFailure) { if (bIOFailure) { if (mEntriesCallBack != null) { mEntriesCallBack.GetEntriesForUserListFail(SteamLeaderboardFailEnum.GETLIST_FAIL); } return; } SteamLeaderboardEntries_t entriesData = itemResult.m_hSteamLeaderboardEntries; List <SteamLeaderboardEntryBean> listData = new List <SteamLeaderboardEntryBean>(); for (int i = 0; i < itemResult.m_cEntryCount; i++) { LeaderboardEntry_t entry_T; int[] detailsInt = new int[64]; SteamUserStats.GetDownloadedLeaderboardEntry(entriesData, i, out entry_T, detailsInt, 64); SteamLeaderboardEntryBean itemData = new SteamLeaderboardEntryBean { score = entry_T.m_nScore, rank = entry_T.m_nGlobalRank, steamID = entry_T.m_steamIDUser, details = detailsInt }; listData.Add(itemData); } if (mEntriesCallBack != null) { mEntriesCallBack.GetEntriesForUserListSuccess(itemResult.m_hSteamLeaderboard.m_SteamLeaderboard, listData); } }
/// <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); }
public void SetData(RankTypeEnum rankType, SteamLeaderboardEntryBean rankData) { this.rankType = rankType; this.rankData = rankData; SetScore(rankType, rankData.score); SetRank(rankData.rank); string name = TypeConversionUtil.Int32ToString(rankData.details); SetName(name); //开始获取头像和名字 if (rankData.steamID.m_SteamID != 0) { StartCoroutine(SteamHandler.Instance.GetUserInfo(rankData.steamID.m_SteamID + "", this)); } }