Сделал работу кнопок программы, начал делать настройки
This commit is contained in:
1 parent
9e7457b818
commit
a3cccd5530
30 files changed
+15837
-17296
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class LogsListScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
UIListElement _ElementTemplate;
|
||||
|
||||
private int _lastLogIndex = -1;
|
||||
private UIListElement createNewElementObject(float y_pos)
|
||||
{
|
||||
GameObject newObject = Instantiate(_ElementTemplate.gameObject, _ElementTemplate.transform.parent);
|
||||
newObject.GetComponent<RectTransform>().localPosition = new(0, y_pos, 0);
|
||||
|
||||
newObject.SetActive(true);
|
||||
return newObject.GetComponent<UIListElement>();
|
||||
}
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
MachineCoordinatesMovementScript.OnError.AddListener(addLogLine);
|
||||
|
||||
//UIListElement newElement;
|
||||
|
||||
//for (int i = 0; i < 3; i++)
|
||||
//{
|
||||
// _lastLogIndex++;
|
||||
// newElement = createNewElementObject(-1f * i * _ElementTemplate.GetComponent<RectTransform>().rect.height);
|
||||
// newElement.SetProperty("Text", "Test " + i);
|
||||
//}
|
||||
}
|
||||
|
||||
private void addLogLine(string text)
|
||||
{
|
||||
_lastLogIndex++;
|
||||
UIListElement newElement = createNewElementObject(-1f * _lastLogIndex * _ElementTemplate.GetComponent<RectTransform>().rect.height);
|
||||
newElement.SetProperty("Text", text);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user