41 lines
890 B
C#
41 lines
890 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
|
|
/*
|
|
* USAGE
|
|
*
|
|
* Just put this script into a button that needs
|
|
* to execute the HTTP request, and in the text field
|
|
* write the exact URL needed for the request.
|
|
*
|
|
* */
|
|
|
|
// http://corder.tech/mocha/users/*
|
|
|
|
public class GetLeaderboard : MonoBehaviour
|
|
{
|
|
public Button thisbutton;
|
|
public Text PlayerIDs;
|
|
public Text Usernames;
|
|
public Text Scores;
|
|
|
|
public string request = "http://corder.tech/mocha/users/*";
|
|
|
|
void Start()
|
|
{
|
|
thisbutton.onClick.AddListener (CallGetData);
|
|
}
|
|
|
|
public void CallGetData()
|
|
{
|
|
DisplayAllSeparated(request, PlayerIDs, Usernames, Scores);
|
|
}
|
|
|
|
public void DisplayAllSeparated(string request, Text PlayerIDs, Text Usernames, Text Scores)
|
|
{
|
|
MochaParser parser = new MochaParser ();
|
|
StartCoroutine (parser.DisplayOutputSeparated(request, PlayerIDs, Usernames, Scores));
|
|
}
|
|
}
|
|
|