설비 라이브러리 디자인 적용 및 작업 시간 분석 차트 기능 수정
This commit is contained in:
@@ -104,6 +104,7 @@ public class Panel_ToolBar : PanelBase
|
||||
{
|
||||
StopAllCoroutines();
|
||||
capture.StopCapture();
|
||||
Image_Record_Play.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
19
Assets/WorkSpace/Personal/JYM/TestBarChart.cs
Normal file
19
Assets/WorkSpace/Personal/JYM/TestBarChart.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using CHN;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class TestBarChart : MonoBehaviour
|
||||
{
|
||||
private WorkTimeManager test;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
var textData = Resources.Load<TextAsset>("Test");
|
||||
var response = JsonConvert.DeserializeObject<WorkTimeData>(textData.ToString());
|
||||
|
||||
test = FindSingle<WorkTimeManager>();
|
||||
test.SetWorkTimeData(response);
|
||||
}
|
||||
}
|
||||
11
Assets/WorkSpace/Personal/JYM/TestBarChart.cs.meta
Normal file
11
Assets/WorkSpace/Personal/JYM/TestBarChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88590da1ce6ef634888523925f8df0d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,25 +44,12 @@ public class UI_BarChartData : UIBase
|
||||
Vector2 localPoint;
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(parentRectTransform, Input.mousePosition, null, out localPoint);
|
||||
|
||||
Vector2 parentSize = parentRectTransform.rect.size;
|
||||
Vector2 uiSize = rectTransform.rect.size;
|
||||
var parentSize = parentRectTransform.rect.size;
|
||||
var uiSize = rectTransform.rect.size;
|
||||
|
||||
float clampedX = Mathf.Clamp(localPoint.x + offset.x, -parentSize.x / 2 + uiSize.x / 2, parentSize.x / 2 - uiSize.x / 2);
|
||||
float clampedY = Mathf.Clamp(localPoint.y + offset.y, -parentSize.y / 2 + uiSize.y / 2, parentSize.y / 2 - uiSize.y / 2);
|
||||
|
||||
rectTransform.localPosition = new Vector2(clampedX, clampedY);
|
||||
|
||||
rectTransform.localPosition = new Vector2(clampedX, offset.y);
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
if (EventSystem.current.currentSelectedGameObject != null)
|
||||
return;
|
||||
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace CHN
|
||||
|
||||
public void OnOpenDashboardItem(string dashboardKey)
|
||||
{
|
||||
Debug.Log("ÄÑÁü");
|
||||
dashboardItemList[dashboardKey].ToggleOnItem();
|
||||
}
|
||||
public void OnCloseDashbordItem(string dashboardKey)
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace CHN
|
||||
var type = "";
|
||||
switch (keyName)
|
||||
{
|
||||
case ("완료 알람 시간"):
|
||||
case ("완료 시간 알람"):
|
||||
type = "isCompleteAlramHistory";
|
||||
break;
|
||||
case ("라이브러리"):
|
||||
|
||||
57
Assets/WorkSpace/Personal/JYM/UI_StackBar.cs
Normal file
57
Assets/WorkSpace/Personal/JYM/UI_StackBar.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using WI;
|
||||
|
||||
public class UI_StackBar : UIBase
|
||||
{
|
||||
public Image targetImage;
|
||||
public List<float> segmentRatios = new List<float>();
|
||||
|
||||
public Image[] stackedImages;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
targetImage = GetComponent<Image>();
|
||||
var images = transform.GetComponentsInChildren<Image>();
|
||||
stackedImages = images.Where(t => t != targetImage).ToArray();
|
||||
}
|
||||
public void SetStackBar(BarChartData barChartData, Vector3 topPosition, float height)
|
||||
{
|
||||
SetActive(true);
|
||||
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
|
||||
transform.position = topPosition;
|
||||
SetImageRatios(barChartData);
|
||||
}
|
||||
private void SetImageRatios(BarChartData barChartData)
|
||||
{
|
||||
segmentRatios.Clear();
|
||||
segmentRatios.Add(barChartData.etc);
|
||||
segmentRatios.Add(barChartData.holdingPressureTime);
|
||||
segmentRatios.Add(barChartData.weighingTime);
|
||||
segmentRatios.Add(barChartData.coolingTime);
|
||||
|
||||
var parentHeight = targetImage.rectTransform.rect.height;
|
||||
var totalHeight = 0f;
|
||||
|
||||
foreach (var height in segmentRatios)
|
||||
{
|
||||
totalHeight += height;
|
||||
}
|
||||
AdjustChildImagesHeight(parentHeight, totalHeight);
|
||||
}
|
||||
|
||||
void AdjustChildImagesHeight(float parentHeight, float totalHeight)
|
||||
{
|
||||
for (int i = 0; i < stackedImages.Length; i++)
|
||||
{
|
||||
var rectTrnasform = stackedImages[i].rectTransform;
|
||||
|
||||
var newHeight = (segmentRatios[i] / totalHeight) * parentHeight;
|
||||
rectTrnasform.sizeDelta = new Vector2(rectTrnasform.sizeDelta.x, newHeight);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/WorkSpace/Personal/JYM/UI_StackBar.cs.meta
Normal file
11
Assets/WorkSpace/Personal/JYM/UI_StackBar.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d42fbdd7aaee7144794c99934b8766b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user