1
NGUI 3 Support / Need help integrating GUI Script into NGUI
« on: October 06, 2014, 05:25:09 PM »
hey guys, I was wondering if anyone could help me with a script, it works fine with GUI, but im trying to integrate same script into NGUI.... need help please.
Here's the script:
if(loadedLeaderBoard != null) {
for(int i = 1; i < 10; i++) {
GCScore score = loadedLeaderBoard.GetScore(i, GCBoardTimeSpan.ALL_TIME, diplayCollection);
if(score != null) {
GUI.Label(new Rect(550, 90 + 70 * i, 100, 40), i.ToString(), boardStyle);
GUI.Label(new Rect(650, 90 + 70 * i, 100, 40), score.GetLongScore().ToString() , boardStyle);
GUI.Label(new Rect(750, 90 + 70 * i, 100, 40), score.playerId, boardStyle);
GameCenterPlayerTemplate player = GameCenterManager.GetPlayerById(score.playerId);
if(player != null) {
GUI.Label(new Rect(850, 90 + 70 * i , 100, 40), player.alias, boardStyle);
if(player.avatar != null) {
GUI.DrawTexture(new Rect(900, 75 + 70 * i, 50, 50), player.avatar);
} else {
GUI.Label(new Rect(900, 90 + 70 * i, 100, 40), "no photo ", boardStyle);
}
}
I know i have to declare UILabel(s) and then in OnGUI() i put myUILabel.txt = whatever; I just dont know what to do with the for(int i = 1; i < 10; i++) because that part puts everything in order (its a leaderboard so it HAS to be in order) doesn't have to be up to 10 can be up to 5, but still have no idea how to do it, any help would be greatly appreciated.
PS. help with NGUI texture for player.avatar would also be appreciated
THANK YOU IN ADVANCE!!!
Here's the script:
if(loadedLeaderBoard != null) {
for(int i = 1; i < 10; i++) {
GCScore score = loadedLeaderBoard.GetScore(i, GCBoardTimeSpan.ALL_TIME, diplayCollection);
if(score != null) {
GUI.Label(new Rect(550, 90 + 70 * i, 100, 40), i.ToString(), boardStyle);
GUI.Label(new Rect(650, 90 + 70 * i, 100, 40), score.GetLongScore().ToString() , boardStyle);
GUI.Label(new Rect(750, 90 + 70 * i, 100, 40), score.playerId, boardStyle);
GameCenterPlayerTemplate player = GameCenterManager.GetPlayerById(score.playerId);
if(player != null) {
GUI.Label(new Rect(850, 90 + 70 * i , 100, 40), player.alias, boardStyle);
if(player.avatar != null) {
GUI.DrawTexture(new Rect(900, 75 + 70 * i, 50, 50), player.avatar);
} else {
GUI.Label(new Rect(900, 90 + 70 * i, 100, 40), "no photo ", boardStyle);
}
}
I know i have to declare UILabel(s) and then in OnGUI() i put myUILabel.txt = whatever; I just dont know what to do with the for(int i = 1; i < 10; i++) because that part puts everything in order (its a leaderboard so it HAS to be in order) doesn't have to be up to 10 can be up to 5, but still have no idea how to do it, any help would be greatly appreciated.
PS. help with NGUI texture for player.avatar would also be appreciated
THANK YOU IN ADVANCE!!!
