diff --git a/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity b/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity index 5bd076a4c..5aca011ca 100644 --- a/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity +++ b/meng_yao/Assets/Scenes/cultivation_Jinsha_mine_slices.unity @@ -715,6 +715,8 @@ MonoBehaviour: - {fileID: 21300000, guid: d4fbb32ff8543d443b74de2652100618, type: 3} - {fileID: 21300000, guid: f6884187fb833964ea9e632b9d5a8252, type: 3} - {fileID: 21300000, guid: f79faf75d4e26b748958aaaf6c64cf56, type: 3} + Thingid: + type: 0 --- !u!114 &109717923 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2145,11 +2147,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 0 + buy_type: 0 haveNumber_text: {fileID: 1337763590} toolsNumber_text: {fileID: 1489572594} minerPrefab: {fileID: 1618018427688012061, guid: 73e1e64117f01eb4788657e2602c9872, type: 3} gold: {fileID: 1987812376} startPos: {fileID: 379972121} + itemlist: [] cazhi: - {fileID: 2006961055} - {fileID: 1058917053} @@ -3535,6 +3539,7 @@ GameObject: - component: {fileID: 616677247} - component: {fileID: 616677246} - component: {fileID: 616677248} + - component: {fileID: 616677249} m_Layer: 0 m_Name: GameObject m_TagString: Untagged @@ -3582,6 +3587,18 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1e00e010e22b19d4f87d0a1463802854, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &616677249 +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: ef4ab5364b9a67c4195c71d9da0f3d7b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &620653246 GameObject: m_ObjectHideFlags: 0 @@ -5814,11 +5831,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 2 + buy_type: 0 haveNumber_text: {fileID: 889190687} toolsNumber_text: {fileID: 1983841859} minerPrefab: {fileID: 4851271842099260498, guid: 012a53cdd7479ae4ab0266e1c577a1ea, type: 3} gold: {fileID: 1664782296} startPos: {fileID: 1267245799} + itemlist: [] cazhi: - {fileID: 1984899085} - {fileID: 1248061564} @@ -6936,11 +6955,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 4 + buy_type: 0 haveNumber_text: {fileID: 1512878292} toolsNumber_text: {fileID: 1696745609} minerPrefab: {fileID: 7704353754827174037, guid: d425dcacef66eca459336ad16ca91fea, type: 3} gold: {fileID: 1551659950} startPos: {fileID: 1619078991} + itemlist: [] cazhi: - {fileID: 2036569190} - {fileID: 1643129387} @@ -10056,11 +10077,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 8 + buy_type: 0 haveNumber_text: {fileID: 1467810887} toolsNumber_text: {fileID: 881868761} minerPrefab: {fileID: 8014035693471197394, guid: 4372a8c781dda0043989a8f5ae52c7fa, type: 3} gold: {fileID: 1301220429} startPos: {fileID: 861970738} + itemlist: [] cazhi: - {fileID: 1153390233} - {fileID: 2114148405} @@ -10756,11 +10779,13 @@ MonoBehaviour: maxNumer: 10 haveNumber: 0 type: 6 + buy_type: 0 haveNumber_text: {fileID: 1526054076} toolsNumber_text: {fileID: 1867062610} minerPrefab: {fileID: 1727175300942666191, guid: bf95ad2db6c84cf4fbcc507e787c7a99, type: 3} gold: {fileID: 1312070552} startPos: {fileID: 961551742} + itemlist: [] cazhi: - {fileID: 1885928845} - {fileID: 142504042} @@ -11521,7 +11546,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/script/ConnactServer/Get_a_voucher.cs b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs index 69d3e0732..41a137420 100644 --- a/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs +++ b/meng_yao/Assets/script/ConnactServer/Get_a_voucher.cs @@ -32,11 +32,11 @@ public class Get_a_voucher : mount async void ExecuteTask() { string daijinjuanponse = await web.SendRequest(web.URL + "/Voucher/GetList", "POST"); - Debug.Log("用户所有代金卷" + daijinjuanponse); + //Debug.Log("用户所有代金卷" + daijinjuanponse); AllVocherItemRes itemList = JsonUtility.FromJson(daijinjuanponse); - Debug.Log(itemList.List.Length); + //Debug.Log(itemList.List.Length); - Debug.Log(itemList.List.Length); + //Debug.Log(itemList.List.Length); } diff --git a/meng_yao/Assets/script/Panel/AssestPanel.cs b/meng_yao/Assets/script/Panel/AssestPanel.cs index beb5b1a95..18d11a793 100644 --- a/meng_yao/Assets/script/Panel/AssestPanel.cs +++ b/meng_yao/Assets/script/Panel/AssestPanel.cs @@ -21,6 +21,16 @@ public class AssestPanel : MonoBehaviour Ore.text=PlayerManager.Instance.Ore.ToString(); InvokeRepeating("ExecuteTask", 1.0f, 1.0f); + + loding(); + } + + public async void loding() + { + Login login = new Login(); + login.Phone = "123456666"; + await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); + } async void ExecuteTask() diff --git a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/RoomJinsha.cs b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/RoomJinsha.cs new file mode 100644 index 000000000..c09a17d1d --- /dev/null +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/RoomJinsha.cs @@ -0,0 +1,323 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using TMPro; +using System.Threading.Tasks; +public class RoomJinsha : mount +{ + public int roomNumber; + 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 List itemlist = new List(); + public List cazhi; + + public GameObject BlackRoom; + + public GameObject Boom; + + private bool Buy_succefful = false; + // Start is called before the first frame update + public override void Awake() + { + + } + + + void Start() + { + if (toolsNumber_text == null) + { + toolsNumber = 10; + haveNumber = 10; + } + + ChangeTextPro(); + + loding(); + // Allminer(); + } + + private void OnEnable() + { + if (toolsNumber_text == null) return; + + jinsha.intance.OnType += addman; + jinsha.intance.OnType += addtools; + + + } + + private void OnDisable() + { + if (toolsNumber_text == null) return; + + jinsha.intance.OnType -= addman; + jinsha.intance.OnType -= addtools; + + } + + + private async void OnTouch() + { + if (haveNumber < 1 || toolsNumber < 1) + { + Promptmgr.Instance.PromptBubble("人数或工具不足", Color.black, Color.red); + return; + } + + if (toolsNumber_text == null) + { + GetRoom(); + PlayerManager.Instance.SetMoney(MoneyType.Stones, -10); + } + + + haveNumber--; + toolsNumber--; + UpdateShowCazhi(); + ChangeTextPro(); + + + //Vector3u + 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); + newMiner.transform.SetParent(startPos); + newMiner.transform.position = startPos.position; + + + } + + + + private async void OnMouseDown() + { + if (haveNumber < 1 || toolsNumber < 1) + { + Promptmgr.Instance.PromptBubble("人数或工具不足", Color.black, Color.red); + return; + } + + //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; + + GetRoom(); + haveNumber--; + toolsNumber--; + UpdateShowCazhi(); + ChangeTextPro(); + + //创建对应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); + newMiner.transform.SetParent(startPos); + newMiner.transform.position = startPos.position; + + Buy_succefful = false; + + } + + void ChangeTextPro() + { + if (haveNumber_text != null) + { + haveNumber_text.text = haveNumber.ToString() + "/" + maxNumer.ToString(); + } + if (toolsNumber_text != null) + { + toolsNumber_text.text = toolsNumber.ToString() + "/" + maxNumer.ToString(); + } + + } + + void addman(int type, int num) + { + if (type == this.type) + { + Debug.Log("扣钱检测"); + if (PlayerManager.Instance.GetNumer(MoneyType.Coins) < 11) + { + Promptmgr.Instance.PromptBubble("购买卷不足", Color.black, Color.red); + return; + } + PlayerManager.Instance.SetMoney(MoneyType.Coins, -10); + + + if ((startPos.childCount + haveNumber) > 9) + { + Promptmgr.Instance.PromptBubble("矿洞已满", Color.black, Color.red); + return; + } + + if (haveNumber > 9) + { + Promptmgr.Instance.PromptBubble("人数已满", Color.black, Color.red); + return; + } + + haveNumber += num; + Promptmgr.Instance.PromptBubble("购买成功"); + ChangeTextPro(); + + GetRoom(); + } + + } + + void addtools(int type, int num) + { + if (type == this.type + 1) + { + + Debug.Log("扣钱检测"); + if (PlayerManager.Instance.GetNumer(MoneyType.Coins) < 11) + { + Promptmgr.Instance.PromptBubble("购买卷不足", Color.black, Color.red); + return; + } + PlayerManager.Instance.SetMoney(MoneyType.Coins, -10); + + + if ((startPos.childCount + toolsNumber) > 9) + { + Promptmgr.Instance.PromptBubble("矿洞已满", Color.black, Color.red); + return; + } + + if (toolsNumber > 9) + { + Promptmgr.Instance.PromptBubble("工具已满", Color.black, Color.red); + return; + } + + + + toolsNumber += 1; + Promptmgr.Instance.PromptBubble("购买成功"); + UpdateShowCazhi(); + ChangeTextPro(); + + GetRoom(); + } + } + + private async void loding() + { + Login login = new Login(); + login.Phone = "123456666"; + await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); + } + + + + + + + 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 < reslist.List.Length; i++) + { + if (reslist.List[i].Type == 1) + { + itemlist.Add(reslist.List[i]); + } + } + + + } + + + + //开拓房间 + void GetRoom() + { + if (BlackRoom == null) return; + Destroy(BlackRoom); + } + + void UpdateShowCazhi() + { + if (toolsNumber_text == null) + { + return; + } + switch (toolsNumber) + { + case 0: + cazhi[0].SetActive(false); + cazhi[1].SetActive(false); + cazhi[2].SetActive(false); + cazhi[3].SetActive(false); + cazhi[4].SetActive(false); + break; + case 1: + cazhi[0].SetActive(true); + cazhi[1].SetActive(false); + cazhi[2].SetActive(false); + cazhi[3].SetActive(false); + cazhi[4].SetActive(false); + break; + case 2: + cazhi[0].SetActive(true); + cazhi[1].SetActive(true); + cazhi[2].SetActive(false); + cazhi[3].SetActive(false); + cazhi[4].SetActive(false); + break; + case 3: + cazhi[0].SetActive(true); + cazhi[1].SetActive(true); + cazhi[2].SetActive(true); + cazhi[3].SetActive(false); + cazhi[4].SetActive(false); + break; + case 4: + cazhi[0].SetActive(true); + cazhi[1].SetActive(true); + cazhi[2].SetActive(true); + cazhi[3].SetActive(true); + cazhi[4].SetActive(false); + break; + case 5: + cazhi[0].SetActive(true); + cazhi[1].SetActive(true); + cazhi[2].SetActive(true); + cazhi[3].SetActive(true); + cazhi[4].SetActive(true); + break; + } + } +} diff --git a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/RoomJinsha.cs.meta b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/RoomJinsha.cs.meta new file mode 100644 index 000000000..e9c97f755 --- /dev/null +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/RoomJinsha.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82fbf86d87a4a2743b143d377aaea771 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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 9bcdead4c..632f59633 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/jinsha.cs @@ -66,6 +66,7 @@ public class jinsha : mount List list_sb = new List();//设备 foreach (Item item in itemList.List) { + Debug.Log(Struct.StructToString(item,1)); if (type == item.Type) { boxTypes.Add(new BoxType { Name = index.ToString() + "文本", prompt = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()) + "层", Type = 4, is_required = true }); @@ -92,7 +93,9 @@ public class jinsha : mount Item item = intData.GetTypedData(); Thingid = item.Id.ToString(); - go.Show_buy(mount.mountitem.itemDataList[item.Id].IconPath,64, item.Num); + Debug.Log(mount.mountitem); + go.Show_buy("",64, item.Num); + //go.Show_buy(mount.mountitem.itemDataList[item.Id].IconPath,64, item.Num); } } @@ -104,7 +107,8 @@ public class jinsha : mount GameObject gameObject = add_pop_up(true);//生成弹窗母体 gameObject.GetComponent().minHeight = 150; gameObject.GetComponent().setScrollMode(0); - List gameObjects = gameObject.GetComponent().updateUI(boxTypes, "赠送好友");//回调处理 + gameObject.GetComponent().is_force = false; + List gameObjects = gameObject.GetComponent().updateUI(boxTypes, "赠送好友");//回调处理 List gameObjectitems = new List(); gameObjects[0].GetComponent().register_click(async (BoxType boxType, int type) =>//登录确定或取消 { 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 54daa71c3..4a1cc91b9 100644 --- a/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs +++ b/meng_yao/Assets/script/cultivation_Jinsha_mine_slices/room.cs @@ -50,6 +50,9 @@ public class room : mount loding(); // Allminer(); + + + } private void OnEnable() @@ -87,8 +90,7 @@ public class room : mount } - haveNumber--; - toolsNumber--; + UpdateShowCazhi(); ChangeTextPro(); @@ -115,8 +117,6 @@ public class room : mount //if (toolsNumber_text == null) //{ - - // Debug.Log("扣钱检测"); // if (PlayerManager.Instance.GetNumer(MoneyType.Stones) < 11) // { @@ -125,14 +125,20 @@ public class room : mount // } // PlayerManager.Instance.SetMoney(MoneyType.Stones, -10); //} - Generate(1); - if (!Buy_succefful) return; + Generate(1); + + + if (Buy_succefful) + { + GetRoom(); + //haveNumber--; + //toolsNumber--; + UpdateShowCazhi(); + ChangeTextPro(); + Buy_succefful = false; + } - GetRoom(); - haveNumber--; - toolsNumber--; - UpdateShowCazhi(); - ChangeTextPro(); + //创建对应id的矿工精灵 @@ -144,7 +150,7 @@ public class room : mount newMiner.transform.SetParent(startPos); newMiner.transform.position = startPos.position; - Buy_succefful = false; + } @@ -189,7 +195,6 @@ public class room : mount haveNumber += num; Promptmgr.Instance.PromptBubble("购买成功"); ChangeTextPro(); - GetRoom(); } @@ -234,11 +239,22 @@ public class room : mount private async void loding() { - Login login = new Login(); - login.Phone = "123456666"; - await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); + string response = await web.SendRequest(web.URL + "/MinerElfActive/GetListOfGem", "POST"); + Debug.Log(response); + AllVocherItemRes itemList = JsonUtility.FromJson(response); + for (int i = 0; i < itemList.List.Length; i++) + { + if (itemList.List[i].Num == buy_type) + { + haveNumber += 1; + } + } + + } + + private async void Generate(int count) { @@ -246,32 +262,33 @@ 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(); use.Id = data.Ids[0]; + if (use.Id != null) { Buy_succefful = true; } - - string jsonString = JsonUtility.ToJson(use.Id); + string jsonString = JsonUtility.ToJson(use); string aa =await web.SendRequest(web.URL + "/Voucher/Use", "POST", jsonString); - Debug.Log(aa); + Debug.Log(aa); } - + private async void Allminer() { - - string response = await web.SendRequest(web.URL+"/MinerElf/GetList", "POST"); + + string response = await web.SendRequest(web.URL + "/MinerElf/GetList", "POST"); Debug.Log(response); Response reslist = JsonUtility.FromJson(response); - - for (int i=0;i