From 105c1b323746c25bdcdfeea1edd2182074045b80 Mon Sep 17 00:00:00 2001 From: shurongsen <1799096798@qq.com> Date: Sun, 3 Nov 2024 18:44:58 +0800 Subject: [PATCH] add --- meng_yao/Assets/communal/mount.cs | 32 ++++++----- .../script/ConnactServer/Get_a_voucher.cs | 55 +++++++++++++++++-- .../cultivation_Jinsha_mine_slices/jinsha.cs | 5 +- .../cultivation_Jinsha_mine_slices/room.cs | 32 +++++------ 4 files changed, 86 insertions(+), 38 deletions(-) diff --git a/meng_yao/Assets/communal/mount.cs b/meng_yao/Assets/communal/mount.cs index 0ac35cdef..3ff360e16 100644 --- a/meng_yao/Assets/communal/mount.cs +++ b/meng_yao/Assets/communal/mount.cs @@ -13,17 +13,17 @@ public struct Register { public string Phone; } - +[Serializable] public struct AddGold { public int Gold; } - +[Serializable] public struct Login { public string Phone; } - +[Serializable] public struct GetListByPhone { public string Phone; @@ -44,6 +44,7 @@ public class Item// public List ReferrerBouns; public string CreateDateTime; } +[Serializable] public class VoucherItem:Res//返回的代金卷数据 { public string Id; @@ -59,19 +60,19 @@ public class VoucherItem:Res// } - +[Serializable] public class Use_daijinjuan { public string Id; } - +[Serializable] public class Mining_Wizard_ID //挖矿精灵id { public string[] Ids; } - +[Serializable] public class Giveaway //赠送代金卷 { public string[] Ids; @@ -80,20 +81,25 @@ public class Giveaway // - +[Serializable] public class AllVocherItem //所有代金卷数据 { public string Id; public string GeneratorId; public string OwnerId; - public int Type; - public int Num; + public float Type; + public float Num; public bool IsUsed; public bool IsAdmin; public string UsedDateTime; public string CreateDateTime; } - +[Serializable] +public class Res//消息返回类 +{ + public int ErrorCode; + public string ErrorMessage; +} [Serializable] public class AllVocherItemRes : Res @@ -130,11 +136,7 @@ public class ids:Res public List Ids; } -public class Res//消息返回类 -{ - public int ErrorCode; - public string ErrorMessage; -} + [System.Serializable] public class ItemData//道具类 所有的道具都是这个结构体 diff --git a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs index 48c6cc25e..dbf654217 100644 --- a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs +++ b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs @@ -6,12 +6,19 @@ public class Get_a_voucher : mount { List Wakuanglist = new List(); + int[] Floorint = new int[] {0,0,0,0,0}; // Start is called before the first frame update + public override void Awake() + { + + } + void Start() { - InvokeRepeating("ExecuteTask", 1.0f, 1.0f); + + } public async void iii() @@ -24,14 +31,52 @@ public class Get_a_voucher : mount async void ExecuteTask() { - string userponse = await web.SendRequest(web.URL + "/Voucher/GetList", "POST"); - // Debug.Log(userponse); - AllVocherItemRes itemList = JsonUtility.FromJson(userponse); - // Debug.Log(itemList.List.Length); + string daijinjuanponse = await web.SendRequest(web.URL + "/Voucher/GetList", "POST"); + Debug.Log("用户所有代金卷" + daijinjuanponse); + AllVocherItemRes itemList = JsonUtility.FromJson(daijinjuanponse); + Debug.Log(itemList.List.Length); + //for (int i = 0; i < itemList.List.Length; i++) + //{ + // switch (itemList.List[i].Num) + // { + // case 1: + // Floorint[0] += 1; + // break; + // case 2: + // Floorint[1] += 1; + // break; + // case 3: + // Floorint[2] += 1; + // break; + // case 4: + // Floorint[3] += 1; + // break; + // case 5: + // Floorint[4] += 1; + // break; + // } + //} + + + //foreach (var k in Floorint) + //{ + // Debug.Log("各个楼层的代金卷"+k); + //} + Debug.Log(itemList.List.Length); + } + + public void ReturnFloor(int num) //判断楼层是否有代金卷 + { + if (Floorint[num - 1] != 0) + { + + } } + + // Update is called once per frame void Update() { 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 2beea0316..76701dcad 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs @@ -38,7 +38,10 @@ public class jinsha : mount } - + public async void Start() + { + + } public async void buy_miners()//购买金币矿工界面 { 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 77864670b..b1ad23569 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs @@ -48,7 +48,7 @@ public class room : mount ChangeTextPro(); - loding(); + loding(); // Allminer(); } @@ -113,22 +113,22 @@ public class room : mount return; } - if (toolsNumber_text == null) - { - GetRoom(); - - Debug.Log("扣钱检测"); - if (PlayerManager.Instance.GetNumer(MoneyType.Stones) < 11) - { - Promptmgr.Instance.PromptBubble("购买卷不足", Color.black, Color.red); - return; - } - PlayerManager.Instance.SetMoney(MoneyType.Stones, -10); - } + //if (toolsNumber_text == null) + //{ + + // Debug.Log("扣钱检测"); + // if (PlayerManager.Instance.GetNumer(MoneyType.Stones) < 11) + // { + // Promptmgr.Instance.PromptBubble("购买卷不足", Color.black, Color.red); + // return; + // } + // PlayerManager.Instance.SetMoney(MoneyType.Stones, -10); + //} + Generate(1); if (!Buy_succefful) return; - Generate(1); - + + GetRoom(); haveNumber--; toolsNumber--; UpdateShowCazhi(); @@ -246,8 +246,6 @@ public class room : mount generateForFisherElf.Num = buy_type; generateForFisherElf.Count = count; string response = await web.SendRequest(web.URL + "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf)); - - Mining_Wizard_ID data = JsonUtility.FromJson(response); Use use = new Use();