From f9ca408f85ef6ab6807f5cda0791ecda61f0d81a Mon Sep 17 00:00:00 2001 From: shurongsen <1799096798@qq.com> Date: Sun, 3 Nov 2024 00:57:23 +0800 Subject: [PATCH] add_pop_up --- .../cultivation_Jinsha_mine_slices.unity | 13 ++++++ meng_yao/Assets/communal/mount.cs | 22 +++++++++- .../script/ConnactServer/Get_a_voucher.cs | 40 +++++++++++++++++++ .../ConnactServer/Get_a_voucher.cs.meta | 11 +++++ .../Assets/script/ConnactServer/JinShaBuy.cs | 7 ++-- meng_yao/Assets/script/Panel/AssestPanel.cs | 2 +- .../cultivation_Jinsha_mine_slices/jinsha.cs | 17 +++++--- 7 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs create mode 100644 meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs.meta diff --git a/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity b/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity index 2ec1b7f44..1f42f3ba3 100644 --- a/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity +++ b/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity @@ -3535,6 +3535,7 @@ GameObject: m_Component: - component: {fileID: 616677247} - component: {fileID: 616677246} + - component: {fileID: 616677248} m_Layer: 0 m_Name: GameObject m_TagString: Untagged @@ -3570,6 +3571,18 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &616677248 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 616677245} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1e00e010e22b19d4f87d0a1463802854, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &620653246 GameObject: m_ObjectHideFlags: 0 diff --git a/meng_yao/Assets/communal/mount.cs b/meng_yao/Assets/communal/mount.cs index e65c30fb3..dcb4af0ae 100644 --- a/meng_yao/Assets/communal/mount.cs +++ b/meng_yao/Assets/communal/mount.cs @@ -44,7 +44,7 @@ public class Item// public List ReferrerBouns; public string CreateDateTime; } -public class VoucherItem//返回的代金卷数据 +public class VoucherItem:Res//返回的代金卷数据 { public string Id; public int Num; @@ -57,6 +57,26 @@ public class VoucherItem// public float EndureTime; public string CreateDateTime; } + +public class AllVocherItem +{ + public string Id; + public string GeneratorId; + public string OwnerId; + public float Type; + public float Num; + public bool IsUsed; + public bool IsAdmin; + public string UsedDateTime; + public string CreateDateTime; +} + + +[Serializable] +public class AllVocherItemRes : Res { + public object Ids; + public AllVocherItem[] List; +} [Serializable] public class Response : Res//挖矿精灵数据 { diff --git a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs new file mode 100644 index 000000000..682acf1f7 --- /dev/null +++ b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs @@ -0,0 +1,40 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Get_a_voucher : mount +{ + + List Wakuanglist = new List(); + // Start is called before the first frame update + void Start() + { + + + InvokeRepeating("ExecuteTask", 1.0f, 1.0f); + } + + public async void iii() + { + Login login = new Login(); + login.Phone = "123"; + await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); + + } + + 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); + + + + } + // Update is called once per frame + void Update() + { + + } +} diff --git a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs.meta b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs.meta new file mode 100644 index 000000000..5f5a8d031 --- /dev/null +++ b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e00e010e22b19d4f87d0a1463802854 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs b/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs index 7528f4b2a..0ab364b18 100644 --- a/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs +++ b/meng_yao/Assets/script/ConnactServer/JinShaBuy.cs @@ -101,12 +101,11 @@ public class JinShaBuy : mount GenerateForFisherElf generateForFisherElf = new GenerateForFisherElf(); // 购买矿工 generateForFisherElf.Num = Num; 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(boxTypes[1].content); + + // Debug.Log(boxTypes[1].content); //number = int.Parse(boxTypes[0].content); } diff --git a/meng_yao/Assets/script/Panel/AssestPanel.cs b/meng_yao/Assets/script/Panel/AssestPanel.cs index e3b7ed966..beb5b1a95 100644 --- a/meng_yao/Assets/script/Panel/AssestPanel.cs +++ b/meng_yao/Assets/script/Panel/AssestPanel.cs @@ -27,7 +27,7 @@ public class AssestPanel : MonoBehaviour { string userponse = await web.SendRequest(web.URL + "/Player/GetInfo", "POST"); - + //Debug.Log(userponse.ToString()); infopyler res = JsonUtility.FromJson(userponse); SetCoinText(res.Info.Gold); SetStoneText(res.Info.Gem); 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 adc5116f1..7df6f2b64 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs @@ -30,10 +30,10 @@ public class jinsha : mount public async void buy_miners()//购买金币矿工界面 { - //测试用 - Login login = new Login(); - login.Phone = "1"; - await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); + ////测试用 + //Login login = new Login(); + //login.Phone = "1"; + //await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); Response response = new Response(); //关闭摄像头逻辑 @@ -117,6 +117,13 @@ public class jinsha : mount foreach (GameObject item in gameObjectitems) { item.GetComponent().register_click(async (BoxType boxType, int type) => { + Debug.Log(boxType.customData); + if (boxType.customData is BoxData intData)//通过储存的泛型来查找挖矿精灵对应的item数据 + { + + PlayerData pldata = intData.GetTypedData(); + Debug.Log(pldata.Id); + } List boxTypeser = new List(); boxTypeser.Add(new BoxType { Name = "account_number", textName = "二次确定", content = "1.请确认赠送的玩家身份\r\n2.免责声明:\r\n赠送及视为您已同意将该道具赠送于玩家,点击确认按钮后无法取消和撤回.\r\n3.请谨慎操作", Type = 9, is_required = true }); @@ -128,7 +135,7 @@ public class jinsha : mount { if (type == 1) { - + //赠送逻辑 ercitanchuang.GetComponent().destroy(); }