설비 라이브러리 디자인 적용 및 작업 시간 분석 차트 기능 수정
This commit is contained in:
@@ -5,20 +5,37 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using WI;
|
||||
using static ChartAndGraph.BarChart;
|
||||
using TMPro;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class UI_BarChart : UIBase
|
||||
{
|
||||
BarChart barChart;
|
||||
private BarChart barChart;
|
||||
private UI_StackBar stackBar;
|
||||
|
||||
public bool isCycleTimeChart;
|
||||
public List<BarChartData> barChartDatas = new List<BarChartData>();
|
||||
|
||||
public UI_BarChartData barChartData;
|
||||
private bool isClickChart;
|
||||
public override void AfterAwake()
|
||||
{
|
||||
barChart = GetComponentInChildren<BarChart>();
|
||||
stackBar = GetComponentInChildren<UI_StackBar>(true);
|
||||
barChartData = GetComponentInChildren<UI_BarChartData>(true);
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(barChartData.rectTransform, Input.mousePosition))
|
||||
return;
|
||||
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(stackBar.rectTransform, Input.mousePosition))
|
||||
return;
|
||||
|
||||
stackBar.SetActive(false);
|
||||
barChartData.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void SetChartData(List<BarChartData> barChartData)
|
||||
{
|
||||
this.barChartDatas.Clear();
|
||||
@@ -34,10 +51,17 @@ public class UI_BarChart : UIBase
|
||||
}
|
||||
this.barChartDatas.AddRange(barChartData);
|
||||
}
|
||||
|
||||
|
||||
public void OnClickItem(BarEventArgs arg)
|
||||
{
|
||||
int.TryParse(arg.Group, out var index);
|
||||
barChartData.SetData(barChartDatas[index]);
|
||||
|
||||
barChart.GetBarTrackPosition("CycleTime", index.ToString(), out var topPosition);
|
||||
|
||||
var bottomPosition = new Vector3(topPosition.x, rectTransform.rect.yMax - (rectTransform.transform.localPosition.y / 2), 0);
|
||||
var height = Mathf.Abs(topPosition.y - bottomPosition.y);
|
||||
|
||||
stackBar.SetStackBar(barChartDatas[index], topPosition, height);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user