123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class B08_TaskListItem : MonoBehaviour
- {
- public Text typeText;
- public Text titleText;
- public Text stateText;
- public Text dateText;
- public Text ctrlText;
- public GameObject more;
-
-
- public Button moreButton;
- public bool moreMessage = false;
- public RectTransform rect;
- public GameObject pointItemPrefab;
- public List<B08_TaskPointItem> PointItems = new List<B08_TaskPointItem>();
- public Transform itemContent;
- public B08_TaskInfoData InfoData;
- public GCYWLayer gcywLayer;
- public void Init()
- {
- rect = this.GetComponent<RectTransform>();
- typeText = this.transform.Find("typeText").GetComponent<Text>();
- titleText = this.transform.Find("titleText").GetComponent<Text>();
- stateText = this.transform.Find("stateText").GetComponent<Text>();
- dateText = this.transform.Find("dateText").GetComponent<Text>();
- ctrlText = this.transform.Find("ctrlText").GetComponent<Text>();
- more = this.transform.Find("more").gameObject;
-
- more.SetActive(false);
-
- moreButton = ctrlText.GetComponent<Button>();
- moreButton.onClick.AddListener(ChangeMoreMessage);
- moreMessage = false;
- ctrlText.text = "<color=#00EFFF>详情</color>";
- rect.sizeDelta = new Vector2(360,38);
- more.SetActive(false);
- }
- public void ChangeMoreMessage()
- {
- if (moreMessage)
- {
- ctrlText.text = "<color=#00EFFF>详情</color>";
- rect.sizeDelta = new Vector2(360,38);
- more.SetActive(false);
- }
- else
- {
- ctrlText.text = "<color=#00FF3F>收起</color>";
- rect.sizeDelta = new Vector2(360,354);
- more.SetActive(true);
- gcywLayer.SetTaskImgPanelData(InfoData.task_items);
- }
- moreMessage = !moreMessage;
- }
- public void SetData(GCYWLayer baseLayer,B08_TaskInfoData data,int typeIndex)
- {
- gcywLayer = baseLayer;
- InfoData = data;
- string typeStr = "";
- switch (typeIndex)
- {
- case 0:
- typeStr = "电气";
- break;
- case 1:
- typeStr = "闸站";
- break;
- case 2:
- typeStr = "堤防";
- break;
- case 3:
- typeStr = "交叉建筑";
- break;
- case 4:
- typeStr = "定期专项";
- break;
- }
- typeText.text = typeStr;
- titleText.text = data.type;
- stateText.text = data.status;
- dateText.text = data.start_time;
- for (int i = 0; i < PointItems.Count; i++)
- {
- Destroy(PointItems[i].gameObject);
- }
- PointItems.Clear();
- for (int i = 0; i < data.task_items.Length; i++)
- {
- B08_TaskPointItem tempItem = Instantiate(pointItemPrefab,itemContent).GetComponent<B08_TaskPointItem>();
- tempItem.SetData(baseLayer,data.task_items[i],i,data.start_time);
- var button = tempItem.GetComponent<ExtendedButton_PointItem>();
- button.index = i;
- button.onPointerEnter += baseLayer.SetTaskPointIconHeightLight;
- PointItems.Add(tempItem);
- }
- }
- }
|