From 5ee23f80f4bff09d7307d328f8076d32be6439fc Mon Sep 17 00:00:00 2001 From: hyskai <2545507770@qq.com> Date: Thu, 31 Oct 2024 01:29:55 +0800 Subject: [PATCH] add --- .../cultivation_gold_coin_Island/shopman.cs | 70 +++++++++++++++++++ .../shopman.cs.meta | 11 +++ 2 files changed, 81 insertions(+) create mode 100644 meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs create mode 100644 meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs.meta diff --git a/meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs b/meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs new file mode 100644 index 000000000..23fea1800 --- /dev/null +++ b/meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs @@ -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 boxTypes = new List(); + + 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().minHeight = 800;//设置最低高度 + gameObject.GetComponent().setScrollMode(1);//设置滚动模式为滚动 + //gameObject.GetComponent().setScrollMode(0);//设置滚动模式为自动填充 + List gameObjects = gameObject.GetComponent().updateUI(boxTypes, "购买人才");//测试输入框回调处理 + + gameObject.GetComponent().OnEnd += () => + { + //关闭摄像头逻辑 + Cinemachine_2dCon.SetCameraContorl(true); + }; + + gameObjects[1].GetComponent().register_click(async (BoxType boxType, int type) =>//登录确定或取消 + { + if (type == 1) + { + OnType?.Invoke(0, 1); + } + }); + gameObjects[3].GetComponent().register_click(async (BoxType boxType, int type) =>//登录确定或取消 + { + if (type == 1) + { + OnType?.Invoke(1, 1); + } + }); + gameObjects[5].GetComponent().register_click(async (BoxType boxType, int type) =>//登录确定或取消 + { + if (type == 1) + { + OnType?.Invoke(2, 1); + } + }); + } +} diff --git a/meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs.meta b/meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs.meta new file mode 100644 index 000000000..0cb26008f --- /dev/null +++ b/meng_yao/Assets/script/cultivation_gold_coin_Island/shopman.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a48788a64136b294b8e996807b88dad1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: