[Unity] 게임 개발
[Unity 3D] 포스트 방식 디비 연동
용쨔이
2020. 7. 22. 15:37
반응형
string LogoutUserURL = "http://dinootoko.dothome.co.kr/logout.php";
string VictoryURL = "http://dinootoko.dothome.co.kr/Victory.php";
string DefeatURL = "http://dinootoko.dothome.co.kr/Defeat.php";
디비에 등록된 php파일을 string 형 주소로 저장
IEnumerator LogOutUser(string ID)
{
WWWForm form = new WWWForm();
form.AddField("IdPost", ID);
WWW www = new WWW(LogoutUserURL, form);
yield return www;
Debug.Log("www.text :" + www.text);
}
IEnumerator VictoryUser(string ID)
{
WWWForm form = new WWWForm();
form.AddField("IdPost", ID);
WWW www = new WWW(VictoryURL, form);
yield return www;
Debug.Log("www.text :" + www.text);
}
IEnumerator DefeatUser(string ID)
{
WWWForm form = new WWWForm();
form.AddField("IdPost", ID);
WWW www = new WWW(DefeatURL, form);
yield return www;
Debug.Log("www.text :" + www.text);
}
그 후 코루틴으로 Post 가 성공하면 www.text를 받아오는 코루틴을 작성
코루틴을 적재적소 원하는 함수에 넣어 사용.
반응형