using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class GetData : MonoBehaviour
{
	public Button thisbutton;
	public Text objectText;
	public Text username;
	public Text score;

	public bool displayseparated = true;

	public string request = "http://corder.tech/mocha/users/5";

	void Start()
	{
		thisbutton = GetComponent<Button> ();

		if (displayseparated)
		{
			username = GetComponent<Text> ();
			score = GetComponent<Text> ();

			CallGetDataSeparated ();
		}
		else
		{
			objectText = GetComponent<Text> ();

			CallGetData ();
		}
	}

	public void CallGetData()
	{
		DisplayAll(request, objectText);
	}

	public void DisplayAll(string request, Text objectText)
	{
		MochaParser parser = new MochaParser();
		StartCoroutine (parser.DisplayOutput(request, objectText));
	}

	public void CallGetDataSeparated()
	{
		DisplayAllSeparated(request, username, score);
	}

	public void DisplayAllSeparated(string request, Text u, Text s)
	{
	}
}
