Сделал работу кнопок программы, начал делать настройки
This commit is contained in:
1 parent
9e7457b818
commit
a3cccd5530
30 files changed
+15837
-17296
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TMPro;
|
||||
@@ -8,10 +8,10 @@ using UnityEngine.UI;
|
||||
public class PositionListScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
PositionListElement _positionListElementTemplate;
|
||||
UIListElement _ElementTemplate;
|
||||
|
||||
[SerializeField]
|
||||
List<PositionListElement> _positionsList = new();
|
||||
List<UIListElement> _positionsList = new();
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
@@ -29,11 +29,11 @@ public class PositionListScript : MonoBehaviour
|
||||
|
||||
private void fillList()
|
||||
{
|
||||
PositionListElement newElement;
|
||||
UIListElement newElement;
|
||||
|
||||
for (int i = 1; i < MachineCoordinatesMovementScript.CurrentProgram.Count; i += 2)
|
||||
{
|
||||
newElement = createNewElementObject(-1f * (i - 1) * _positionListElementTemplate.GetComponent<RectTransform>().rect.height / 2);
|
||||
newElement = createNewElementObject(-1f * (i - 1) * _ElementTemplate.GetComponent<RectTransform>().rect.height / 2);
|
||||
|
||||
_positionsList.Add(newElement);
|
||||
|
||||
@@ -47,19 +47,23 @@ public class PositionListScript : MonoBehaviour
|
||||
{
|
||||
case 0:
|
||||
newElement.SetProperty("Name", "R6");
|
||||
break;
|
||||
newElement.SetProperty("A", "0");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
newElement.SetProperty("Name", "C2");
|
||||
break;
|
||||
newElement.SetProperty("A", "90");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
newElement.SetProperty("Name", "C1");
|
||||
break;
|
||||
newElement.SetProperty("A", "90");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
newElement.SetProperty("Name", "LED3");
|
||||
break;
|
||||
newElement.SetProperty("A", "0");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -68,26 +72,32 @@ public class PositionListScript : MonoBehaviour
|
||||
newElement.SetProperty("X", MachineCoordinatesMovementScript.CurrentProgram[i].x.ToString());
|
||||
newElement.SetProperty("Y", MachineCoordinatesMovementScript.CurrentProgram[i].y.ToString());
|
||||
newElement.SetProperty("Z", MachineCoordinatesMovementScript.CurrentProgram[i].z.ToString());
|
||||
newElement.SetProperty("A", "1");
|
||||
newElement.SetProperty("Val", "1");
|
||||
newElement.SetProperty("Feeder", "B");
|
||||
}
|
||||
}
|
||||
|
||||
private PositionListElement createNewElementObject(float y_pos)
|
||||
private UIListElement createNewElementObject(float y_pos)
|
||||
{
|
||||
GameObject newObject = Instantiate(_positionListElementTemplate.gameObject, _positionListElementTemplate.transform.parent);
|
||||
GameObject newObject = Instantiate(_ElementTemplate.gameObject, _ElementTemplate.transform.parent);
|
||||
newObject.GetComponent<RectTransform>().localPosition = new(0, y_pos, 0);
|
||||
|
||||
newObject.SetActive(true);
|
||||
return newObject.GetComponent<PositionListElement>();
|
||||
return newObject.GetComponent<UIListElement>();
|
||||
}
|
||||
|
||||
private void OnStepUpdate(int step)
|
||||
{
|
||||
{
|
||||
if (step == 0)
|
||||
{
|
||||
foreach (UIListElement element in _positionsList) { // Сброс на случай, если начата работа заново после остановки
|
||||
element.SetProperty("State", "");
|
||||
}
|
||||
}
|
||||
|
||||
if (step % 2 == 0)
|
||||
{
|
||||
PositionListElement currentElement = _positionsList[step / 2];
|
||||
UIListElement currentElement = _positionsList[step / 2];
|
||||
|
||||
currentElement.SetProperty("State", "Work");
|
||||
|
||||
@@ -95,7 +105,7 @@ public class PositionListScript : MonoBehaviour
|
||||
|
||||
if (step == 0) return;
|
||||
|
||||
PositionListElement prevElement = _positionsList[(step / 2) - 1];
|
||||
UIListElement prevElement = _positionsList[(step / 2) - 1];
|
||||
|
||||
prevElement.SetProperty("State", "Ok");
|
||||
|
||||
|
||||
Reference in new issue
Block a user