Объединяю с работой dfilipkin

This commit is contained in:
FreshMix committed 2026-04-28 20:44:24 +03:00
1 parent 05bd220cad
commit b167fc448f
240 files changed
+315725 -12011

No files matched your search

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Palmmedia.ReportGenerator.Core;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
using UnityEngine.Rendering;
@@ -36,39 +37,54 @@ public class MachineCoordinatesMovementScript : MonoBehaviour
[SerializeField]
bool TestProgramStart;
[SerializeField]
bool DebugStart = false;
[SerializeField]
bool DebugStart = false;
[SerializeField]
[SerializeField]
bool Restart = false;
// Ôëàã ðàáîòû, ïî íåìó ïðîâåðÿåòñÿ, âûïîëíÿåòñÿ ëè ñåé÷àñ êàêàÿ-ëèáî ïðîãðàììà
bool WorkInProgress = false;
[SerializeField]
List<bool> InsertedMaterials;
[SerializeField]
List<bool> InsertedMaterials;
[SerializeField]
List<bool> InsertedReels;
List<bool> InsertedReels;
bool ReadyToWork = false;
bool ReelsReady = false;
// Íîìåð îáúåêòà â CurrentProgram, ê êîòîðîìó äâèãàòüñÿ
int CurrentStep = 0;
[SerializeField]
List<Vector3> testProgr;
List<Vector3> CurrentProgram;
[SerializeField]
List<Vector3> PalmTreeProg;
// Ãðàíèöû ïî êîîðäèíàòàì: (0.435, 0.02, 0.4125)
[SerializeField]
List<Vector3> _ComponentsHoldersCords;
[SerializeField]
// Íîìåð îáúåêòà â CurrentProgram, ê êîòîðîìó äâèãàòüñÿ
static public int CurrentStep = 0 ;
static public List<Vector3> CurrentProgram { get; private set; }
static public List<Vector3> ComponentsHoldersCords { get; private set; }
// Ãðàíèöû ïî êîîðäèíàòàì: (0.435, 0.02, 0.4125)
[SerializeField]
GameObject Board;
void Start()
{
//DiagonalMoveDbg = false;
for (int i = 0; i < MaterialsToInsert; i++)
ComponentsHoldersCords = _ComponentsHoldersCords;
CurrentProgram = new(PalmTreeProg);
//DiagonalMoveDbg = false;
for (int i = 0; i < MaterialsToInsert; i++)
{
InsertedMaterials.Add(false);
InsertedReels.Add(false);
@@ -166,23 +182,23 @@ public class MachineCoordinatesMovementScript : MonoBehaviour
ReelsReady = true;
}
public void MaterialRemoved(int index)
{
InsertedMaterials[index] = false;
public void MaterialRemoved(int index)
{
InsertedMaterials[index] = false;
ReadyToWork = false;
}
ReadyToWork = false;
}
public void ReelRemoved(int index)
{
InsertedReels[index] = false;
{
InsertedReels[index] = false;
ReelsReady = false;
}
ReelsReady = false;
}
// Âîçâðàùàåò true, êîãäà íàõîäèòñÿ â êîîðäèíàòå, êîòîðóþ ñîîáùèëè
bool MoveTo(Vector3 cords)
// Âîçâðàùàåò true, êîãäà íàõîäèòñÿ â êîîðäèíàòå, êîòîðóþ ñîîáùèëè
bool MoveTo(Vector3 cords)
{
float XMoveDistance = cords.x - XAxis.localPosition.x;
float YMoveDistance = cords.y - YAxis.localPosition.y;
@@ -257,11 +273,7 @@ public class MachineCoordinatesMovementScript : MonoBehaviour
}
// Ãðàíèöû ïî êîîðäèíàòàì: (0.435, 0.02, 0.4125)
[SerializeField]
List<Vector3> testProgr;
[SerializeField]
List<Vector3> PalmTreeProg;
public void StartWorkFromButton()
{
+1 -4
View File
@@ -9,9 +9,6 @@ public class PlateProgramCreator : MonoBehaviour
[SerializeField]
List<GameObject> ComponentsToInstallParents;
[SerializeField]
List<Vector3> ComponentsHoldersCords;
[SerializeField]
Transform StartCord;
@@ -39,7 +36,7 @@ public class PlateProgramCreator : MonoBehaviour
RelativeCords = new(Mathf.Abs(RelativeCords.x), Mathf.Abs(RelativeCords.y), Mathf.Abs(RelativeCords.z));
Program.Add(ComponentsHoldersCords[i]);
Program.Add(MachineCoordinatesMovementScript.ComponentsHoldersCords[i]);
Program.Add(RelativeCords);
}
}
+45
View File
@@ -0,0 +1,45 @@
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class PositionListElement : MonoBehaviour
{
[SerializeField] private List<string> propertyTitle = new List<string>();
[SerializeField] private List<TextMeshProUGUI> propertyTextObject = new List<TextMeshProUGUI>();
public Color HighlightedColor;
// Runtime dictionary (not serialized)
public Dictionary<string, TextMeshProUGUI> propertiesDatabase { get; private set; }
private void Awake()
{
BuildDictionary();
}
private void BuildDictionary()
{
propertiesDatabase = new Dictionary<string, TextMeshProUGUI>();
for (int i = 0; i < propertyTitle.Count && i < propertyTextObject.Count; i++)
{
propertiesDatabase[propertyTitle[i]] = propertyTextObject[i];
}
}
public void SetProperty(string propertyName, string value)
{
propertiesDatabase[propertyName].text = value;
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 254bdd637fc33a04fa160f6f9c60efd6
+99
View File
@@ -0,0 +1,99 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class PositionListScript : MonoBehaviour
{
[SerializeField]
PositionListElement _positionListElementTemplate;
[SerializeField]
List<PositionListElement> _positionsList = new();
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
StartCoroutine(waitForMachineInit());
}
private IEnumerator waitForMachineInit()
{
while (MachineCoordinatesMovementScript.CurrentProgram == null) { yield return null; }
fillList();
}
private void fillList()
{
PositionListElement newElement;
for (int i = 1; i < MachineCoordinatesMovementScript.CurrentProgram.Count; i+=2)
{
newElement = createNewElementObject(-1f * (i - 1) * _positionListElementTemplate.GetComponent<RectTransform>().rect.height/2);
_positionsList.Add(newElement);
newElement.SetProperty("No", _positionsList.Count.ToString());
int smdComponentIndex = MachineCoordinatesMovementScript.ComponentsHoldersCords.IndexOf(
MachineCoordinatesMovementScript.CurrentProgram[i-1]);
newElement.SetProperty("Type", smdComponentIndex.ToString());
switch (smdComponentIndex)
{
case 0:
newElement.SetProperty("Name", "R6");
break;
case 1:
newElement.SetProperty("Name", "C2");
break;
case 2:
newElement.SetProperty("Name", "C1");
break;
case 3:
newElement.SetProperty("Name", "LED3");
break;
default:
break;
}
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)
{
GameObject newObject = Instantiate(_positionListElementTemplate.gameObject, _positionListElementTemplate.transform.parent);
newObject.GetComponent<RectTransform>().localPosition = new(0, y_pos, 0);
newObject.SetActive(true);
return newObject.GetComponent<PositionListElement>();
}
// Update is called once per frame
void Update()
{
if (MachineCoordinatesMovementScript.CurrentStep == 0) return;
//{ _positionsList[MachineCoordinatesMovementScript.CurrentStep]}
if (MachineCoordinatesMovementScript.CurrentStep % 2 == 0)
{
PositionListElement currentElement = _positionsList[MachineCoordinatesMovementScript.CurrentStep-1];
currentElement.GetComponent<Image>().color = currentElement.HighlightedColor;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8cb1b85beb304354d864b6d550a8303b