From 2584c6b0b58fdde6b378fa7a13ddf0fb10ac9665 Mon Sep 17 00:00:00 2001 From: shurongsen <1799096798@qq.com> Date: Sun, 3 Nov 2024 04:47:11 +0800 Subject: [PATCH] add --- .../cultivation_diamond_mines_slices.unity | 10 ++ meng_yao/Assets/communal/mount.cs | 16 +++- .../script/ConnactServer/Get_a_voucher.cs | 6 +- .../Assets/script/ConnactServer/JinShaBuy.cs | 2 +- .../cultivation_Jinsha_mine_slices/room.cs | 92 ++++++++++++------- 5 files changed, 90 insertions(+), 36 deletions(-) diff --git a/meng_yao/Assets/Scenes/cultivation_diamond_mines_slices.unity b/meng_yao/Assets/Scenes/cultivation_diamond_mines_slices.unity index 945429166..efbd7f17c 100644 --- a/meng_yao/Assets/Scenes/cultivation_diamond_mines_slices.unity +++ b/meng_yao/Assets/Scenes/cultivation_diamond_mines_slices.unity @@ -2133,11 +2133,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 0 + buy_type: 6 haveNumber_text: {fileID: 842003837} toolsNumber_text: {fileID: 0} minerPrefab: {fileID: 2856136438398072313, guid: 67184d017c6661d4e84c0466d6e6bfb7, type: 3} gold: {fileID: 1222826993} startPos: {fileID: 1029900289} + itemlist: [] cazhi: - {fileID: 0} - {fileID: 0} @@ -2363,11 +2365,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 4 + buy_type: 8 haveNumber_text: {fileID: 221409765} toolsNumber_text: {fileID: 0} minerPrefab: {fileID: 3444381990910610855, guid: d18dec04f037a5647a17ca845b55e1bb, type: 3} gold: {fileID: 85787133} startPos: {fileID: 550528965} + itemlist: [] cazhi: - {fileID: 0} - {fileID: 0} @@ -2509,11 +2513,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 2 + buy_type: 7 haveNumber_text: {fileID: 364651119} toolsNumber_text: {fileID: 0} minerPrefab: {fileID: 9167270724560323185, guid: 51cabd50fc321d547b885e691319bc11, type: 3} gold: {fileID: 1738523665} startPos: {fileID: 1193921915} + itemlist: [] cazhi: - {fileID: 0} - {fileID: 0} @@ -4462,11 +4468,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 8 + buy_type: 10 haveNumber_text: {fileID: 925527157} toolsNumber_text: {fileID: 0} minerPrefab: {fileID: 990481224290882605, guid: c6ab1b51d61a9fc46b497728bd3adf5b, type: 3} gold: {fileID: 387735378} startPos: {fileID: 1067071692} + itemlist: [] cazhi: - {fileID: 0} - {fileID: 0} @@ -7463,11 +7471,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 6 + buy_type: 9 haveNumber_text: {fileID: 1537079302} toolsNumber_text: {fileID: 0} minerPrefab: {fileID: 4568907524513556043, guid: 9b53a49e2b9d7564db62f0993ac45b61, type: 3} gold: {fileID: 1107876061} startPos: {fileID: 603196366} + itemlist: [] cazhi: - {fileID: 0} - {fileID: 0} diff --git a/meng_yao/Assets/communal/mount.cs b/meng_yao/Assets/communal/mount.cs index d5f34218c..c50057fe3 100644 --- a/meng_yao/Assets/communal/mount.cs +++ b/meng_yao/Assets/communal/mount.cs @@ -58,7 +58,21 @@ public class VoucherItem:Res// public string CreateDateTime; } -public class AllVocherItem + + +public class Use_daijinjuan +{ + public string Id; +} + + +public class Mining_Wizard_ID //挖矿精灵id +{ + public string[] Ids; + +} + +public class AllVocherItem //所有代金卷数据 { public string Id; public string GeneratorId; diff --git a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs index 682acf1f7..007c96376 100644 --- a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs +++ b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs @@ -16,9 +16,9 @@ public class Get_a_voucher : mount public async void iii() { - Login login = new Login(); - login.Phone = "123"; - await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); + //Login login = new Login(); + // login.Phone = "123"; + // await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); } diff --git a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs b/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs index 0ab364b18..cc1b494bc 100644 --- a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs +++ b/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs @@ -103,7 +103,7 @@ public class JinShaBuy : mount generateForFisherElf.Count =Convert.ToInt32( boxTypes[1].content); //Debug.Log(generateForFisherElf); string response = await web.SendRequest(web.URL+ "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf)); - Debug.Log(response); + Debug.Log("用户产生代金卷"+response); // Debug.Log(boxTypes[1].content); //number = int.Parse(boxTypes[0].content); diff --git a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs index 93a606111..5faef25de 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs @@ -13,21 +13,31 @@ public class room : mount public int maxNumer=10; public int haveNumber = 0; public int type = 0; + + public int buy_type; private int toolsNumber = 0; public TextMeshPro haveNumber_text; public TextMeshPro toolsNumber_text; public GameObject minerPrefab; public Transform gold; - public Transform startPos; - + public Transform startPos; + public List itemlist = new List(); public List cazhi; public GameObject BlackRoom; public GameObject Boom; + + // Start is called before the first frame update + public override void Awake() + { + + } + + void Start() { if (toolsNumber_text==null) @@ -35,8 +45,11 @@ public class room : mount toolsNumber = 10; haveNumber = 10; } + ChangeTextPro(); - + + loding(); + // Allminer(); } private void OnEnable() @@ -79,8 +92,6 @@ public class room : mount UpdateShowCazhi(); ChangeTextPro(); - Generate();//是否有宝石 - //Vector3 GameObject.Instantiate(Boom, new Vector3(startPos.position.x, startPos.position.y + 0.5f, startPos.position.z - 1f), Quaternion.identity); @@ -120,8 +131,10 @@ public class room : mount UpdateShowCazhi(); ChangeTextPro(); - Generate();//是否有宝石 + Generate(1);//创建对应id的矿工精灵 + //Vector3 + GameObject.Instantiate(Boom,new Vector3(startPos.position.x, startPos.position.y+0.5f, startPos.position.z-1f),Quaternion.identity); await Task.Delay(500); GameObject newMiner = GameObject.Instantiate(minerPrefab); @@ -216,18 +229,55 @@ public class room : mount } } - private async void Generate() + private async void loding() { - string response = await web.SendRequest("http://47.109.133.52/FisherElfActive/GetListOfGem", "POST"); + Login login = new Login(); + login.Phone = "1"; + await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); + } + + private async void Generate(int count) + { + + GenerateForFisherElf generateForFisherElf = new GenerateForFisherElf(); // 购买矿工 + generateForFisherElf.Num = buy_type; + generateForFisherElf.Count = count; + string response = await web.SendRequest(web.URL + "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf)); Debug.Log(response); - GetListOfGem data= JsonUtility.FromJson(response); - if (data.ErrorMessage == "") + Mining_Wizard_ID data = JsonUtility.FromJson(response); + + Use use = new Use(); + use.Id = data.Ids[0]; + string jsonString = JsonUtility.ToJson(use.Id); + string aa =await web.SendRequest(web.URL + "/Voucher/Use", "POST", jsonString); + + Debug.Log(aa); + } + + + + + private async void Allminer() + { + + string response = await web.SendRequest(web.URL+"/MinerElf/GetList", "POST"); + + Debug.Log(response); + Response reslist = JsonUtility.FromJson(response); + + for (int i=0;i List; - public int ErrorCode; - public string ErrorMessage; -} - -public class GetListOfGemItem -{ - public string Id; - public int Num; - public int Type; - public string OwnerId; - public int ActivateValue; - public int GenerateValue; - public int AlreadyGenerateValue; - public int RemainEndureTime; - public int EndureTime; - public string CreateDateTime; -}