80 lines
2.8 KiB
C#
80 lines
2.8 KiB
C#
using BestHTTP;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Common : MonoBehaviour
|
|
{
|
|
[SerializeField] TMP_Dropdown sAnimal;
|
|
[SerializeField] TMP_Dropdown sSuitStyle;
|
|
[SerializeField] TMP_Dropdown sSuitType;
|
|
[SerializeField] TMP_Dropdown sRegion;
|
|
|
|
[SerializeField] TMP_Dropdown fAnimal;
|
|
[SerializeField] TMP_Dropdown fSuitStyle;
|
|
[SerializeField] TMP_Dropdown fSuitType;
|
|
[SerializeField] TMP_Dropdown fRegion;
|
|
// TODO 내부 저장 기능 만들기
|
|
// TODO 버전 기능 까지 만들어서 버전 체크후 새로 다운받아오게 만들기.
|
|
|
|
void Start()
|
|
{
|
|
HTTPRequest httpAnimal = NetworkManager.Instance.CreateRequest<List<CommonData>>("common/animalTypes", new object(), (data) =>
|
|
{
|
|
GameManager.Instance.animalTypes = data;
|
|
List<string> strings = new List<string>();
|
|
for(int n = 0; n < data.Count; n++)
|
|
{
|
|
strings.Add(data[n].code_nm);
|
|
}
|
|
sAnimal.AddOptions(strings);
|
|
fAnimal.AddOptions(strings);
|
|
|
|
}, null, HTTPMethods.Get);
|
|
HTTPRequest httpSuitStyle = NetworkManager.Instance.CreateRequest<List<CommonData>>("common/suitStyle", new object(), (data) =>
|
|
{
|
|
GameManager.Instance.suitStyle = data;
|
|
List<string> strings = new List<string>();
|
|
for (int n = 0; n < data.Count; n++)
|
|
{
|
|
strings.Add(data[n].code_nm);
|
|
}
|
|
sSuitStyle.AddOptions(strings);
|
|
fSuitStyle.AddOptions(strings);
|
|
}, null, HTTPMethods.Get);
|
|
HTTPRequest httpSuitType = NetworkManager.Instance.CreateRequest<List<CommonData>>("common/suitType", new object(), (data) =>
|
|
{
|
|
GameManager.Instance.suitType = data;
|
|
List<string> strings = new List<string>();
|
|
for (int n = 0; n < data.Count; n++)
|
|
{
|
|
strings.Add(data[n].code_nm);
|
|
}
|
|
sSuitType.AddOptions(strings);
|
|
fSuitType.AddOptions(strings);
|
|
}, null, HTTPMethods.Get);
|
|
HTTPRequest httpRegion = NetworkManager.Instance.CreateRequest<List<CommonData>>("common/region", new object(), (data) =>
|
|
{
|
|
GameManager.Instance.region = data;
|
|
List<string> strings = new List<string>();
|
|
for (int n = 0; n < data.Count; n++)
|
|
{
|
|
strings.Add(data[n].code_nm);
|
|
}
|
|
sRegion.AddOptions(strings);
|
|
fRegion.AddOptions(strings);
|
|
}, null, HTTPMethods.Get);
|
|
httpAnimal.Send();
|
|
httpSuitStyle.Send();
|
|
httpSuitType.Send();
|
|
httpRegion.Send();
|
|
}
|
|
|
|
public class CommonData
|
|
{
|
|
public string code_nm;
|
|
public string code_id;
|
|
}
|
|
}
|