Cute_demon_attacks/meng_yao/Assets/script/scene_jinshakuang/jskPanel.cs
2024-12-23 17:53:25 +08:00

114 lines
4.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class jskPanel : mount
{
public static jskPanel instance;
public delegate void OnClikeWT(int type, int num);
public event OnClikeWT OnType;//点击事件
public List<Sprite> iconS;
public List<GameObject> lands = new List<GameObject>();
public bool Generate1 = false;
public bool Generate2 = false;
public bool Generate3 = false;
public override void Awake()
{
instance = this;
}
public async void buy_ship()
{
// Cinemachine_2dCon.SetCameraContorl(false);
//Debug.LogError("禁用生成船只逻辑");
jishadao_contorl.canClick = false;
List<BoxType> boxTypes = new List<BoxType>();
int index = 1;
for (int i = 0; i < 5; i++)
{
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 = "挖矿" + 1,prompt2 = "挖矿"+(i+1),nametext1="剩余数量1", Type = 3, goldNumerobj = (200 * index).ToString(), icon = iconS[index - 1] });
index++;
}
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);
jishadao_contorl.canClick = true;
};
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
if (!Generate1 && (PlayerManager.Instance.Coins - 200) > 0)
{
lands[0].GetComponent<roomcontroller>().add_fish();
}
}
});
gameObjects[3].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
if (!Generate1 && (PlayerManager.Instance.Coins - 400) > 0)
{
lands[1].GetComponent<roomcontroller>().BuyActivation();
}
}
});
gameObjects[5].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
if (!Generate1 && (PlayerManager.Instance.Coins - 600) > 0)
{
lands[2].GetComponent<roomcontroller>().BuyActivation();
}
}
});
gameObjects[7].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
if (!Generate1 && (PlayerManager.Instance.Coins - 600) > 0)
{
lands[3].GetComponent<roomcontroller>().BuyActivation();
}
}
});
gameObjects[9].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
if (!Generate1 && (PlayerManager.Instance.Coins - 600) > 0)
{
lands[4].GetComponent<roomcontroller>().BuyActivation();
}
}
});
}
}