Compare commits

..

2 Commits

7 changed files with 422 additions and 32 deletions

View File

@ -715,6 +715,8 @@ MonoBehaviour:
- {fileID: 21300000, guid: d4fbb32ff8543d443b74de2652100618, type: 3} - {fileID: 21300000, guid: d4fbb32ff8543d443b74de2652100618, type: 3}
- {fileID: 21300000, guid: f6884187fb833964ea9e632b9d5a8252, type: 3} - {fileID: 21300000, guid: f6884187fb833964ea9e632b9d5a8252, type: 3}
- {fileID: 21300000, guid: f79faf75d4e26b748958aaaf6c64cf56, type: 3} - {fileID: 21300000, guid: f79faf75d4e26b748958aaaf6c64cf56, type: 3}
Thingid:
type: 0
--- !u!114 &109717923 --- !u!114 &109717923
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2145,11 +2147,13 @@ MonoBehaviour:
maxNumer: 10 maxNumer: 10
haveNumber: 0 haveNumber: 0
type: 0 type: 0
buy_type: 0
haveNumber_text: {fileID: 1337763590} haveNumber_text: {fileID: 1337763590}
toolsNumber_text: {fileID: 1489572594} toolsNumber_text: {fileID: 1489572594}
minerPrefab: {fileID: 1618018427688012061, guid: 73e1e64117f01eb4788657e2602c9872, type: 3} minerPrefab: {fileID: 1618018427688012061, guid: 73e1e64117f01eb4788657e2602c9872, type: 3}
gold: {fileID: 1987812376} gold: {fileID: 1987812376}
startPos: {fileID: 379972121} startPos: {fileID: 379972121}
itemlist: []
cazhi: cazhi:
- {fileID: 2006961055} - {fileID: 2006961055}
- {fileID: 1058917053} - {fileID: 1058917053}
@ -3535,6 +3539,7 @@ GameObject:
- component: {fileID: 616677247} - component: {fileID: 616677247}
- component: {fileID: 616677246} - component: {fileID: 616677246}
- component: {fileID: 616677248} - component: {fileID: 616677248}
- component: {fileID: 616677249}
m_Layer: 0 m_Layer: 0
m_Name: GameObject m_Name: GameObject
m_TagString: Untagged m_TagString: Untagged
@ -3582,6 +3587,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1e00e010e22b19d4f87d0a1463802854, type: 3} m_Script: {fileID: 11500000, guid: 1e00e010e22b19d4f87d0a1463802854, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: 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 --- !u!1 &620653246
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5814,11 +5831,13 @@ MonoBehaviour:
maxNumer: 10 maxNumer: 10
haveNumber: 0 haveNumber: 0
type: 2 type: 2
buy_type: 0
haveNumber_text: {fileID: 889190687} haveNumber_text: {fileID: 889190687}
toolsNumber_text: {fileID: 1983841859} toolsNumber_text: {fileID: 1983841859}
minerPrefab: {fileID: 4851271842099260498, guid: 012a53cdd7479ae4ab0266e1c577a1ea, type: 3} minerPrefab: {fileID: 4851271842099260498, guid: 012a53cdd7479ae4ab0266e1c577a1ea, type: 3}
gold: {fileID: 1664782296} gold: {fileID: 1664782296}
startPos: {fileID: 1267245799} startPos: {fileID: 1267245799}
itemlist: []
cazhi: cazhi:
- {fileID: 1984899085} - {fileID: 1984899085}
- {fileID: 1248061564} - {fileID: 1248061564}
@ -6936,11 +6955,13 @@ MonoBehaviour:
maxNumer: 10 maxNumer: 10
haveNumber: 0 haveNumber: 0
type: 4 type: 4
buy_type: 0
haveNumber_text: {fileID: 1512878292} haveNumber_text: {fileID: 1512878292}
toolsNumber_text: {fileID: 1696745609} toolsNumber_text: {fileID: 1696745609}
minerPrefab: {fileID: 7704353754827174037, guid: d425dcacef66eca459336ad16ca91fea, type: 3} minerPrefab: {fileID: 7704353754827174037, guid: d425dcacef66eca459336ad16ca91fea, type: 3}
gold: {fileID: 1551659950} gold: {fileID: 1551659950}
startPos: {fileID: 1619078991} startPos: {fileID: 1619078991}
itemlist: []
cazhi: cazhi:
- {fileID: 2036569190} - {fileID: 2036569190}
- {fileID: 1643129387} - {fileID: 1643129387}
@ -10056,11 +10077,13 @@ MonoBehaviour:
maxNumer: 10 maxNumer: 10
haveNumber: 0 haveNumber: 0
type: 8 type: 8
buy_type: 0
haveNumber_text: {fileID: 1467810887} haveNumber_text: {fileID: 1467810887}
toolsNumber_text: {fileID: 881868761} toolsNumber_text: {fileID: 881868761}
minerPrefab: {fileID: 8014035693471197394, guid: 4372a8c781dda0043989a8f5ae52c7fa, type: 3} minerPrefab: {fileID: 8014035693471197394, guid: 4372a8c781dda0043989a8f5ae52c7fa, type: 3}
gold: {fileID: 1301220429} gold: {fileID: 1301220429}
startPos: {fileID: 861970738} startPos: {fileID: 861970738}
itemlist: []
cazhi: cazhi:
- {fileID: 1153390233} - {fileID: 1153390233}
- {fileID: 2114148405} - {fileID: 2114148405}
@ -10756,11 +10779,13 @@ MonoBehaviour:
maxNumer: 10 maxNumer: 10
haveNumber: 0 haveNumber: 0
type: 6 type: 6
buy_type: 0
haveNumber_text: {fileID: 1526054076} haveNumber_text: {fileID: 1526054076}
toolsNumber_text: {fileID: 1867062610} toolsNumber_text: {fileID: 1867062610}
minerPrefab: {fileID: 1727175300942666191, guid: bf95ad2db6c84cf4fbcc507e787c7a99, type: 3} minerPrefab: {fileID: 1727175300942666191, guid: bf95ad2db6c84cf4fbcc507e787c7a99, type: 3}
gold: {fileID: 1312070552} gold: {fileID: 1312070552}
startPos: {fileID: 961551742} startPos: {fileID: 961551742}
itemlist: []
cazhi: cazhi:
- {fileID: 1885928845} - {fileID: 1885928845}
- {fileID: 142504042} - {fileID: 142504042}
@ -11521,7 +11546,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1883297442} m_GameObject: {fileID: 1883297442}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 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_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []

