80 lines
2.0 KiB
C#
80 lines
2.0 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);
|
|
//重置市下面办事处item
|
|
shi_Panel.transform.GetComponentsInChildren<WorkPlaceItem>(true).ToList().ForEach(a =>
|
|
{
|
|
if (a.customItem != this)
|
|
{
|
|
a.gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
a.gameObject.SetActive(true);
|
|
}
|
|
});
|
|
|
|
//隐藏省地图
|
|
FirstPanel.instance.sheng_Panel.SetActive(false);
|
|
|
|
//隐藏所有办事处地图
|
|
FirstPanel.instance.workPlace.SetActive(false);
|
|
}
|
|
}
|