using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class BagPanel : MonoBehaviour { public GameObject woniuConnect; public GameObject wokeConnect; public GameObject woniuSc; public GameObject wokeSc; public Button woniuBtn; public Button wokeBtn; public GameObject Musk; // Start is called before the first frame update void Start() { woniuBtn.onClick.AddListener(WoniuClick); wokeBtn.onClick.AddListener(WokeClick); Init(); } async void Init() { string response = "";//²âÊÔ response = await web.SendRequest(web.URL + "/snail/user/queryUserBag", "POST","{}", Global.global.CreateHeaders()); Debug.Log(response); bag111 serverRespon111 = JsonConvert.DeserializeObject(response); Debug.Log("±³°ü================================"+serverRespon111.data.slotCount); for (int i = 0; i < serverRespon111.data.snailCount; i++) { GameObject woniuitem = (GameObject)Instantiate(Resources.Load("LLPrefabs/items"),woniuConnect.transform); Debug.Log(1); } for (int i = 0; i < serverRespon111.data.slotCount; i++) { GameObject wokeitem = (GameObject)Instantiate(Resources.Load("LLPrefabs/items"),wokeConnect.transform); } wokeSc.gameObject.SetActive(false); } void WoniuClick() { woniuBtn.transform.SetParent(this.transform); wokeBtn.transform.SetParent(Musk.transform); woniuSc.gameObject.SetActive(true); wokeSc.gameObject.SetActive(false); } void WokeClick() { woniuBtn.transform.SetParent(Musk.transform); wokeBtn.transform.SetParent(this.transform); woniuSc.gameObject.SetActive(false); wokeSc.gameObject.SetActive(true); } // Update is called once per frame void Update() { } }