Files
Studio/Assets/Scripts/XED/Machine/StackerCrane/StackerCraneTestUI.cs
2025-02-19 17:24:26 +09:00

60 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
}
}
}
}
}
}
}