Compare commits

...

2 Commits

Author SHA1 Message Date
02ae2fec04 解决合并冲突 2024-11-03 01:05:24 +08:00
f9ca408f85 add_pop_up 2024-11-03 00:57:23 +08:00
7 changed files with 126 additions and 92 deletions

View File

@ -3534,6 +3534,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 616677247} - component: {fileID: 616677247}
- component: {fileID: 616677246} - component: {fileID: 616677246}
- component: {fileID: 616677248}
m_Layer: 0 m_Layer: 0
m_Name: GameObject m_Name: GameObject
m_TagString: Untagged m_TagString: Untagged
@ -3569,6 +3570,18 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 10 m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 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 --- !u!1 &620653246
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -44,7 +44,7 @@ public class Item//
public List<float> ReferrerBouns; public List<float> ReferrerBouns;
public string CreateDateTime; public string CreateDateTime;
} }
public class VoucherItem//返回的代金卷数据 public class VoucherItem:Res//返回的代金卷数据
{ {
public string Id; public string Id;
public int Num; public int Num;
@ -57,6 +57,26 @@ public class VoucherItem//
public float EndureTime; public float EndureTime;
public string CreateDateTime; 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] [Serializable]
public class Response : Res//挖矿精灵数据 public class Response : Res//挖矿精灵数据
{ {

View File

@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Get_a_voucher : mount
{
List<AllVocherItem> Wakuanglist = new List<AllVocherItem>();
// 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<AllVocherItemRes>(userponse);
Debug.Log(itemList.List);
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@ -37,7 +37,7 @@ public class JinShaBuy : mount
} }
public void Show_buy(string IconPath,int CurrencyId)//¹ºÂòµ¯´° public void Show_buy(string IconPath,int CurrencyId,int Num)//¹ºÂòµ¯´°
{ {
@ -97,12 +97,16 @@ public class JinShaBuy : mount
} }
else if (type == 1) else if (type == 1)
{ {
Debug.Log(Num);
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));
string response = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST"); string response = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST");
Debug.Log(response); Debug.Log(response);
// Debug.Log(boxTypes[1].content);
Debug.Log(boxTypes[1].content);
//number = int.Parse(boxTypes[0].content); //number = int.Parse(boxTypes[0].content);
} }

View File

