2024-12-08 20:16:04 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class SnaolHouse : MonoBehaviour
|
|
|
|
{
|
|
|
|
public static SnaolHouse Instance { get; private set; }
|
|
|
|
|
|
|
|
public GameObject content;
|
|
|
|
|
|
|
|
public GameObject Successfulcard;
|
|
|
|
public GameObject Nosnailcard;
|
|
|
|
public GameObject Nocard;
|
|
|
|
// Start is called before the first frame update
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Instance == null)
|
|
|
|
{
|
|
|
|
Instance = this;
|
|
|
|
DontDestroyOnLoad(gameObject);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Destroy(gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async void Start()
|
|
|
|
{
|
|
|
|
InitItem();
|
|
|
|
}
|
|
|
|
|
|
|
|
public async void InitItem()
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int i = 0; i < content.transform.childCount; i++)
|
|
|
|
{
|
|
|
|
Destroy(content.transform.GetChild(i).gameObject);
|
|
|
|
}
|
|
|
|
//9.1
|
|
|
|
queryFactory queryFactory = new queryFactory();
|
|
|
|
FactoryList factoryList = new FactoryList();
|
|
|
|
factoryList = await queryFactory.QueryFactoryList();
|
|
|
|
foreach (var FacItem in factoryList.data.dataList)
|
|
|
|
{
|
2024-12-09 12:00:50 +08:00
|
|
|
if(FacItem.snailId>0)
|
2024-12-08 20:16:04 +08:00
|
|
|
{
|
|
|
|
GameObject ob = Instantiate(Successfulcard);
|
|
|
|
ob.transform.SetParent(content.transform);
|
|
|
|
SuccessfulCard successfulCard = ob.GetComponent<SuccessfulCard>();
|
|
|
|
successfulCard.FactoryItem = FacItem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var FacItem in factoryList.data.dataList)
|
|
|
|
{
|
2024-12-09 12:00:50 +08:00
|
|
|
if (FacItem.snailId == 0)
|
2024-12-08 20:16:04 +08:00
|
|
|
{
|
|
|
|
GameObject ob = Instantiate(Nosnailcard);
|
|
|
|
ob.transform.SetParent(content.transform);
|
|
|
|
NoSnailCard noSnail= ob.GetComponent<NoSnailCard>();
|
|
|
|
noSnail.FactoryItem= FacItem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GameObject obj = Instantiate(Nocard);
|
|
|
|
obj.transform.SetParent(content.transform);
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|