This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
mochapine64backup/MoCha/Assets/Scripts/GetLeaderboard.cs
2018-04-18 21:49:39 -05:00

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));
}
}