Синтаксис:
Используется csharp
private Coroutine currentCoroutine;
void Start()
{
string key = "Nick";
NameUser = PlayerPrefs.GetString(key, userName);
string key1 = "Email";
NameEmail = PlayerPrefs.GetString(key1, userEmail);
_img = GetComponent<UnityEngine.UI.Image>();
button_L.gameObject.SetActive(false);
}
public void ButtonPrefs_P()
{
if (line >= 0)
{
button_L.gameObject.SetActive(true);
}
line += 1;
StartCoroutine(imagesText());
Debug.Log("Проверка URL из базы!" + line);
}
public void ButtonPrefs_L()
{
if (line <= 1)
{
button_L.gameObject.SetActive(false);
}
line -= 1;
StartCoroutine(imagesText());
likeButton.gameObject.SetActive(true);
}
public void ButtonPrefs_Like()
{
StartCoroutine(LoadLike());
likeButton.gameObject.SetActive(false);
}
IEnumerator imagesText() // Получаем URL изображения
{
WWWForm ImageText = new WWWForm();
ImageText.AddField("name", NameUser);
ImageText.AddField("email", NameEmail);
using (UnityWebRequest www = UnityWebRequest.Post("https://*****/*****.php", ImageText))
{
yield return http://www.SendWebRequest();
if (http://www.isNetworkError || http://www.isHttpError)
{
Debug.Log(http://www.error);
}
else
{
string responseText = http://www.downloadHandler.text;
if (responseText.StartsWith("|"))
{
string[] dataChunks = responseText.Split('|');
var result = dataChunks[line];
string[] arr1 = result.Split(',');
var nomerUrl = arr1[0];
var result1 = arr1[1];
stroka_a.text = result1.ToString();
var like = arr1[2];
int likeuser = int.Parse(like.Replace(" ", string.Empty));
StartCoroutine(LoadFromWeb(nomerUrl));
Debug.Log("Проверка URL из базы!" + nomerUrl);
if (currentCoroutine != null)
{
yield break;
StopCoroutine(currentCoroutine);
currentCoroutine = null;
}
}
}
}
}
}
void Start()
{
string key = "Nick";
NameUser = PlayerPrefs.GetString(key, userName);
string key1 = "Email";
NameEmail = PlayerPrefs.GetString(key1, userEmail);
_img = GetComponent<UnityEngine.UI.Image>();
button_L.gameObject.SetActive(false);
}
public void ButtonPrefs_P()
{
if (line >= 0)
{
button_L.gameObject.SetActive(true);
}
line += 1;
StartCoroutine(imagesText());
Debug.Log("Проверка URL из базы!" + line);
}
public void ButtonPrefs_L()
{
if (line <= 1)
{
button_L.gameObject.SetActive(false);
}
line -= 1;
StartCoroutine(imagesText());
likeButton.gameObject.SetActive(true);
}
public void ButtonPrefs_Like()
{
StartCoroutine(LoadLike());
likeButton.gameObject.SetActive(false);
}
IEnumerator imagesText() // Получаем URL изображения
{
WWWForm ImageText = new WWWForm();
ImageText.AddField("name", NameUser);
ImageText.AddField("email", NameEmail);
using (UnityWebRequest www = UnityWebRequest.Post("https://*****/*****.php", ImageText))
{
yield return http://www.SendWebRequest();
if (http://www.isNetworkError || http://www.isHttpError)
{
Debug.Log(http://www.error);
}
else
{
string responseText = http://www.downloadHandler.text;
if (responseText.StartsWith("|"))
{
string[] dataChunks = responseText.Split('|');
var result = dataChunks[line];
string[] arr1 = result.Split(',');
var nomerUrl = arr1[0];
var result1 = arr1[1];
stroka_a.text = result1.ToString();
var like = arr1[2];
int likeuser = int.Parse(like.Replace(" ", string.Empty));
StartCoroutine(LoadFromWeb(nomerUrl));
Debug.Log("Проверка URL из базы!" + nomerUrl);
if (currentCoroutine != null)
{
yield break;
StopCoroutine(currentCoroutine);
currentCoroutine = null;
}
}
}
}
}
}