This commit is contained in:
shurongsen 2024-11-03 18:44:58 +08:00
parent 760a004c6b
commit 105c1b3237
4 changed files with 86 additions and 38 deletions

View File

@ -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<float> 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<string> Ids;
}
public class Res//ÏûÏ¢·µ»ØÀà
{
public int ErrorCode;
public string ErrorMessage;
}
[System.Serializable]
public class ItemData//道具类 所有的道具都是这个结构体

View File

@ -6,12 +6,19 @@ public class Get_a_voucher : mount
{
List<AllVocherItem> Wakuanglist = new List<AllVocherItem>();
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<AllVocherItemRes>(userponse);
// Debug.Log(itemList.List.Length);
string daijinjuanponse = await web.SendRequest(web.URL + "/Voucher/GetList", "POST");
Debug.Log("用户所有代金卷" + daijinjuanponse);
AllVocherItemRes itemList = JsonUtility.FromJson<AllVocherItemRes>(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()
{

View File

@ -38,7 +38,10 @@ public class jinsha : mount
}
public async void Start()
{
}
public async void buy_miners()//¹ºÂò½ð±Ò¿ó¹¤½çÃæ
{

View File

@ -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();
//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);
}
// 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();
@ -247,8 +247,6 @@ public class room : mount
generateForFisherElf.Count = count;
string response = await web.SendRequest(web.URL + "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf));
Mining_Wizard_ID data = JsonUtility.FromJson<Mining_Wizard_ID>(response);
Use use = new Use();
use.Id = data.Ids[0];