@ -26,7 +26,6 @@ public class AssestPanel : MonoBehaviour
async void ExecuteTask() async void ExecuteTask()
{ {
string userponse = await web.SendRequest(web.URL + "/Player/GetInfo", "POST");
infopyler res = JsonUtility.FromJson<infopyler>(userponse); infopyler res = JsonUtility.FromJson<infopyler>(userponse);
SetCoinText(res.Info.Gold); SetCoinText(res.Info.Gold);
SetStoneText(res.Info.Gem); SetStoneText(res.Info.Gem);

View File

@ -25,100 +25,35 @@ public class jinsha : mount
{ {
} }
public int type = 0;
public async void buy_miners()//购买金币矿工界面 public async void buy_miners()//购买金币矿工界面
{ {
string jsonString = @"{
""List"": [
{
""Id"": 69,
""Num"": 1,
""Name"": """",
""ActivateValue"": 12,
""StoreValue"": 600,
""Yield"": 0.16,
""Limit"": 3,
""EndureTime"": 30,
""ReferrerBouns"": [1, 0.3],
""CreateDateTime"": ""2024-09-03T04:02:48.290196Z""
},
{
""Id"": 70,
""Num"": 2,
""Name"": """",
""ActivateValue"": 60,
""StoreValue"": 3000,
""Yield"": 0.18,
""Limit"": 3,
""EndureTime"": 30,
""ReferrerBouns"": [1, 0.3],
""CreateDateTime"": ""2024-09-03T04:02:48.290196Z""
},
{
""Id"": 71,
""Num"": 3,
""Name"": ""绿"",
""ActivateValue"": 240,
""StoreValue"": 12000,
""Yield"": 0.2,
""Limit"": 2,
""EndureTime"": 30,
""ReferrerBouns"": [1, 0.3],
""CreateDateTime"": ""2024-09-03T04:02:48.290196Z""
},
{
""Id"": 72,
""Num"": 4,
""Name"": """",
""ActivateValue"": 1080,
""StoreValue"": 54000,
""Yield"": 0.22,
""Limit"": 1,
""EndureTime"": 30,
""ReferrerBouns"": [1, 0.3],
""CreateDateTime"": ""2024-09-03T04:02:48.290196Z""
},
{
""Id"": 73,
""Num"": 5,
""Name"": """",
""ActivateValue"": 2160,
""StoreValue"": 54000,
""Yield"": 0.25,
""Limit"": 1,
""EndureTime"": 30,
""ReferrerBouns"": [1, 0.3],
""CreateDateTime"": ""2024-09-03T04:02:48.290196Z""
}
],
""ErrorCode"": 0,
""ErrorMessage"": """"
}";
//测试用
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();
Response response = JsonUtility.FromJson<Response>(jsonString);
//关闭摄像头逻辑 //关闭摄像头逻辑
Cinemachine_2dCon.SetCameraContorl(false); Cinemachine_2dCon.SetCameraContorl(false);
string userponse = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST"); string userponse = await web.SendRequest(web.URL+ "/MinerElf/GetList", "POST");
Debug.Log(userponse); Debug.Log(userponse);
Response itemList = JsonUtility.FromJson<Response>(userponse); Response itemList = JsonUtility.FromJson<Response>(userponse);
foreach (Item item in itemList.List)
{
Debug.Log(item.Type);
}
List<BoxType> boxTypes = new List<BoxType>(); List<BoxType> boxTypes = new List<BoxType>();
int index = 1; int index = 1;
List<GameObject> list_kg = new List<GameObject>();//矿工 List<GameObject> list_kg = new List<GameObject>();//矿工
List<GameObject> list_sb = new List<GameObject>();//设备 List<GameObject> list_sb = new List<GameObject>();//设备
foreach (Item item in response.List) foreach (Item item in itemList.List)
{
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 });
boxTypes.Add(new BoxType { Name = "矿工" + index.ToString(), prompt = item.Name, Type = 3, icon = icons[index - 1], customData = new BoxData<Item>(item) }); boxTypes.Add(new BoxType { Name = "矿工" + index.ToString(), prompt = item.Name, Type = 3, icon = icons[index - 1], customData = new BoxData<Item>(item) });
@ -126,6 +61,8 @@ public class jinsha : mount
index++; index++;
} }
}
GameObject gameObject = add_pop_up(); GameObject gameObject = add_pop_up();
gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//设置最低高度 gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//设置最低高度
gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(1);//设置滚动模式为滚动 gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(1);//设置滚动模式为滚动
@ -139,8 +76,10 @@ public class jinsha : mount
{ {
if (boxType.customData is BoxData<Item> intData)//通过储存的泛型来查找挖矿精灵对应的item数据 if (boxType.customData is BoxData<Item> intData)//通过储存的泛型来查找挖矿精灵对应的item数据
{ {
Item item = intData.GetTypedData(); Item item = intData.GetTypedData();
go.Show_buy(mount.mountitem.itemDataList[item.Id].IconPath,64); go.Show_buy(mount.mountitem.itemDataList[item.Id].IconPath,64, item.Num);
} }
} }
else else
@ -170,7 +109,7 @@ public class jinsha : mount
List<BoxType> boxTypes = new List<BoxType>();//搜索到的用户添加到弹窗 List<BoxType> boxTypes = new List<BoxType>();//搜索到的用户添加到弹窗
for (int i = 0; i < itemList.List.Length; i++) for (int i = 0; i < itemList.List.Length; i++)
{ {
boxTypes.Add(new BoxType { textName = "查找到的玩家",content = "lv."+itemList.List[i].Level.ToString(), prompt = itemList.List[i].Name, Type = 7 }); boxTypes.Add(new BoxType { textName = "查找到的玩家",content = "lv."+itemList.List[i].Level.ToString(), prompt = itemList.List[i].Name, Type = 7, customData = new BoxData<PlayerData>(itemList.List[i]) });
} }
gameObjectitems = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "赠送好友"); gameObjectitems = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "赠送好友");
@ -182,6 +121,13 @@ public class jinsha : mount
foreach (GameObject item in gameObjectitems) foreach (GameObject item in gameObjectitems)
{ {
item.GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) => { item.GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) => {
Debug.Log(boxType.customData);
if (boxType.customData is BoxData<PlayerData> intData)//通过储存的泛型来查找挖矿精灵对应的item数据
{
PlayerData pldata = intData.GetTypedData();
Debug.Log(pldata.Id);
}
List<BoxType> boxTypeser = new List<BoxType>(); List<BoxType> boxTypeser = new List<BoxType>();
boxTypeser.Add(new BoxType { Name = "account_number", textName = "二次确定", content = "1.请确认赠送的玩家身份\r\n2.免责声明:\r\n赠送及视为您已同意将该道具赠送于玩家,点击确认按钮后无法取消和撤回.\r\n3.请谨慎操作", Type = 9, is_required = true }); boxTypeser.Add(new BoxType { Name = "account_number", textName = "二次确定", content = "1.请确认赠送的玩家身份\r\n2.免责声明:\r\n赠送及视为您已同意将该道具赠送于玩家,点击确认按钮后无法取消和撤回.\r\n3.请谨慎操作", Type = 9, is_required = true });
@ -194,6 +140,7 @@ public class jinsha : mount
if (type == 1) if (type == 1)
{ {
//赠送逻辑 //赠送逻辑
ercitanchuang.GetComponent<input_box_pop_up_window>().destroy(); ercitanchuang.GetComponent<input_box_pop_up_window>().destroy();
} }