| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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.createTime;
- managerText.text = data.memberNames;
- stateText.text = data.exportStatus is null or "" ? "<color=#EF491C>未知</color>" : data.exportStatus;
- PlaneDateText.text = $"计划完成日期:{data.planTime}";
- CompleteDateText.text = $"实际完成日期:{data.completeTime}";
- UseTimeText.text = $"";
- LocalText.text = $"";
- // 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;
- }
- }
|