74 lines
2.0 KiB
C#
74 lines
2.0 KiB
C#
|
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)
|
||
|
{
|
||
|
if(FacItem.contractId <= 6 && FacItem.contractId >= 3)
|
||
|
{
|
||
|
GameObject ob = Instantiate(Successfulcard);
|
||
|
ob.transform.SetParent(content.transform);
|
||
|
SuccessfulCard successfulCard = ob.GetComponent<SuccessfulCard>();
|
||
|
successfulCard.FactoryItem = FacItem;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
foreach (var FacItem in factoryList.data.dataList)
|
||
|
{
|
||
|
if (FacItem.contractId > 6 || FacItem.contractId < 3)
|
||
|
{
|
||
|
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()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
}
|