2024-10-30 23:18:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
2024-10-31 20:40:09 +08:00
|
|
|
|
using UnityEngine.UI;
|
2024-10-30 23:18:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class RootObject
|
|
|
|
|
{
|
|
|
|
|
public List<Item> List;
|
|
|
|
|
public int ErrorCode;
|
|
|
|
|
public string ErrorMessage;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 02:49:53 +08:00
|
|
|
|
public class JinShaBuy : mount
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public int number=1;
|
2024-10-31 20:40:09 +08:00
|
|
|
|
public int max = 10;
|
2024-11-04 05:28:44 +08:00
|
|
|
|
public int minerjiage = 0;
|
2024-10-31 13:27:31 +08:00
|
|
|
|
public override void Awake()
|
|
|
|
|
{
|
2024-11-04 05:28:44 +08:00
|
|
|
|
|
2024-10-31 13:27:31 +08:00
|
|
|
|
}
|
2024-10-30 23:18:31 +08:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2024-10-31 02:49:53 +08:00
|
|
|
|
|
2024-11-04 05:28:44 +08:00
|
|
|
|
public void Show_buy(Sprite minerIcon,string minerName,int CurrencyId,int Num,float minerjiage)//<2F><><EFBFBD><EFBFBD>
|
2024-10-31 02:49:53 +08:00
|
|
|
|
{
|
2024-11-04 05:28:44 +08:00
|
|
|
|
|
2024-11-04 06:56:09 +08:00
|
|
|
|
Debug.Log(int.Parse(AssestPanel.instance.Coin.text));
|
|
|
|
|
Debug.Log(minerjiage);
|
|
|
|
|
if (int.Parse(AssestPanel.instance.Coin.text) < (int)minerjiage)
|
|
|
|
|
{
|
|
|
|
|
Promptmgr.Instance.PromptBubble("<22><><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",Color.black,Color.red);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>");
|
2024-10-31 02:49:53 +08:00
|
|
|
|
|
|
|
|
|
List<BoxType> boxTypes = new List<BoxType>();
|
2024-11-04 05:28:44 +08:00
|
|
|
|
|
|
|
|
|
boxTypes.Add(new BoxType
|
|
|
|
|
{
|
|
|
|
|
Name = "account_number",
|
|
|
|
|
textName = "<22><><EFBFBD>߶һ<DFB6><D2BB><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
Type = 10,
|
|
|
|
|
is_required = false,
|
|
|
|
|
icon = LoadSprite(mount.mountitem.itemDataList[CurrencyId].IconPath),
|
|
|
|
|
icon2 = minerIcon,
|
|
|
|
|
nametext1 = "<22><><EFBFBD><EFBFBD>",
|
|
|
|
|
nametext2 = minerName,
|
|
|
|
|
numbertext1 = "1",//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<F3B9A4B5>Ǯ
|
|
|
|
|
numbertext2 = number.ToString()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
});
|
|
|
|
|
|
2024-10-31 20:40:09 +08:00
|
|
|
|
boxTypes.Add(new BoxType { Name = "account_number", textName = " <20><><EFBFBD><EFBFBD>:", prompt = "<22><><EFBFBD><EFBFBD><EFBFBD>빺<EFBFBD><EBB9BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", Type = 6, is_required = false});
|
2024-10-31 02:49:53 +08:00
|
|
|
|
boxTypes.Add(new BoxType { Name = "submit", textName = " ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ", Type = 2 });
|
|
|
|
|
GameObject gameObject = add_pop_up(true);//<2F><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>ĸ<EFBFBD><C4B8>
|
2024-10-31 20:40:09 +08:00
|
|
|
|
gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<CDB8>
|
2024-10-31 02:49:53 +08:00
|
|
|
|
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "<22><><EFBFBD><EFBFBD>");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2024-11-04 05:28:44 +08:00
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>
|
2024-11-04 06:56:09 +08:00
|
|
|
|
number = 1;
|
2024-11-04 05:28:44 +08:00
|
|
|
|
this.minerjiage = (int)minerjiage;
|
2024-11-04 06:56:09 +08:00
|
|
|
|
max = int.Parse(AssestPanel.instance.Coin.text) / this.minerjiage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-04 05:28:44 +08:00
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj1.GetComponent<Text>().text = (this.minerjiage * number).ToString();
|
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj2.GetComponent<Text>().text = number.ToString();
|
|
|
|
|
|
|
|
|
|
UpdateText(gameObjects[1].GetComponent<input_box_pop_up_window_item>().contentobj.GetComponent<Text>());
|
2024-11-01 02:27:50 +08:00
|
|
|
|
UpdateText(gameObjects[1].GetComponent<input_box_pop_up_window_item>().contentobj.GetComponent<Text>());
|
2024-10-31 20:40:09 +08:00
|
|
|
|
|
2024-11-01 05:26:28 +08:00
|
|
|
|
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//<2F><>¼ȷ<C2BC><C8B7><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
|
2024-10-31 20:40:09 +08:00
|
|
|
|
{
|
|
|
|
|
if (type == 0)
|
|
|
|
|
{
|
|
|
|
|
if (number>1)
|
|
|
|
|
{
|
|
|
|
|
number--;
|
2024-11-04 05:28:44 +08:00
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj1.GetComponent<Text>().text = (this.minerjiage*number).ToString();
|
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj2.GetComponent<Text>().text = number.ToString();
|
|
|
|
|
UpdateText(gameObjects[1].GetComponent<input_box_pop_up_window_item>().contentobj.GetComponent<Text>());
|
2024-10-31 20:40:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (type == 1)
|
|
|
|
|
{
|
|
|
|
|
if (number < max)
|
|
|
|
|
{
|
|
|
|
|
number++;
|
2024-11-04 05:28:44 +08:00
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj1.GetComponent<Text>().text = (this.minerjiage * number).ToString();
|
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj2.GetComponent<Text>().text = number.ToString();
|
|
|
|
|
UpdateText(gameObjects[1].GetComponent<input_box_pop_up_window_item>().contentobj.GetComponent<Text>());
|
2024-10-31 20:40:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (type == 2)
|
|
|
|
|
{
|
|
|
|
|
if (number!= max)
|
|
|
|
|
{
|
|
|
|
|
number=max;
|
2024-11-04 05:28:44 +08:00
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj1.GetComponent<Text>().text = (this.minerjiage * number).ToString();
|
|
|
|
|
gameObjects[0].GetComponent<input_box_pop_up_window_item>().numbertextobj2.GetComponent<Text>().text = number.ToString();
|
|
|
|
|
UpdateText(gameObjects[1].GetComponent<input_box_pop_up_window_item>().contentobj.GetComponent<Text>());
|
2024-10-31 20:40:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2024-10-31 02:49:53 +08:00
|
|
|
|
|
2024-11-01 05:26:28 +08:00
|
|
|
|
gameObjects[2].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//<2F><>¼ȷ<C2BC><C8B7><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
|
2024-10-31 02:49:53 +08:00
|
|
|
|
{
|
|
|
|
|
if (type == 0)
|
|
|
|
|
{
|
|
|
|
|
gameObject.GetComponent<input_box_pop_up_window>().destroy();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (type == 1)
|
|
|
|
|
{
|
2024-11-02 23:00:54 +08:00
|
|
|
|
Debug.Log(Num);
|
|
|
|
|
GenerateForFisherElf generateForFisherElf = new GenerateForFisherElf(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
generateForFisherElf.Num = Num;
|
2024-11-03 15:09:40 +08:00
|
|
|
|
generateForFisherElf.Count =Convert.ToInt32(boxTypes[1].content);
|
2024-11-03 00:57:23 +08:00
|
|
|
|
//Debug.Log(generateForFisherElf);
|
2024-11-02 23:00:54 +08:00
|
|
|
|
string response = await web.SendRequest(web.URL+ "/Voucher/GenerateForMinerElf", "POST", JsonUtility.ToJson(generateForFisherElf));
|
2024-11-03 04:47:11 +08:00
|
|
|
|
Debug.Log("<22>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+response);
|
2024-11-03 15:09:40 +08:00
|
|
|
|
|
|
|
|
|
string daijinjuanponse = await web.SendRequest(web.URL + "/Voucher/GetList", "POST");
|
|
|
|
|
Debug.Log("<22>û<EFBFBD><C3BB><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>" + daijinjuanponse);
|
|
|
|
|
|
|
|
|
|
|
2024-10-31 02:49:53 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 20:40:09 +08:00
|
|
|
|
|
2024-11-04 05:28:44 +08:00
|
|
|
|
void UpdateText(Text text) {
|
|
|
|
|
|
2024-10-31 20:40:09 +08:00
|
|
|
|
text.text = number.ToString();
|
|
|
|
|
}
|
2024-10-31 02:49:53 +08:00
|
|
|
|
|
|
|
|
|
|
2024-10-30 23:18:31 +08:00
|
|
|
|
}
|