60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using TMPro;
|
||
using UnityEngine;
|
||
|
||
namespace XED
|
||
{
|
||
public class StackerCraneTestUI : MonoBehaviour
|
||
{
|
||
StackerCrane stackerCrane;
|
||
|
||
public TextMeshProUGUI text_time;
|
||
public TextMeshProUGUI text_currentWork;
|
||
public TextMeshProUGUI text_work;
|
||
|
||
float time;
|
||
Queue<StackerCraneTask> workqueue;
|
||
|
||
void Start()
|
||
{
|
||
stackerCrane = FindSingle<StackerCrane>();
|
||
}
|
||
|
||
void Update()
|
||
{
|
||
workqueue = stackerCrane.taskQueue;
|
||
time += Time.deltaTime;
|
||
text_currentWork.text = stackerCrane.currentTask.taskType.ToString();
|
||
text_time.text = time.ToString("N2");
|
||
text_work.text = "";
|
||
foreach (StackerCraneTask task in workqueue)
|
||
{
|
||
text_work.text += task.taskType + "\n";
|
||
}
|
||
|
||
for (int i = 0; i <= 9; i++)
|
||
{
|
||
if (Input.GetKeyDown((KeyCode)Enum.Parse(typeof(KeyCode), "Alpha" + i)))
|
||
{
|
||
if (i > workqueue.Count)
|
||
{
|
||
Debug.LogWarning("Á¸ÀçÇÏÁö ¾Ê´Â taskÀÔ´Ï´Ù.");
|
||
return;
|
||
}
|
||
|
||
int currentIndex = 0;
|
||
foreach (StackerCraneTask work in workqueue)
|
||
{
|
||
currentIndex++;
|
||
if (currentIndex == i)
|
||
{
|
||
stackerCrane.PredictWorkEndTime(work);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|