From 4fcaadbddb8dcc55e43fe4461d9e6f8bf2a6b8af Mon Sep 17 00:00:00 2001 From: liuliang <597380732@qq.com> Date: Wed, 18 Dec 2024 17:06:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=87=E6=B0=B4=E6=8E=A5=E5=8F=A3=E4=B8=8E?= =?UTF-8?q?=E7=94=9F=E6=80=81=E6=A0=91=E7=95=8C=E9=9D=A2=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meng_yao/Assets/Scenes/scene_Main.unity | 93 ++++++++++++++++--- .../script/Panel/eco_tree/FramePanel.cs | 26 +----- .../Panel/eco_tree/TreeFunctionPanel.cs | 4 +- .../script/Panel/eco_tree/WaterPanel.cs | 64 ++++++++----- meng_yao/Assets/script/TanChuang/Lottery.cs | 10 +- .../Assets/script/scene_Main/WateringBtn.cs | 35 +++++++ .../script/scene_Main/WateringBtn.cs.meta | 11 +++ .../serveTestScript/treeModule/treeInfo.cs | 2 +- .../treeModule/wateringTree.cs | 2 +- 9 files changed, 172 insertions(+), 75 deletions(-) create mode 100644 meng_yao/Assets/script/scene_Main/WateringBtn.cs create mode 100644 meng_yao/Assets/script/scene_Main/WateringBtn.cs.meta diff --git a/meng_yao/Assets/Scenes/scene_Main.unity b/meng_yao/Assets/Scenes/scene_Main.unity index 795e4c7e3..7d3745cad 100644 --- a/meng_yao/Assets/Scenes/scene_Main.unity +++ b/meng_yao/Assets/Scenes/scene_Main.unity @@ -23369,17 +23369,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fe389f164964bb5439a3af9dd99f368b, type: 3} m_Name: m_EditorClassIdentifier: - chart_title: {fileID: 1130338437} - stats1award: {fileID: 1505730914} - stats1Name: {fileID: 1652979243} - stats2award: {fileID: 1891318826} - stats2Name: {fileID: 2034784578} - stats3award: {fileID: 2061927514} - stats3Name: {fileID: 1228408899} - stats4award: {fileID: 2042099569} - stats4Name: {fileID: 1294981208} - stats5award: {fileID: 1340421628} - stats5Name: {fileID: 1912126104} --- !u!1001 &307054139 PrefabInstance: m_ObjectHideFlags: 0 @@ -38961,6 +38950,14 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 1477323885512014905, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} + propertyPath: m_Type + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 1477323885512014905, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} + propertyPath: m_FillAmount + value: 1 + objectReference: {fileID: 0} - target: {fileID: 1477323885563993957, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -39029,6 +39026,10 @@ PrefabInstance: propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 1477323885912149536, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} + propertyPath: m_Name + value: LevelText + objectReference: {fileID: 0} - target: {fileID: 1477323885963982138, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} propertyPath: m_SizeDelta.x value: 155 @@ -47566,7 +47567,20 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: waterCountText: {fileID: 1414549386} - waterCount: 1000 + chart_title: {fileID: 1130338437} + stats1award: {fileID: 1505730914} + stats1Name: {fileID: 1652979243} + stats2award: {fileID: 1891318826} + stats2Name: {fileID: 2034784578} + stats3award: {fileID: 2061927514} + stats3Name: {fileID: 1228408899} + stats4award: {fileID: 2042099569} + stats4Name: {fileID: 1294981208} + stats5award: {fileID: 1340421628} + stats5Name: {fileID: 1912126104} + TreeLevel: {fileID: 1425098712} + LevelShow: {fileID: 1242654122} + TreeExpFill: {fileID: 1600949661} --- !u!1 &622223219 GameObject: m_ObjectHideFlags: 0 @@ -91347,6 +91361,17 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1239001328} m_CullTransparentMesh: 1 +--- !u!114 &1242654122 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1477323885369638739, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} + m_PrefabInstance: {fileID: 509057630} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1244641367 GameObject: m_ObjectHideFlags: 0 @@ -102874,6 +102899,17 @@ RectTransform: m_AnchoredPosition: {x: 0, y: -24.21} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1425098712 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1477323885912149566, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} + m_PrefabInstance: {fileID: 509057630} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1426505138 GameObject: m_ObjectHideFlags: 0 @@ -113587,7 +113623,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6931136036260294082, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 6931136036260294093, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} propertyPath: m_Pivot.x @@ -113955,7 +113991,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6931136037450377240, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: -723.68835 objectReference: {fileID: 0} - target: {fileID: 6931136037576709270, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3} propertyPath: m_AnchorMax.y @@ -117872,6 +117908,17 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1600763613} m_CullTransparentMesh: 1 +--- !u!114 &1600949661 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1477323885512014905, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} + m_PrefabInstance: {fileID: 509057630} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1601098542 GameObject: m_ObjectHideFlags: 0 @@ -156800,6 +156847,24 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2116513763} m_CullTransparentMesh: 1 +--- !u!1 &2119209698 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1477323884977120185, guid: aa401e2ce6d8c5847a9a32a4ac92f0f0, type: 3} + m_PrefabInstance: {fileID: 509057630} + m_PrefabAsset: {fileID: 0} +--- !u!114 &2119209703 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2119209698} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8c0010ce7d06b5b49bc0c14891f46648, type: 3} + m_Name: + m_EditorClassIdentifier: + wateringBtn: {fileID: 0} --- !u!1 &2119903091 GameObject: m_ObjectHideFlags: 0 diff --git a/meng_yao/Assets/script/Panel/eco_tree/FramePanel.cs b/meng_yao/Assets/script/Panel/eco_tree/FramePanel.cs index d80449c39..000cce154 100644 --- a/meng_yao/Assets/script/Panel/eco_tree/FramePanel.cs +++ b/meng_yao/Assets/script/Panel/eco_tree/FramePanel.cs @@ -7,33 +7,11 @@ using Unity.VisualScripting; public class FramePanel : MonoBehaviour { - public Text chart_title; - - public Text stats1award; - public Text stats1Name; - public Text stats2award; - public Text stats2Name; - public Text stats3award; - public Text stats3Name; - public Text stats4award; - public Text stats4Name; - public Text stats5award; - public Text stats5Name; + // Start is called before the first frame update async void Start() { - TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS(); - chart_title.text = info.Data.ChartTitle; - stats1award.text = info.Data.Charts[0].Reward; - stats1Name.text = info.Data.Charts[0].Name; - stats2award.text = info.Data.Charts[1].Reward; - stats2Name.text = info.Data.Charts[1].Name; - stats3award.text = info.Data.Charts[2].Reward; - stats3Name.text = info.Data.Charts[2].Name; - stats4award.text = info.Data.Charts[3].Reward; - stats4Name.text = info.Data.Charts[3].Name; - stats5award.text = info.Data.Charts[4].Reward; - stats5Name.text = info.Data.Charts[4].Name; + } diff --git a/meng_yao/Assets/script/Panel/eco_tree/TreeFunctionPanel.cs b/meng_yao/Assets/script/Panel/eco_tree/TreeFunctionPanel.cs index dc5f9c8ea..85d839521 100644 --- a/meng_yao/Assets/script/Panel/eco_tree/TreeFunctionPanel.cs +++ b/meng_yao/Assets/script/Panel/eco_tree/TreeFunctionPanel.cs @@ -20,13 +20,13 @@ public class TreeFunctionPanel : MonoBehaviour private void OnClickFeedBtn() { //点击喂养按钮扣水分 - WaterPanel.instance.setWater(-100); + } private void OnClickWateringBtn() { //浇水按钮扣水分 - WaterPanel.instance.setWater(-50); + //WaterPanel.instance.setWater(-50); } // Update is called once per frame diff --git a/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs b/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs index 06b11b55c..0da324a4b 100644 --- a/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs +++ b/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs @@ -7,36 +7,52 @@ public class WaterPanel : MonoBehaviour { public static WaterPanel instance; public Text waterCountText; - public int waterCount = 1000; - + + + public Text chart_title; + + public Text stats1award; + public Text stats1Name; + public Text stats2award; + public Text stats2Name; + public Text stats3award; + public Text stats3Name; + public Text stats4award; + public Text stats4Name; + public Text stats5award; + public Text stats5Name; + + public Text TreeLevel; + public Text LevelShow; + public Image TreeExpFill; + // Start is called before the first frame update - void Start() + async void Start() { instance = this; - waterCountText.text = waterCount.ToString() + "g"; + TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS(); + Updated_interface(info); } - public void setWater(int wa) + public void Updated_interface(TreeInfo info) { - //得到水分 - if(wa > 0) - { - waterCount += wa; - } - //扣水 - else - { - int count = waterCount + wa;//-998 - if (count < 0) - { - Debug.Log("水分不够,请充值!"); - } - else - { - waterCount =count; - } - } - waterCountText.text = waterCount.ToString() + "g"; + chart_title.text = info.Data.ChartTitle; + stats1award.text = info.Data.Charts[0].Reward; + stats1Name.text = info.Data.Charts[0].Name; + stats2award.text = info.Data.Charts[1].Reward; + stats2Name.text = info.Data.Charts[1].Name; + stats3award.text = info.Data.Charts[2].Reward; + stats3Name.text = info.Data.Charts[2].Name; + stats4award.text = info.Data.Charts[3].Reward; + stats4Name.text = info.Data.Charts[3].Name; + stats5award.text = info.Data.Charts[4].Reward; + stats5Name.text = info.Data.Charts[4].Name; + + Debug.Log(info.Data.upgrade_exp); + waterCountText.text = info.Data.Water.ToString(); + TreeLevel.text = "生态树等级Lv." + info.Data.Level; + LevelShow.text = info.Data.Exp + "/" + info.Data.upgrade_exp; + TreeExpFill.fillAmount = info.Data.Exp / info.Data.upgrade_exp; } diff --git a/meng_yao/Assets/script/TanChuang/Lottery.cs b/meng_yao/Assets/script/TanChuang/Lottery.cs index d54c6f6a1..2c2114895 100644 --- a/meng_yao/Assets/script/TanChuang/Lottery.cs +++ b/meng_yao/Assets/script/TanChuang/Lottery.cs @@ -13,15 +13,7 @@ public class Lottery : MonoBehaviour void LotteryClick() { - if ((WaterPanel.instance.waterCount-999) > 0) - { - WaterPanel.instance.setWater(-999); - LotteryPanel.gameObject.SetActive(true); - } - else - { - Promptmgr.Instance.PromptBubble("水量不足,无法抽奖"); - } + } // Update is called once per frame diff --git a/meng_yao/Assets/script/scene_Main/WateringBtn.cs b/meng_yao/Assets/script/scene_Main/WateringBtn.cs new file mode 100644 index 000000000..789c0be76 --- /dev/null +++ b/meng_yao/Assets/script/scene_Main/WateringBtn.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class WateringBtn : MonoBehaviour +{ + public Button wateringBtn; + void Start() + { + wateringBtn = GetComponent