This commit is contained in:
2026-03-27 15:18:35 +08:00
parent a6a1847d8b
commit 2396a75504
1227 changed files with 79169 additions and 170265 deletions
File diff suppressed because it is too large Load Diff
+28 -28
View File
@@ -222,10 +222,10 @@ RectTransform:
- {fileID: 5177365637428270193}
m_Father: {fileID: 3239626154716872945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 101, y: -208.03}
m_SizeDelta: {x: 110, y: 108}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7231265597309251543
CanvasRenderer:
@@ -1121,10 +1121,10 @@ RectTransform:
- {fileID: 5513966894280798448}
m_Father: {fileID: 3239626154716872945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 101, y: -318.06}
m_SizeDelta: {x: 110, y: 108}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &370942484608612807
CanvasRenderer:
@@ -3520,10 +3520,10 @@ RectTransform:
- {fileID: 7462834639214531942}
m_Father: {fileID: 3239626154716872945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 101, y: -98}
m_SizeDelta: {x: 110, y: 108}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8466057536863907687
CanvasRenderer:
@@ -3683,10 +3683,10 @@ RectTransform:
- {fileID: 667114095101796742}
m_Father: {fileID: 3239626154716872945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 101, y: -428.09}
m_SizeDelta: {x: 110, y: 108}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8329482052301038938
CanvasRenderer:
@@ -3959,10 +3959,10 @@ RectTransform:
- {fileID: 3784324865761730072}
m_Father: {fileID: 3239626154716872945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 214.5, y: -318.06}
m_SizeDelta: {x: 110, y: 108}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2290611900535681629
CanvasRenderer:
@@ -4085,10 +4085,10 @@ RectTransform:
- {fileID: 6228488829427280686}
m_Father: {fileID: 3239626154716872945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 214.5, y: -98}
m_SizeDelta: {x: 110, y: 108}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &281405140740924144
CanvasRenderer:
@@ -4286,10 +4286,10 @@ RectTransform:
- {fileID: 6479158702483977590}
m_Father: {fileID: 3239626154716872945}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 214.5, y: -208.03}
m_SizeDelta: {x: 110, y: 108}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2531555746428283967
CanvasRenderer:
@@ -1,18 +1,97 @@
using System.Collections;
using Assets.Framework.Tool;
using Assets.MyGame.Scripts.Net.API.UserData_SubClass;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UIHome_BY_BackPackPanel : SubUIBase
{
// Start is called before the first frame update
void Start()
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 GameObject prefabPage;
public TextMeshProUGUI tMP_Name;
public TextMeshProUGUI tMP_Description;
public Button btn_Next;
public Button btn_Up;
public TextMeshProUGUI text_PageNum;
public int pageCountNum = 0;
public int pageNum = 1;
public ScrollRect scrollRect;
public override void Awake()
{
base.Awake();
}
// Update is called once per frame
void Update()
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);
}
}
int i=0;
Transform itemParent=null;
itemParent = Instantiate(prefabPage, pageParent).transform;
pageCountNum++;
foreach (BaseProductCount product in propsID_Dic.Values)
{
if (propsID_Dic.Count %12 == 0&&propsID_Dic.Count!=0)
{
itemParent = Instantiate(prefabPage, pageParent).transform;
pageCountNum++;
}
GameObject obj = Instantiate(prefabItem,itemParent);
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(product.imageUrl, (texture) =>
{
obj.transform.GetChild(0).GetComponent<Image>().sprite = Sprite.Create(texture,new Rect(0f,0f,90,90),Vector2.one*0.5f) ;
});
i++;
}
btn_Next.onClick.AddListener(() =>
{
if (pageNum > 1)
{
pageNum--;
}
text_PageNum.text = pageNum + "/" + pageCountNum;
scrollRect.horizontalNormalizedPosition = (float)(pageNum - 1) / (float)(pageCountNum - 1);
});
btn_Up.onClick.AddListener(() =>
{
if (pageNum < pageCountNum)
{
pageNum++;
}
text_PageNum.text = pageNum + "/" + pageCountNum;
scrollRect.horizontalNormalizedPosition = (float)(pageNum - 1) / (float)(pageCountNum - 1);
});
}
}