This commit is contained in:
舒荣森 2024-11-01 02:27:50 +08:00
parent 7fefbf6bb1
commit fe109c7b14
10 changed files with 340 additions and 130 deletions

View File

@ -40,7 +40,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 399.425, y: -157.36995}
m_SizeDelta: {x: 0, y: 34.7399}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6309443630211586355
MonoBehaviour:
@ -103,10 +103,12 @@ MonoBehaviour:
Type: 0
icon: {fileID: 0}
details:
button_0_text:
button_1_text:
textobj: {fileID: 0}
promptobj: {fileID: 6309443631891643866}
contentobj: {fileID: 0}
details: {fileID: 0}
iconobj: {fileID: 0}
--- !u!1 &6309443630760581659
GameObject:
m_ObjectHideFlags: 0

View File

@ -330,7 +330,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 347.96, y: -37}
m_AnchoredPosition: {x: 347.96, y: -0}
m_SizeDelta: {x: 695.92, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2144698140124952037

View File

@ -30,6 +30,9 @@ public struct GetListByPhone
public class mount : MonoBehaviour
{
public static Dictionary<string, Texture> SpriteDic = new Dictionary<string, Texture>();
public static mount mountitem;
// Start is called before the first frame update
public virtual void Awake()

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 72a1beaec38e7814f91fdd3dbeb4e103
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ArabicToChineseNumberConverter : MonoBehaviour
{
public static string ConvertToChineseNumbers(string input)
{
Dictionary<char, string> numberMap = new Dictionary<char, string>
{
{ '1', "Ò»" },
{ '2', "¶þ" },
{ '3', "Èý" },
{ '4', "ËÄ" },
{ '5', "Îå" },
{ '6', "Áù" },
{ '7', "Æß" },
{ '8', "°Ë" },
{ '9', "¾Å" },
{ '0', "Áã" }
};
string result = "";
foreach (char c in input)
{
if (numberMap.ContainsKey(c))
{
result += numberMap[c];
}
}
return result;
}
}

View File

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

View File

@ -146,12 +146,18 @@ public class input_box_pop_up_window : MonoBehaviour
prefab = Resources.Load<GameObject>("preform/gui/text_content");//Îı¾
}
else if (boxType.Type == 10)
{
prefab = Resources.Load<GameObject>("preform/gui/Swap_items_name");//道具换另外的道具
}
GameObject ranking_list_item = Instantiate(prefab, Vector3.zero, Quaternion.identity);
ranking_list_item.transform.parent = contentList.transform;
ranking_list_item.GetComponent<input_box_pop_up_window_item>().Update_text(boxType);
return ranking_list_item;
}
public List<GameObject> updateUI(List<BoxType> my_boxTypes,string type = "标题")//ui更新
public List<GameObject> updateUI(List<BoxType> my_boxTypes,string type = "标题")//ui更新返回数组
{
List<GameObject> gameObjectitem = new List<GameObject>();
boxTypes = my_boxTypes;
@ -168,6 +174,23 @@ public class input_box_pop_up_window : MonoBehaviour
scroll_view.GetComponent<ScrollRect>().verticalNormalizedPosition = 1.0f;
return gameObjectitem;
}
public Dictionary<string,GameObject> updateUI_Dic(List<BoxType> my_boxTypes, string type = "标题")//ui更新返回字典
{
Dictionary<string, GameObject> gameObjectitem = new Dictionary<string, GameObject>();
boxTypes = my_boxTypes;
Type.GetComponent<Text>().text = type;
float posY = 0;
foreach (BoxType boxType in boxTypes)
{
GameObject gameObject = addItem(boxType);
gameObjects.Add(gameObject);
gameObjectitem.Add(boxType.Name, gameObject);
posY += gameObject.GetComponent<RectTransform>().sizeDelta.y;
}
scroll_view.GetComponent<ScrollRect>().verticalNormalizedPosition = 1.0f;
return gameObjectitem;
}
public void Remove(GameObject gameObject)
{
gameObjects.Remove(gameObject);

View File

@ -1,17 +1,17 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor.Hardware;
using UnityEditorInternal.VersionControl;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class InitInfo : MonoBehaviour
{
private MainObject parsedData;
private Username userdata;
public Text name;
public Text userid;
// Start is called before the first frame update
private async void Start()
{
@ -25,14 +25,19 @@ public class InitInfo : MonoBehaviour
AssestPanel.instance.SetCoinText(parsedData.Info.Gold);
AssestPanel.instance.SetStoneText(parsedData.Info.Gem);
//name.text = parsedData.Info.Name;
//userid.text = "id :" + parsedData.Info.Id;
GetListByPhone getlistbyphone = new GetListByPhone();
getlistbyphone.Phone = "1";
string jsonString = JsonUtility.ToJson(getlistbyphone);
string userponse = await web.SendRequest("http://47.109.133.52/Player/GetListByPhone", "POST", jsonString);
Debug.Log(userponse);
<<<<<<< .mine
//RootData RootData = LitJson.JsonMapper.ToObject<RootData>(userponse
//RootData RootData = LitJson.JsonMapper.ToObject<RootData>(userponse);
RootData itemList = JsonUtility.FromJson<RootData>(userponse);
Debug.Log(itemList.List[0].Gold);
if (itemList.List == null)
@ -40,18 +45,12 @@ public class InitInfo : MonoBehaviour
Debug.Log("list¿Õ");
//Debug.Log(rootData.);
}
=======
userdata = JsonUtility.FromJson<Username>(userponse);
Debug.Log(userdata.ErrorCode);
// Debug.Log(rootData.Info.Id);
>>>>>>> .theirs
//name.text=userdata.nameitem.Name;
}
// Update is called once per frame
@ -79,21 +78,59 @@ public class Info
public string Name;
}
public class Username
[System.Serializable]
public class PlayerData
{
public List<nameitem> namelist;
public string Id;
public string Name;
public float Gold;
public string Phone;
public object IslandId;
public object IsLocked;
public object IsCanceled;
public object Level;
public object Referrer;
public object Referrals;
public object Gem;
public object Ore;
public object Forge;
public object FirstBlood;
public object LoginCount;
public object TeamLevel;
public object Contribution;
public object Stamina;
public object TreeLevel;
public object TreeExp;
public object Water;
public object CreateDateTime;
}
[Serializable]
public class InfoData
{
public string Id;
public string Name;
public float Gold;
public int Gem;
public int Forge;
public int Water;
public int Level;
}
[System.Serializable]
public class RootData
{
public PlayerData[] List;
public object Info ;
public int Stamina;
public int Count;
public int ErrorCode;
public string ErrorMessage;
}
public class nameitem
{
public string Id;
public string Phone;
public string Name;
}

