1 ---添加子相机
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
using Assets.Framework.Tool;
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net.API.UserData_SubClass;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UIHome_BY_BackPackPanel : SubUIBase
|
||||
{
|
||||
public List<BaseProductCount> props;
|
||||
public Dictionary<string,BaseProductCount> propsID_Dic = new Dictionary<string,BaseProductCount>();
|
||||
public Dictionary<int,BaseProductCount> propsObjHashCode_Dic = new Dictionary<int, BaseProductCount>();
|
||||
public Transform pageParent;
|
||||
public GameObject prefabItem;
|
||||
|
||||
public TextMeshProUGUI tMP_Name;
|
||||
public TextMeshProUGUI tMP_Description;
|
||||
|
||||
public TextMeshProUGUI text_PageNum;
|
||||
public int pageCountNum = 0;
|
||||
public int pageNum = 1;
|
||||
public ScrollRect scrollRect;
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
}
|
||||
protected override void OnShow(object args = null)
|
||||
{
|
||||
base.OnShow(args);
|
||||
props = GameManager.Instance.user.props;
|
||||
foreach (BaseProductCount product in props)
|
||||
{
|
||||
propsID_Dic[product.number]=product;
|
||||
if (product.count<=0)
|
||||
{
|
||||
|
||||
propsID_Dic.Remove(product.number);
|
||||
}
|
||||
}
|
||||
for (int j = pageParent.childCount-1; j >=0 ; j--)
|
||||
{
|
||||
Destroy(pageParent.GetChild(j).gameObject);
|
||||
}
|
||||
int i=0;
|
||||
|
||||
|
||||
pageCountNum++;
|
||||
foreach (BaseProductCount product in propsID_Dic.Values)
|
||||
{
|
||||
|
||||
GameObject obj = Instantiate(prefabItem,pageParent);
|
||||
propsObjHashCode_Dic[obj.GetHashCode()] = product;
|
||||
obj.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text= product.count.ToString();
|
||||
obj.GetComponent<Toggle>().onValueChanged.AddListener((value) =>
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
tMP_Name.text=product.name;
|
||||
tMP_Description.text = product.desc;
|
||||
}
|
||||
});
|
||||
WebTool.DownImage(APIManager.baseURL+product.imageUrl, (texture) =>
|
||||
{
|
||||
obj.transform.GetChild(0).GetComponent<Image>().sprite = Sprite.Create(texture,new Rect(0f,0f,90,90),Vector2.one*0.5f) ;
|
||||
|
||||
});
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user