123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class B08_EventListItem : MonoBehaviour
- {
- public B08_TaskData data;
-
- public Text nameText;
- public Text dateText;
- public Text managerText;
- public Text stateText;
- public Text ctrlText;
- public GameObject more;
- public Text PlaneDateText;
- public Text CompleteDateText;
- public Text UseTimeText;
- public Text LocalText;
-
- public Button moreButton;
- public bool moreMessage = false;
- public RectTransform rect;
- public void Init(B08_TaskData _data)
- {
- data = _data;
- rect = this.GetComponent<RectTransform>();
- nameText = this.transform.Find("name").GetComponent<Text>();
- dateText = this.transform.Find("date").GetComponent<Text>();
- managerText = this.transform.Find("principal").GetComponent<Text>();
- stateText = this.transform.Find("state").GetComponent<Text>();
- ctrlText = this.transform.Find("ctrl").GetComponent<Text>();
- more = this.transform.Find("more").gameObject;
- PlaneDateText = more.transform.Find("PlaneDate").GetComponent<Text>();
- CompleteDateText = more.transform.Find("CompleteDate").GetComponent<Text>();
- UseTimeText = more.transform.Find("UseTime").GetComponent<Text>();
- LocalText = more.transform.Find("Local").GetComponent<Text>();
- nameText.text = data.title;
- dateText.text = data.updateTime;
- managerText.text = data.transactorName;
- if (data.projectStatus==null||data.projectStatus.Equals(""))
- {
- stateText.text = "<color=#EF491C>未知</color>";
- }
- else
- {
- stateText.text = data.projectStatus;
- }
- PlaneDateText.text = $"计划完成日期:2024/03/16";
- CompleteDateText.text = $"实际完成日期:2024/03/16";
- UseTimeText.text = $"已用时间:0天02:12:67";
- LocalText.text = $"所属部门:安全部";
-
- more.SetActive(false);
-
- moreButton = ctrlText.GetComponent<Button>();
- moreButton.onClick.AddListener(ChangeMoreMessage);
- }
- public void ChangeMoreMessage()
- {
- if (moreMessage)
- {
- ctrlText.text = "详情";
- rect.sizeDelta = new Vector2(360,24);
- more.SetActive(false);
- }
- else
- {
- ctrlText.text = "收起";
- rect.sizeDelta = new Vector2(360,72);
- more.SetActive(true);
- }
- moreMessage = !moreMessage;
- }
- }
|