View File

@ -32,11 +32,11 @@ public class Get_a_voucher : mount
async void ExecuteTask() async void ExecuteTask()
{ {
string daijinjuanponse = await web.SendRequest(web.URL + "/Voucher/GetList", "POST"); string daijinjuanponse = await web.SendRequest(web.URL + "/Voucher/GetList", "POST");
Debug.Log("用户所有代金卷" + daijinjuanponse); //Debug.Log("用户所有代金卷" + daijinjuanponse);
AllVocherItemRes itemList = JsonUtility.FromJson<AllVocherItemRes>(daijinjuanponse); AllVocherItemRes itemList = JsonUtility.FromJson<AllVocherItemRes>(daijinjuanponse);
Debug.Log(itemList.List.Length); //Debug.Log(itemList.List.Length);
Debug.Log(itemList.List.Length); //Debug.Log(itemList.List.Length);
} }

View File

@ -21,6 +21,16 @@ public class AssestPanel : MonoBehaviour
Ore.text=PlayerManager.Instance.Ore.ToString(); Ore.text=PlayerManager.Instance.Ore.ToString();
InvokeRepeating("ExecuteTask", 1.0f, 1.0f); 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() async void ExecuteTask()

View File

@ -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<Item> itemlist = new List<Item>();
public List<GameObject> 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>(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;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 82fbf86d87a4a2743b143d377aaea771
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -66,6 +66,7 @@ public class jinsha : mount
List<GameObject> list_sb = new List<GameObject>();//设备 List<GameObject> list_sb = new List<GameObject>();//设备
foreach (Item item in itemList.List) foreach (Item item in itemList.List)
{ {
Debug.Log(Struct.StructToString(item,1));
if (type == item.Type) 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 = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()) + "层", Type = 4, is_required = true });
@ -92,7 +93,9 @@ public class jinsha : mount
Item item = intData.GetTypedData(); Item item = intData.GetTypedData();
Thingid = item.Id.ToString(); 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 gameObject = add_pop_up(true);//生成弹窗母体
gameObject.GetComponent<input_box_pop_up_window>().minHeight = 150; gameObject.GetComponent<input_box_pop_up_window>().minHeight = 150;
gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0); gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0);
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "赠送好友");//回调处理 gameObject.GetComponent<input_box_pop_up_window>().is_force = false;
List <GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "ÔùËͺÃÓÑ");//»Øµ÷´¦Àí
List<GameObject> gameObjectitems = new List<GameObject>(); List<GameObject> gameObjectitems = new List<GameObject>();
gameObjects[0].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消 gameObjects[0].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{ {

View File

@ -50,6 +50,9 @@ public class room : mount
loding(); loding();
// Allminer(); // Allminer();
} }
private void OnEnable() private void OnEnable()
@ -87,8 +90,7 @@ public class room : mount
} }
haveNumber--;
toolsNumber--;
UpdateShowCazhi(); UpdateShowCazhi();
ChangeTextPro(); ChangeTextPro();
@ -115,8 +117,6 @@ public class room : mount
//if (toolsNumber_text == null) //if (toolsNumber_text == null)
//{ //{
// Debug.Log("扣钱检测"); // Debug.Log("扣钱检测");
// if (PlayerManager.Instance.GetNumer(MoneyType.Stones) < 11) // if (PlayerManager.Instance.GetNumer(MoneyType.Stones) < 11)
// { // {
@ -125,14 +125,20 @@ public class room : mount
// } // }
// PlayerManager.Instance.SetMoney(MoneyType.Stones, -10); // PlayerManager.Instance.SetMoney(MoneyType.Stones, -10);
//} //}
Generate(1); Generate(1);
if (!Buy_succefful) return;
if (Buy_succefful)
{
GetRoom();
//haveNumber--;
//toolsNumber--;
UpdateShowCazhi();
ChangeTextPro();
Buy_succefful = false;
}
GetRoom();
haveNumber--;
toolsNumber--;
UpdateShowCazhi();
ChangeTextPro();
//创建对应id的矿工精灵 //创建对应id的矿工精灵
@ -144,7 +150,7 @@ public class room : mount
newMiner.transform.SetParent(startPos); newMiner.transform.SetParent(startPos);
newMiner.transform.position = startPos.position; newMiner.transform.position = startPos.position;
Buy_succefful = false;
} }
@ -189,7 +195,6 @@ public class room : mount
haveNumber += num; haveNumber += num;
Promptmgr.Instance.PromptBubble("购买成功"); Promptmgr.Instance.PromptBubble("购买成功");
ChangeTextPro(); ChangeTextPro();
GetRoom(); GetRoom();
} }
@ -234,11 +239,22 @@ public class room : mount
private async void loding() private async void loding()
{ {
Login login = new Login(); string response = await web.SendRequest(web.URL + "/MinerElfActive/GetListOfGem", "POST");
login.Phone = "123456666"; Debug.Log(response);
await web.SendRequest(web.URL + "/Player/Login", "POST", JsonUtility.ToJson(login)); AllVocherItemRes itemList = JsonUtility.FromJson<AllVocherItemRes>(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) private async void Generate(int count)
{ {
@ -248,16 +264,17 @@ public class room : mount
string response = await web.SendRequest(web.URL + "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf)); string response = await web.SendRequest(web.URL + "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf));
Mining_Wizard_ID data = JsonUtility.FromJson<Mining_Wizard_ID>(response); Mining_Wizard_ID data = JsonUtility.FromJson<Mining_Wizard_ID>(response);
Use use = new Use(); Use use = new Use();
use.Id = data.Ids[0]; use.Id = data.Ids[0];
if (use.Id != null) if (use.Id != null)
{ {
Buy_succefful = true; Buy_succefful = true;
} }
string jsonString = JsonUtility.ToJson(use);
string jsonString = JsonUtility.ToJson(use.Id);
string aa =await web.SendRequest(web.URL + "/Voucher/Use", "POST", jsonString); string aa =await web.SendRequest(web.URL + "/Voucher/Use", "POST", jsonString);
Debug.Log(aa); Debug.Log(aa);
} }
@ -266,12 +283,12 @@ public class room : mount
private async void Allminer() 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); Debug.Log(response);
Response reslist = JsonUtility.FromJson<Response>(response); Response reslist = JsonUtility.FromJson<Response>(response);
for (int i=0;i<reslist.List.Length;i++) for (int i = 0; i < reslist.List.Length; i++)
{ {
if (reslist.List[i].Type == 1) if (reslist.List[i].Type == 1)
{ {