From ab765c38d8c5f64e7399b3bb29992e81e2bb96da Mon Sep 17 00:00:00 2001 From: wulongxiao <2545507770@qq.com> Date: Wed, 18 Dec 2024 17:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8D=95=E8=AF=A6=E6=83=85=E6=95=B4?= =?UTF-8?q?=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preform/gui/Asset_Details_item.prefab | 17 +++++++- .../preform/gui/Asset_Details_itembox.prefab | 42 +++++++++---------- meng_yao/Assets/Scenes/scene_Main.unity | 13 ++++++ .../Assets/script/scene_Main/Asset_Details.cs | 42 ++++++++++++++++++- .../scene_Main/ui/Asset_Details_item.cs | 25 +++++++++++ .../scene_Main/ui/Asset_Details_item.cs.meta | 11 +++++ .../scene_Main/ui/Asset_Details_itembox.cs | 5 +-- .../serveTestScript/billsModule/incomeList.cs | 15 ++++--- 8 files changed, 137 insertions(+), 33 deletions(-) create mode 100644 meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs create mode 100644 meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs.meta diff --git a/meng_yao/Assets/Resources/preform/gui/Asset_Details_item.prefab b/meng_yao/Assets/Resources/preform/gui/Asset_Details_item.prefab index a635aec3d..8db4afeb9 100644 --- a/meng_yao/Assets/Resources/preform/gui/Asset_Details_item.prefab +++ b/meng_yao/Assets/Resources/preform/gui/Asset_Details_item.prefab @@ -9,6 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 8800312809106112679} + - component: {fileID: 4613460312564376388} m_Layer: 5 m_Name: Asset_Details_item m_TagString: Untagged @@ -23,7 +24,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8800312809106112678} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -38,6 +39,20 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 46.3059} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4613460312564376388 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8800312809106112678} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e3eea65db936075409912a8a7d52d647, type: 3} + m_Name: + m_EditorClassIdentifier: + info: {fileID: 8800312809432703904} + number: {fileID: 8800312810282259072} --- !u!1 &8800312809432703918 GameObject: m_ObjectHideFlags: 0 diff --git a/meng_yao/Assets/Resources/preform/gui/Asset_Details_itembox.prefab b/meng_yao/Assets/Resources/preform/gui/Asset_Details_itembox.prefab index 74e1b7aa2..371d3e5c9 100644 --- a/meng_yao/Assets/Resources/preform/gui/Asset_Details_itembox.prefab +++ b/meng_yao/Assets/Resources/preform/gui/Asset_Details_itembox.prefab @@ -92,8 +92,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 72535d4c13f2ce34ab87fb251511760c, type: 3} m_Name: m_EditorClassIdentifier: - time: {fileID: 0} - count: {fileID: 0} + time: {fileID: 3085038605624301837} + count: {fileID: 3085038605682806839} --- !u!1 &3085038604622350453 GameObject: m_ObjectHideFlags: 0 @@ -130,7 +130,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 35} + m_SizeDelta: {x: 0, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &3085038605624301827 GameObject: @@ -166,9 +166,9 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0.09248908, y: 1} - m_AnchoredPosition: {x: -0.5, y: 0} - m_SizeDelta: {x: -1, y: 0} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: -1.4489136, y: 0} + m_SizeDelta: {x: -2.8979034, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3085038605624301836 CanvasRenderer: @@ -200,16 +200,16 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 30 + m_FontSize: 45 m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 2 - m_MaxSize: 40 + m_BestFit: 1 + m_MinSize: 30 + m_MaxSize: 50 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 m_LineSpacing: 1 m_Text: 09.16 --- !u!1 &3085038605682806837 @@ -245,10 +245,10 @@ RectTransform: m_Father: {fileID: 3085038604622350452} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0.079} - m_AnchorMin: {x: 0.7737991, y: 0} + m_AnchorMin: {x: 0.6107773, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -0.43347168, y: 0.5} - m_SizeDelta: {x: 0.9021001, y: -1} + m_AnchoredPosition: {x: 0.8760376, y: 0.5} + m_SizeDelta: {x: -1.7642975, y: -1} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3085038605682806838 CanvasRenderer: @@ -280,15 +280,15 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 30 + m_FontSize: 45 m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 2 - m_MaxSize: 40 + m_BestFit: 1 + m_MinSize: 30 + m_MaxSize: 50 m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 m_LineSpacing: 1 m_Text: "\u603B\u8BA1\uFF1A-\xA5195" diff --git a/meng_yao/Assets/Scenes/scene_Main.unity b/meng_yao/Assets/Scenes/scene_Main.unity index 795e4c7e3..f049b2c48 100644 --- a/meng_yao/Assets/Scenes/scene_Main.unity +++ b/meng_yao/Assets/Scenes/scene_Main.unity @@ -104663,6 +104663,11 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &1453243347 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6931136037450377241, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} + m_PrefabInstance: {fileID: 1553952861} + m_PrefabAsset: {fileID: 0} --- !u!1 &1454508580 GameObject: m_ObjectHideFlags: 0 @@ -112912,7 +112917,15 @@ PrefabInstance: - target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} propertyPath: itemPrefab value: + objectReference: {fileID: 8800312809106112678, guid: 8b02cd965c34edb4ebf6d67db033ccd2, type: 3} + - target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} + propertyPath: itemBoxPrefab + value: objectReference: {fileID: 3085038604584877223, guid: ce7baf84b8801624aa22e8f29b4b95b7, type: 3} + - target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} + propertyPath: itemBoxPrefabParent + value: + objectReference: {fileID: 1453243347} - target: {fileID: 65411648539017065, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} propertyPath: m_AnchorMax.y value: 0 diff --git a/meng_yao/Assets/script/scene_Main/Asset_Details.cs b/meng_yao/Assets/script/scene_Main/Asset_Details.cs index 65d5fda0d..ceedae024 100644 --- a/meng_yao/Assets/script/scene_Main/Asset_Details.cs +++ b/meng_yao/Assets/script/scene_Main/Asset_Details.cs @@ -12,6 +12,11 @@ public class Asset_Details : MonoBehaviour public Text HaveMoneyText; + public GameObject itemBoxPrefab; + public GameObject itemBoxPrefabParent; + + public List itemBoxPrefabList = new List(); + public GameObject itemPrefab; // Start is called before the first frame update void Start() @@ -27,7 +32,9 @@ public class Asset_Details : MonoBehaviour /// 1宝石,2金币,3水,4锻造令 public async void ShowPanel(int type) { - + + DeleteAllChildren(itemBoxPrefabParent); + billingStatisticsData info=await Scene_main_jiekou.instance.GetbillingStatisticsData(type); switch (type) @@ -48,7 +55,18 @@ public class Asset_Details : MonoBehaviour IcomeList infoIcomeList = await Scene_main_jiekou.instance.GetIncomeList(1,10,type); - + + foreach (statistics value in infoIcomeList.Data.statistics) + { + GameObject go = GameObject.Instantiate(itemBoxPrefab, itemBoxPrefabParent.transform); + go.GetComponent().init(value.date_time.ToString(), (value.total_income-value.total_expend).ToString()); + itemBoxPrefabList.Add(go); + } + + foreach (Transaction value in infoIcomeList.Data.List) + { + GameObject.Instantiate(itemPrefab, itemBoxPrefabList[0].transform).GetComponent().init(value.Income,value.Remark,value.Amount); + } this.gameObject.SetActive(true); } @@ -67,4 +85,24 @@ public class Asset_Details : MonoBehaviour GiveMoneyText.text = "¥" + give; HaveMoneyText.text = "¥" + have; } + + + public void DeleteAllChildren(GameObject obg) + { + // 确保父物体不为空 + if (obg != null) + { + // 遍历父物体的所有子物体并删除 + foreach (Transform child in obg.transform) + { + GameObject.Destroy(child.gameObject); + } + itemBoxPrefabList.Clear(); + } + else + { + Debug.LogWarning("itemBoxPrefabParent is not assigned."); + } + } + } diff --git a/meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs b/meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs new file mode 100644 index 000000000..9bc751bad --- /dev/null +++ b/meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class Asset_Details_item : MonoBehaviour +{ + + public Text info; + public Text number; + + public void init(bool _bool,string info,string number) + { + if (_bool) + { + this.info.text = info; + this.number.text = "+¥" + number+ ""; + } + else + { + this.info.text = info; + this.number.text ="-¥" + number+ ""; + } + } +} diff --git a/meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs.meta b/meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs.meta new file mode 100644 index 000000000..91f91103b --- /dev/null +++ b/meng_yao/Assets/script/scene_Main/ui/Asset_Details_item.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3eea65db936075409912a8a7d52d647 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/scene_Main/ui/Asset_Details_itembox.cs b/meng_yao/Assets/script/scene_Main/ui/Asset_Details_itembox.cs index 683040a3d..accef36c7 100644 --- a/meng_yao/Assets/script/scene_Main/ui/Asset_Details_itembox.cs +++ b/meng_yao/Assets/script/scene_Main/ui/Asset_Details_itembox.cs @@ -6,12 +6,11 @@ using UnityEngine.UI; public class Asset_Details_itembox : MonoBehaviour { public Text time; - public Text count; public void init(string time,string count) { - this.time.text = time; - this.count.text = count; + this.time.text = "时间:" + time; + this.count.text ="总计:"+ count; } } diff --git a/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs b/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs index afeb2de9d..e5d888ada 100644 --- a/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs +++ b/meng_yao/Assets/script/serveTestScript/billsModule/incomeList.cs @@ -43,7 +43,8 @@ public class IcomeListData { public IcomeListPageInfo Pages { get; set; } public List List { get; set; } - public List Statistics { get; set; } + public List statistics { get; set; } + } public class IcomeListPageInfo @@ -65,9 +66,11 @@ public class Transaction public string CreateTime { get; set; } } -public class Statistics +public class statistics { - public int DateTime { get; set; } - public int TotalExpend { get; set; } - public int TotalIncome { get; set; } -} \ No newline at end of file + public int date_time { get; set; } + public float total_expend { get; set; } + public float total_income { get; set; } +} + +