From 0775e3171f809d457b7ac168c95ba2328df49a0b Mon Sep 17 00:00:00 2001 From: shurongsen <1799096798@qq.com> Date: Sat, 2 Nov 2024 23:00:54 +0800 Subject: [PATCH 1/2] add_pop_up --- .../Resources/Prefabs/AssetsPanel.prefab | 2 +- .../cultivation_Jinsha_mine_slices.unity | 3 +- meng_yao/Assets/communal/mount.cs | 2 +- .../Assets/script/ConnactServer/JinShaBuy.cs | 8 +- meng_yao/Assets/script/Panel/AssestPanel.cs | 3 +- .../cultivation_Jinsha_mine_slices/jinsha.cs | 103 ++++-------------- 6 files changed, 31 insertions(+), 90 deletions(-) diff --git a/meng_yao/Assets/Resources/Prefabs/AssetsPanel.prefab b/meng_yao/Assets/Resources/Prefabs/AssetsPanel.prefab index 4ab80c996..8fd444c2e 100644 --- a/meng_yao/Assets/Resources/Prefabs/AssetsPanel.prefab +++ b/meng_yao/Assets/Resources/Prefabs/AssetsPanel.prefab @@ -1141,7 +1141,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 21300000, guid: b30603fb7e98e0744899b0bf2872d6d9, type: 3} + m_Sprite: {fileID: 21300000, guid: 3987eea29d3d1e74c9b5a8917835d83e, type: 3} m_Type: 0 m_PreserveAspect: 1 m_FillCenter: 1 diff --git a/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity b/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity index 94e14bc65..2ec1b7f44 100644 --- a/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity +++ b/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity @@ -715,6 +715,7 @@ MonoBehaviour: - {fileID: 21300000, guid: d4fbb32ff8543d443b74de2652100618, type: 3} - {fileID: 21300000, guid: f6884187fb833964ea9e632b9d5a8252, type: 3} - {fileID: 21300000, guid: f79faf75d4e26b748958aaaf6c64cf56, type: 3} + type: 1 --- !u!114 &109717923 MonoBehaviour: m_ObjectHideFlags: 0 @@ -11508,7 +11509,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1883297442} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.9797802, y: -0.015979767, z: -24.20161} + m_LocalPosition: {x: -0.0068159103, y: -0.019911766, z: -24.20161} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/meng_yao/Assets/communal/mount.cs b/meng_yao/Assets/communal/mount.cs index a3d509251..e65c30fb3 100644 --- a/meng_yao/Assets/communal/mount.cs +++ b/meng_yao/Assets/communal/mount.cs @@ -68,7 +68,7 @@ public class ResponseVoucher : Res// public VoucherItem[] List; } [Serializable] -public class GenerateForFisherElf //渔夫购买数据 +public class GenerateForFisherElf //员工购买数据 { public int Num; public int Count; diff --git a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs b/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs index 5cb2851e3..7528f4b2a 100644 --- a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs +++ b/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs @@ -37,7 +37,7 @@ public class JinShaBuy : mount } - public void Show_buy(string IconPath,int CurrencyId)//购买弹窗 + public void Show_buy(string IconPath,int CurrencyId,int Num)//购买弹窗 { @@ -97,7 +97,11 @@ public class JinShaBuy : mount } else if (type == 1) { - string response = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST"); + Debug.Log(Num); + GenerateForFisherElf generateForFisherElf = new GenerateForFisherElf(); // 购买矿工 + generateForFisherElf.Num = Num; + generateForFisherElf.Count =Convert.ToInt32( boxTypes[1].content); + string response = await web.SendRequest(web.URL+ "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf)); Debug.Log(response); diff --git a/meng_yao/Assets/script/Panel/AssestPanel.cs b/meng_yao/Assets/script/Panel/AssestPanel.cs index 45dc4299c..e3b7ed966 100644 --- a/meng_yao/Assets/script/Panel/AssestPanel.cs +++ b/meng_yao/Assets/script/Panel/AssestPanel.cs @@ -27,10 +27,11 @@ public class AssestPanel : MonoBehaviour { string userponse = await web.SendRequest(web.URL + "/Player/GetInfo", "POST"); + infopyler res = JsonUtility.FromJson(userponse); SetCoinText(res.Info.Gold); SetStoneText(res.Info.Gem); - //SetCoinText(res.Info.Gold); + //SetForgingText(res.Info.Gold); //SetCoinText(res.Info.Gold); } diff --git a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs index 0abbced04..a3533f2bf 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs @@ -25,106 +25,39 @@ public class jinsha : mount { } - + public int type = 0; public async void buy_miners()//购买金币矿工界面 { - string jsonString = @"{ - ""List"": [ - { - ""Id"": 69, - ""Num"": 1, - ""Name"": ""红精灵"", - ""ActivateValue"": 12, - ""StoreValue"": 600, - ""Yield"": 0.16, - ""Limit"": 3, - ""EndureTime"": 30, - ""ReferrerBouns"": [1, 0.3], - ""CreateDateTime"": ""2024-09-03T04:02:48.290196Z"" - }, - { - ""Id"": 70, - ""Num"": 2, - ""Name"": ""蓝精灵"", - ""ActivateValue"": 60, - ""StoreValue"": 3000, - ""Yield"": 0.18, - ""Limit"": 3, - ""EndureTime"": 30, - ""ReferrerBouns"": [1, 0.3], - ""CreateDateTime"": ""2024-09-03T04:02:48.290196Z"" - }, - { - ""Id"": 71, - ""Num"": 3, - ""Name"": ""绿精灵"", - ""ActivateValue"": 240, - ""StoreValue"": 12000, - ""Yield"": 0.2, - ""Limit"": 2, - ""EndureTime"": 30, - ""ReferrerBouns"": [1, 0.3], - ""CreateDateTime"": ""2024-09-03T04:02:48.290196Z"" - }, - { - ""Id"": 72, - ""Num"": 4, - ""Name"": ""黑精灵"", - ""ActivateValue"": 1080, - ""StoreValue"": 54000, - ""Yield"": 0.22, - ""Limit"": 1, - ""EndureTime"": 30, - ""ReferrerBouns"": [1, 0.3], - ""CreateDateTime"": ""2024-09-03T04:02:48.290196Z"" - }, - { - ""Id"": 73, - ""Num"": 5, - ""Name"": ""黄精灵"", - ""ActivateValue"": 2160, - ""StoreValue"": 54000, - ""Yield"": 0.25, - ""Limit"": 1, - ""EndureTime"": 30, - ""ReferrerBouns"": [1, 0.3], - ""CreateDateTime"": ""2024-09-03T04:02:48.290196Z"" - } - ], - ""ErrorCode"": 0, - ""ErrorMessage"": """" - }"; - + //测试用 + Login login = new Login(); + login.Phone = "1"; + await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); - - - Response response = JsonUtility.FromJson(jsonString); + Response response = new Response(); //关闭摄像头逻辑 Cinemachine_2dCon.SetCameraContorl(false); - string userponse = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST"); + string userponse = await web.SendRequest(web.URL+ "/MinerElf/GetList", "POST"); Debug.Log(userponse); Response itemList = JsonUtility.FromJson(userponse); - foreach (Item item in itemList.List) - { - - Debug.Log(item.Type); - } - List boxTypes = new List(); int index = 1; List list_kg = new List();//矿工 List list_sb = new List();//设备 - foreach (Item item in response.List) + foreach (Item item in itemList.List) { - boxTypes.Add(new BoxType { Name = index.ToString()+ "文本", prompt = "第"+ ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()) + "层", Type = 4, is_required = true }); - boxTypes.Add(new BoxType { Name = "矿工" + index.ToString(), prompt = item.Name, Type = 3, icon = icons[index - 1] , customData = new BoxData(item) }); - boxTypes.Add(new BoxType { Name = "挖矿设备" + index.ToString(), prompt = "挖矿设备·" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()), Type = 3, icon = toolsicons[0] }); + if (type == item.Type) + { + boxTypes.Add(new BoxType { Name = index.ToString() + "文本", prompt = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()) + "层", Type = 4, is_required = true }); + boxTypes.Add(new BoxType { Name = "矿工" + index.ToString(), prompt = item.Name, Type = 3, icon = icons[index - 1], customData = new BoxData(item) }); + boxTypes.Add(new BoxType { Name = "挖矿设备" + index.ToString(), prompt = "挖矿设备·" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()), Type = 3, icon = toolsicons[0] }); - index++; + index++; + } + } GameObject gameObject = add_pop_up(); gameObject.GetComponent().minHeight = 800;//设置最低高度 @@ -139,8 +72,10 @@ public class jinsha : mount { if (boxType.customData is BoxData intData)//通过储存的泛型来查找挖矿精灵对应的item数据 { + Item item = intData.GetTypedData(); - go.Show_buy(mount.mountitem.itemDataList[item.Id].IconPath,64); + go.Show_buy(mount.mountitem.itemDataList[item.Id].IconPath,64, item.Num); + } } else From 44524eec820e0d9454b3ed519430e3e0546abadc Mon Sep 17 00:00:00 2001 From: shurongsen <1799096798@qq.com> Date: Sat, 2 Nov 2024 23:10:40 +0800 Subject: [PATCH 2/2] add --- meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs index a3533f2bf..adc5116f1 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs @@ -105,7 +105,7 @@ public class jinsha : mount List boxTypes = new List();//搜索到的用户添加到弹窗 for (int i = 0; i < itemList.List.Length; i++) { - boxTypes.Add(new BoxType { textName = "查找到的玩家",content = "lv."+itemList.List[i].Level.ToString(), prompt = itemList.List[i].Name, Type = 7 }); + boxTypes.Add(new BoxType { textName = "查找到的玩家",content = "lv."+itemList.List[i].Level.ToString(), prompt = itemList.List[i].Name, Type = 7, customData = new BoxData(itemList.List[i]) }); } gameObjectitems = gameObject.GetComponent().updateUI(boxTypes, "赠送好友");