62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class CustomItem : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 海关编码(用逗号隔开)
|
|
/// </summary>
|
|
public string Custom_Code;
|
|
public Image icon;
|
|
public Button btn;
|
|
public Text text;
|
|
public Sprite nochoseSprite;
|
|
public Sprite choseSprite;
|
|
|
|
/// <summary>
|
|
/// 市级
|
|
/// </summary>
|
|
public CityPanel shi_Panel;
|
|
|
|
void Awake()
|
|
{
|
|
//默认关闭
|
|
shi_Panel.gameObject.SetActive(false);
|
|
//点击海关标签
|
|
btn.onClick.AddListener(() =>
|
|
{
|
|
FirstPanel.instance.tab.GetComponentsInChildren<TabItem>().ToList().Find(a => a.customItem == this).Click(null);
|
|
});
|
|
}
|
|
|
|
public void PointIn(BaseEventData data)
|
|
{
|
|
icon.sprite = choseSprite;
|
|
}
|
|
|
|
public void PointOut(BaseEventData data)
|
|
{
|
|
icon.sprite = nochoseSprite;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 进入市一级
|
|
/// </summary>
|
|
public void EnterCity()
|
|
{
|
|
FirstPanel.currentChoseCustonItem = this;
|
|
//清空选择
|
|
FirstPanel.instance.citys.transform.GetComponentsInChildren<CityPanel>().ToList().ForEach(a =>
|
|
{
|
|
a.gameObject.SetActive(false);
|
|
});
|
|
shi_Panel.gameObject.SetActive(true);
|
|
shi_Panel.Init(Custom_Code);
|
|
FirstPanel.instance.sheng_Panel.SetActive(false);
|
|
}
|
|
}
|