View File

@ -54,13 +54,14 @@ public class JinShaBuy : mount
{
List<BoxType> boxTypes = new List<BoxType>();
boxTypes.Add(new BoxType { Name = "account_number", textName = " 数量:", prompt = "请输入购买数量", Type = 10, is_required = false});
boxTypes.Add(new BoxType { Name = "account_number", textName = " 数量:", prompt = "请输入购买数量", Type = 6, is_required = false});
boxTypes.Add(new BoxType { Name = "submit", textName = " 取消购买 ", Type = 2 });
GameObject gameObject = add_pop_up(true);//生成弹窗母体
gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//设置最低高度
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "购买");//测试输入框回调处理
UpdateText(gameObjects[0].GetComponent<input_box_pop_up_window_item>().contentobj.GetComponent<Text>());
UpdateText(gameObjects[1].GetComponent<input_box_pop_up_window_item>().contentobj.GetComponent<Text>());
gameObjects[0].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -16,125 +17,215 @@ public class jinsha : mount
{
intance = this;
}
[Serializable]
public class Item//穀웁쑹쥣鑒앴item
{
public int Id;
public int Num;
public string Name;
public int ActivateValue;
public int StoreValue;
public float Yield;
public int Limit;
public int EndureTime;
public List<float> ReferrerBouns;
public string CreateDateTime;
}
[Serializable]
public class Response//穀웁쑹쥣鑒앴
{
public Item[] List;
public int ErrorCode;
public string ErrorMessage;
}
public void buy_miners()//购买金币矿工界面
{
string jsonString = @"{
""List"": [
{
""Id"": 21,
""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"": 22,
""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"": 23,
""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"": 24,
""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"": 25,
""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"": """"
}";
Response response = JsonUtility.FromJson<Response>(jsonString);
//关闭摄像头逻辑
Cinemachine_2dCon.SetCameraContorl(false);
List<BoxType> boxTypes = new List<BoxType>();
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第一层", Type = 4, is_required = true});
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "青精灵", Type = 3, is_required = true,icon= icons[0] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-青", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第二层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "红精灵", Type = 3, is_required = true, icon = icons[1] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-红", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第三层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "绿精灵", Type = 3, is_required = true, icon = icons[2] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-绿色", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第四层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "蓝精灵", Type = 3, is_required = true, icon = icons[3] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-蓝", Type = 3, is_required = true, icon = toolsicons[0] });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第五层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "紫精灵", Type = 3, is_required = true, icon = icons[4] });
boxTypes.Add(new BoxType { Name = "挖矿设备1", prompt = "挖矿设备-紫", Type = 3, is_required = true, icon = toolsicons[0] });
//boxTypes[3] = new BoxType { Name = "submit", textName = " 取消确定 ", Type = 2 };
int index = 1;
List<GameObject> list_kg = new List<GameObject>();//웁묏
List<GameObject> list_sb = new List<GameObject>();//<2F>
foreach (Item item in response.List)
{
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] });
boxTypes.Add(new BoxType { Name = "穀웁<E7A980>구" + index.ToString(), prompt = "穀웁<E7A980>구·" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()), Type = 3, icon = toolsicons[0] });
Debug.Log(item.Name);
index++;
}
boxTypes.Add(new BoxType { Name = "submit", textName = " 혤句횅땍 ", Type = 2 });
GameObject gameObject = add_pop_up();
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>().SetPosY();
//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>().OnEnd += () =>
Dictionary<string, GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI_Dic(boxTypes, "웁묏徠캬");
foreach (string key in gameObjects.Keys)
{
//按下关闭按键,开启逻辑
Cinemachine_2dCon.SetCameraContorl(true);
};
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
if (key.Contains("웁묏"))
{
gameObjects[key].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) => {
if (type == 1)
{
go.Show_buy();
}
});
gameObjects[2].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(1, 1);
Debug.Log(key);
}
});
gameObjects[4].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(2, 1);
}
});
gameObjects[5].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(3, 1);
}
});
gameObjects[7].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(4, 1);
}
});
gameObjects[8].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(5, 1);
}
});
gameObjects[10].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(6, 1);
}
});
gameObjects[11].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(7, 1);
}
});
//gameObject.GetComponent<input_box_pop_up_window>().OnEnd += () =>
//{
// //객苟밑균객숩,역폘쭉서
// Cinemachine_2dCon.SetCameraContorl(true);
//};
gameObjects[13].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(8, 1);
}
});
gameObjects[14].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(9, 1);
}
});
//gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// go.Show_buy();
// }
//});
//gameObjects[2].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(1, 1);
// }
//});
//gameObjects[4].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(2, 1);
// }
//});
//gameObjects[5].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(3, 1);
// }
//});
//gameObjects[7].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(4, 1);
// }
//});
//gameObjects[8].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(5, 1);
// }
//});
//gameObjects[10].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(6, 1);
// }
//});
//gameObjects[11].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(7, 1);
// }
//});
//gameObjects[13].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(8, 1);
// }
//});
//gameObjects[14].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//되쩌횅땍샀혤句
//{
// if (type == 1)
// {
// OnType?.Invoke(9, 1);
// }
//});
//委托会导致临时变量之采用最终的