2024-11-29 09:47:47 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class MaterialPanel : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD>")]
|
|
|
|
|
public GameObject materialPrefab; // <20><>Ʒ<EFBFBD><C6B7>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>
|
|
|
|
|
public Transform materialContent; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public Button addBtn; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
|
|
|
|
public Button subtractBtn; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Ʒ<EFBFBD><C6B7>
|
|
|
|
|
private List<MaterialItem> materialItems = new List<MaterialItem>();
|
2024-12-01 04:58:16 +08:00
|
|
|
|
public JSONReader jsonReader1;
|
2024-12-25 17:07:27 +08:00
|
|
|
|
public WarningPopPanel warningPopPanel1;
|
2024-11-29 09:47:47 +08:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
SetMaterialPrefab();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ƷԤ<C6B7><D4A4><EFBFBD>壬<EFBFBD><E5A3AC>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>
|
|
|
|
|
public void SetMaterialPrefab()
|
|
|
|
|
{
|
2024-12-01 04:58:16 +08:00
|
|
|
|
foreach (var materialData in jsonReader1.matialDictionary)
|
2024-11-29 09:47:47 +08:00
|
|
|
|
{
|
2024-12-01 04:58:16 +08:00
|
|
|
|
GameObject item = GameObject.Instantiate<GameObject>(materialPrefab, materialContent);
|
|
|
|
|
MaterialItem materialItem = item.GetComponent<MaterialItem>();
|
|
|
|
|
materialItem.materialNameText.text = materialData.Value.Note;
|
2024-12-07 16:18:15 +08:00
|
|
|
|
materialItem.materialId = materialData.Key.ToString();
|
|
|
|
|
materialItems.Add(materialItem);
|
2024-12-01 04:58:16 +08:00
|
|
|
|
}
|
2024-11-29 09:47:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ
|
|
|
|
|
public void SubmitMaterialData()
|
|
|
|
|
{
|
2024-12-12 15:21:07 +08:00
|
|
|
|
createTemplateInfo.Instance.auth_CreateTemplate.materialList = new List<MaterialList>();
|
2024-11-29 09:47:47 +08:00
|
|
|
|
foreach (var materialItem in materialItems)
|
|
|
|
|
{
|
2024-12-07 16:18:15 +08:00
|
|
|
|
MaterialList materialList = new MaterialList();
|
|
|
|
|
materialList.materialId = materialItem.materialId;
|
|
|
|
|
materialList.num = materialItem.materialNum;
|
|
|
|
|
createTemplateInfo.Instance.auth_CreateTemplate.materialList.Add(materialList);
|
2024-11-29 09:47:47 +08:00
|
|
|
|
}
|
2024-12-25 17:07:27 +08:00
|
|
|
|
warningPopPanel1.OpenPanel("<22>ύ<EFBFBD>ɹ<EFBFBD>");
|
2024-11-29 09:47:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|