diff --git a/meng_yao/Assets/Scenes/New/Scene_map_1.unity b/meng_yao/Assets/Scenes/New/Scene_map_1.unity index ba5a3393..f67cbcc3 100644 --- a/meng_yao/Assets/Scenes/New/Scene_map_1.unity +++ b/meng_yao/Assets/Scenes/New/Scene_map_1.unity @@ -5854,6 +5854,7 @@ GameObject: m_Component: - component: {fileID: 1884241085} - component: {fileID: 1884241086} + - component: {fileID: 1884241087} m_Layer: 0 m_Name: SpawnMonster m_TagString: Untagged @@ -5898,6 +5899,18 @@ MonoBehaviour: GenerateQuantityMax: 20 GenerateQuantity: 5 deadNumber: 0 +--- !u!114 &1884241087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1884241084} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 97664c5246bb0d242997921b3560d036, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1932457212 GameObject: m_ObjectHideFlags: 0 diff --git a/meng_yao/Assets/Scenes/scene_Main.unity b/meng_yao/Assets/Scenes/scene_Main.unity index df371001..fbb0fd78 100644 --- a/meng_yao/Assets/Scenes/scene_Main.unity +++ b/meng_yao/Assets/Scenes/scene_Main.unity @@ -13918,7 +13918,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: -35.921356, y: 0} + m_AnchoredPosition: {x: -27, y: 0} m_SizeDelta: {x: 71.8427, y: 71.8427} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &148769171 @@ -24084,8 +24084,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 22.5, y: 2.2} - m_SizeDelta: {x: 0, y: 0} + m_AnchoredPosition: {x: 58.315002, y: 0.000049591064} + m_SizeDelta: {x: -116.63, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &283076767 MonoBehaviour: @@ -24114,7 +24114,7 @@ MonoBehaviour: m_BestFit: 1 m_MinSize: 1 m_MaxSize: 40 - m_Alignment: 4 + m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 @@ -43233,8 +43233,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 22.5, y: 2.2} - m_SizeDelta: {x: 0, y: 0} + m_AnchoredPosition: {x: 68.07, y: 0.000049591064} + m_SizeDelta: {x: -136.14, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &495265248 MonoBehaviour: @@ -43263,7 +43263,7 @@ MonoBehaviour: m_BestFit: 1 m_MinSize: 1 m_MaxSize: 40 - m_Alignment: 4 + m_Alignment: 3 m_AlignByGeometry: 0 m_RichText: 1 m_HorizontalOverflow: 0 @@ -48820,8 +48820,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.000022888184} - m_SizeDelta: {x: 0, y: 0} + m_AnchoredPosition: {x: 23.8, y: 0.000049591064} + m_SizeDelta: {x: 4.0677, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &565435911 MonoBehaviour: @@ -105993,8 +105993,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 150.75, y: 41} - m_SizeDelta: {x: 777.5, y: 115} + m_AnchoredPosition: {x: 252.93, y: 41} + m_SizeDelta: {x: 573.14, y: 115} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1218477463 MonoBehaviour: @@ -106009,12 +106009,12 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 208 + m_Left: -59 m_Right: 99 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 4 - m_Spacing: 0 + m_Spacing: -21.37 m_ChildForceExpandWidth: 1 m_ChildForceExpandHeight: 1 m_ChildControlWidth: 0 @@ -106466,7 +106466,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 118.53667, y: -57.5} + m_AnchoredPosition: {x: -295.1386, y: -57.5} m_SizeDelta: {x: 280, y: 86} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1222913632 @@ -121434,7 +121434,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.000022888184} + m_AnchoredPosition: {x: 11.1, y: -3.8} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1411013103 @@ -132639,8 +132639,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 19.48999, y: 0} - m_SizeDelta: {x: 189.02, y: 56} + m_AnchoredPosition: {x: 31.958292, y: 0} + m_SizeDelta: {x: 213.9567, y: 56} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1548918930 MonoBehaviour: @@ -142969,8 +142969,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 628, y: -57.5} - m_SizeDelta: {x: 280, y: 86} + m_AnchoredPosition: {x: 398.4879, y: -57.5} + m_SizeDelta: {x: 296.3652, y: 86} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1665185078 GameObject: @@ -161864,8 +161864,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 348, y: -57.5} - m_SizeDelta: {x: 280, y: 86} + m_AnchoredPosition: {x: 106.33765, y: -57.5} + m_SizeDelta: {x: 330.6753, y: 86} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1889134673 GameObject: @@ -172072,8 +172072,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 19.48999, y: 0} - m_SizeDelta: {x: 189.02, y: 56} + m_AnchoredPosition: {x: 32.58972, y: 0} + m_SizeDelta: {x: 215.2195, y: 56} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1982184202 MonoBehaviour: @@ -197595,7 +197595,7 @@ MonoBehaviour: m_Alignment: 4 m_AlignByGeometry: 0 m_RichText: 1 - m_HorizontalOverflow: 0 + m_HorizontalOverflow: 1 m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: 2000/3000 diff --git a/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs b/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs index 85545d59..4ed68328 100644 --- a/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs +++ b/meng_yao/Assets/script/Panel/eco_tree/WaterPanel.cs @@ -140,7 +140,7 @@ public class WaterPanel : MonoBehaviour public void Updated_water(TreeInfo info) { - waterCountText.text = info.Data.Water.ToString(); + waterCountText.text = info.Data.Water.ToString("F2"); } diff --git a/meng_yao/Assets/script/scene_Main/AssetsPanel.cs b/meng_yao/Assets/script/scene_Main/AssetsPanel.cs index d33e3e21..8a145cf3 100644 --- a/meng_yao/Assets/script/scene_Main/AssetsPanel.cs +++ b/meng_yao/Assets/script/scene_Main/AssetsPanel.cs @@ -82,10 +82,10 @@ public class AssetsPanel : MonoBehaviour { isUpdating = true; CapitalbalanceIndefo CapitalbalanceData = await Scene_main_jiekou.instance.CapitalbalanceInfos(); - Stone.text = CapitalbalanceData.data.gem.ToString(); - Coin.text = CapitalbalanceData.data.gold.ToString(); - Ore.text = CapitalbalanceData.data.water.ToString(); - Forging.text = CapitalbalanceData.data.forge.ToString(); + Stone.text = CapitalbalanceData.data.gem.ToString("F2"); + Coin.text = CapitalbalanceData.data.gold.ToString("F2"); + Ore.text = CapitalbalanceData.data.water.ToString("F2"); + Forging.text = CapitalbalanceData.data.forge.ToString("F2"); CapitalbalanceData = null; // 异步操作完成,标记为未执行 isUpdating = false; diff --git a/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs b/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs index b419c463..5272871e 100644 --- a/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs +++ b/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs @@ -28,6 +28,8 @@ public class Promotion_Rank : MonoBehaviour public Text countdown; List Items = new List(); // Start is called before the first frame update + private float lastCallTime = 0f; + private float interval = 1f; // 每秒调用一次 float remainingTime=0f; void OnEnable() @@ -39,24 +41,61 @@ public class Promotion_Rank : MonoBehaviour async void Init() { PromotionRankResponse response = await Scene_main_jiekou.instance.PromotionRanks(); - - Firstlevel.text = response.data.ranks[0].rank.ToString(); - FirstName.text = response.data.ranks[0].nickname; - Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require; - FitstPrize.text = response.data.ranks[0].reward.ToString(); - - - Secondlevel.text = response.data.ranks[1].rank.ToString(); - SecondName.text = response.data.ranks[1].nickname; - Secondcount.text = response.data.ranks[1].quantity + "/" + response.data.ranks[1].require; - SecondPrize.text = response.data.ranks[1].reward.ToString(); - - Thirdlevel.text = response.data.ranks[2].rank.ToString(); - ThirdName.text = response.data.ranks[2].nickname; - Thirdcount.text = response.data.ranks[2].quantity + "/" + response.data.ranks[2].require; - ThirdPrize.text = response.data.ranks[2].reward.ToString(); - remainingTime = response.data.countdown; + UpdateCountdownText(remainingTime); + + switch (response.data.ranks.Count) + { + case 1: + Firstlevel.text = response.data.ranks[0].rank.ToString(); + FirstName.text = response.data.ranks[0].nickname; + Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require; + FitstPrize.text = response.data.ranks[0].reward.ToString(); + + Secondlevel.text ="2"; + SecondName.text = ""; + Secondcount.text = ""; + SecondPrize.text = ""; + + Thirdlevel.text = "3"; + ThirdName.text =""; + Thirdcount.text = ""; + ThirdPrize.text =""; + + break; + case 2: + Firstlevel.text = response.data.ranks[0].rank.ToString(); + FirstName.text = response.data.ranks[0].nickname; + Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require; + FitstPrize.text = response.data.ranks[0].reward.ToString(); + + Secondlevel.text = response.data.ranks[1].rank.ToString(); + SecondName.text = response.data.ranks[1].nickname; + Secondcount.text = response.data.ranks[1].quantity + "/" + response.data.ranks[1].require; + SecondPrize.text = response.data.ranks[1].reward.ToString(); + + Thirdlevel.text = "3"; + ThirdName.text = ""; + Thirdcount.text = ""; + ThirdPrize.text = ""; + break; + case 3: + Firstlevel.text = response.data.ranks[0].rank.ToString(); + FirstName.text = response.data.ranks[0].nickname; + Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require; + FitstPrize.text = response.data.ranks[0].reward.ToString(); + + Secondlevel.text = response.data.ranks[1].rank.ToString(); + SecondName.text = response.data.ranks[1].nickname; + Secondcount.text = response.data.ranks[1].quantity + "/" + response.data.ranks[1].require; + SecondPrize.text = response.data.ranks[1].reward.ToString(); + + Thirdlevel.text = response.data.ranks[2].rank.ToString(); + ThirdName.text = response.data.ranks[2].nickname; + Thirdcount.text = response.data.ranks[2].quantity + "/" + response.data.ranks[2].require; + ThirdPrize.text = response.data.ranks[2].reward.ToString(); + break; + } for (int i = 3; i < response.data.ranks.Count; i++) { @@ -73,6 +112,7 @@ public class Promotion_Rank : MonoBehaviour void UpdateCountdownText(float remainingTime) { + // 将剩余时间转换为小时、分钟和秒 int hours = Mathf.FloorToInt(remainingTime / 3600); int minutes = Mathf.FloorToInt((remainingTime % 3600) / 60); @@ -80,17 +120,27 @@ public class Promotion_Rank : MonoBehaviour // 使用格式化字符串显示倒计时(00:00:00) countdown.text = string.Format("{0:D2}:{1:D2}:{2:D2}", hours, minutes, seconds); + + } + + + private void Update() { - if (remainingTime > 0) + if (Time.time - lastCallTime >= interval) { - // 每帧减少剩余时间 - remainingTime -= Time.deltaTime; + // 每秒调用一次的代码 + if (remainingTime > 0) + { + remainingTime -= 1; + UpdateCountdownText(remainingTime); + Debug.Log("进入倒计时"); + } - // 更新倒计时显示 - UpdateCountdownText(remainingTime); + // 更新上次调用时间 + lastCallTime = Time.time; } } diff --git a/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs b/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs index e6127792..cfc83bc4 100644 --- a/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs +++ b/meng_yao/Assets/script/scene_Main/ui/FirstChargePanel.cs @@ -10,7 +10,7 @@ public class FirstChargePanel : MonoBehaviour public Transform Connact; List objlist = new List(); - private async void OnEnable() + private async void Start() { productListResponse productListResponse = await Scene_main_jiekou.instance.ProductLists(); for (int i = 0; i < productListResponse.Data.Count; i++) diff --git a/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs index b91d5366..57af89b7 100644 --- a/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs +++ b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs @@ -51,8 +51,8 @@ public class IllustrationsAssetDetails : MonoBehaviour isUpdating = true; PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); - GemText.text = _PlayerInfoData.gem.ToString(); - WaterText.text = _PlayerInfoData.water.ToString(); + GemText.text = _PlayerInfoData.gem.ToString("F2"); + WaterText.text = _PlayerInfoData.water.ToString("F2"); UserName.text = _PlayerInfoData.nickname.ToString(); UserID.text = _PlayerInfoData.uid.ToString(); diff --git a/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs b/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs index a9682d1f..eeab1518 100644 --- a/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs +++ b/meng_yao/Assets/script/scene_Main/ui/ShopAssetDetails.cs @@ -49,8 +49,8 @@ public class ShopAssetDetails : MonoBehaviour isUpdating = true; PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); - GemText .text = _PlayerInfoData.gem.ToString(); - OreText.text = _PlayerInfoData.forge.ToString(); + GemText .text = _PlayerInfoData.gem.ToString("F2"); + OreText.text = _PlayerInfoData.forge.ToString("F2"); _PlayerInfoData = null; // 异步操作完成,标记为未执行 isUpdating = false;