This commit is contained in:
hyskai 2024-10-31 01:29:55 +08:00
parent a28a221302
commit 5ee23f80f4
2 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class shopman :mount
{
public static shopman instance;
public delegate void OnClikeWT(int type, int num);
public event OnClikeWT OnType;//点击事件
// Start is called before the first frame update
private void Awake()
{
instance = this;
}
public void buy_ship()
{
//关闭摄像头逻辑
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 });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第二层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "中级精灵", Type = 3, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1文本", prompt = "第三层", Type = 4, is_required = true });
boxTypes.Add(new BoxType { Name = "矿工1", prompt = "高级精灵", Type = 3, is_required = true });
//boxTypes[3] = 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>().setScrollMode(0);//设置滚动模式为自动填充
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "购买人才");//测试输入框回调处理
gameObject.GetComponent<input_box_pop_up_window>().OnEnd += () =>
{
//关闭摄像头逻辑
Cinemachine_2dCon.SetCameraContorl(true);
};
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(0, 1);
}
});
gameObjects[3].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(1, 1);
}
});
gameObjects[5].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
OnType?.Invoke(2, 1);
}
});
}
}

View File

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