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/GetData.cs

55 lines
977 B
C#
Raw Normal View History

2018-04-17 14:16:10 -05:00
using UnityEngine;
using System.Collections;
2018-04-17 15:13:19 -05:00
using UnityEngine.UI;
2018-04-17 14:16:10 -05:00
2018-04-17 15:13:19 -05:00
public class GetData : MonoBehaviour
2018-04-17 14:16:10 -05:00
{
2018-04-18 21:49:39 -05:00
public Button thisbutton;
public Text objectText;
public Text username;
public Text score;
2018-04-17 14:16:10 -05:00
public bool displayseparated = true;
public string request = "http://corder.tech/mocha/users/5";
2018-04-18 18:15:11 -05:00
2018-04-18 21:49:39 -05:00
void Start()
2018-04-18 18:15:11 -05:00
{
2018-04-18 21:49:39 -05:00
thisbutton = GetComponent<Button> ();
2018-04-18 18:15:11 -05:00
if (displayseparated)
{
username = GetComponent<Text> ();
score = GetComponent<Text> ();
CallGetDataSeparated ();
}
else
{
objectText = GetComponent<Text> ();
CallGetData ();
}
2018-04-18 18:15:11 -05:00
}
2018-04-18 21:49:39 -05:00
public void CallGetData()
2018-04-18 18:15:11 -05:00
{
2018-04-18 21:49:39 -05:00
DisplayAll(request, objectText);
2018-04-18 18:15:11 -05:00
}
2018-04-18 21:49:39 -05:00
public void DisplayAll(string request, Text objectText)
2018-04-18 18:15:11 -05:00
{
2018-04-18 21:49:39 -05:00
MochaParser parser = new MochaParser();
StartCoroutine (parser.DisplayOutput(request, objectText));
2018-04-18 18:15:11 -05:00
}
public void CallGetDataSeparated()
{
DisplayAllSeparated(request, username, score);
}
public void DisplayAllSeparated(string request, Text u, Text s)
{
}
2018-04-17 14:16:10 -05:00
}