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-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;
|
|
|
|
|
Debug.Log(materialData.Value.Note);
|
|
|
|
|
//Debug.Log("$$$$$$$$$$$$$$" + dutyItem.dutyNameText.text);
|
|
|
|
|
//materialItems.Add(item);// <20><>ÿ<EFBFBD><C3BF>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ӵ<EFBFBD><D3B5>б<EFBFBD><D0B1><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
//for (int i = 0; i < 8; i++) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
//{
|
|
|
|
|
// GameObject item = Instantiate(materialPrefab, materialContent); // ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>
|
|
|
|
|
// MaterialItem materialItem = item.GetComponent<MaterialItem>(); // <20><>ȡ<EFBFBD><C8A1>Ʒ<EFBFBD><C6B7><EFBFBD>Ľű<C4BD>
|
2024-11-29 09:47:47 +08:00
|
|
|
|
|
2024-12-01 04:58:16 +08:00
|
|
|
|
// materialItems.Add(materialItem); // <20><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5>б<EFBFBD><D0B1><EFBFBD>
|
2024-11-29 09:47:47 +08:00
|
|
|
|
|
2024-12-01 04:58:16 +08:00
|
|
|
|
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ƺ<EFBFBD><C6BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĻ<D0B5><C4BB><EFBFBD>
|
|
|
|
|
// materialItem.materialName = "<22><>Ʒ" + (i + 1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|
|
|
|
// materialItem.materialNameText.text = materialItem.materialName; // <20><><EFBFBD><EFBFBD>UI<55>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//}
|
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-01 04:58:16 +08:00
|
|
|
|
int index = 0;
|
2024-11-29 09:47:47 +08:00
|
|
|
|
foreach (var materialItem in materialItems)
|
|
|
|
|
{
|
2024-12-01 04:58:16 +08:00
|
|
|
|
createTemplateInfo.Instance.auth_CreateTemplate.materialList[index].materialId = materialItem.materialId;
|
|
|
|
|
createTemplateInfo.Instance.auth_CreateTemplate.materialList[index].num = materialItem.materialNum;
|
|
|
|
|
index++;
|
2024-11-29 09:47:47 +08:00
|
|
|
|
Debug.Log(materialItem.materialName + " <20><><EFBFBD><EFBFBD>: " + materialItem.GetMaterialNum());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|