설비 KPI 기능 수정

This commit is contained in:
정영민
2025-03-12 14:57:35 +09:00
parent 9edc6024ae
commit 2e6c32e3e6
5 changed files with 64 additions and 140 deletions

View File

@@ -1685,8 +1685,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: -56}
m_SizeDelta: {x: 308, y: 112}
m_AnchoredPosition: {x: 0, y: -137}
m_SizeDelta: {x: 308, y: 274}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6656413928951007973
CanvasRenderer:

View File

@@ -84778,7 +84778,7 @@ GameObject:
- component: {fileID: 220109442}
- component: {fileID: 220109441}
- component: {fileID: 220109440}
m_Layer: 7
m_Layer: 11
m_Name: Cube_6
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -108511,7 +108511,7 @@ GameObject:
- component: {fileID: 313012295}
- component: {fileID: 313012294}
- component: {fileID: 313012293}
m_Layer: 7
m_Layer: 11
m_Name: Cube_1
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -110082,7 +110082,7 @@ GameObject:
- component: {fileID: 314982084}
- component: {fileID: 314982083}
- component: {fileID: 314982082}
m_Layer: 7
m_Layer: 11
m_Name: Cube_2
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -126654,7 +126654,7 @@ GameObject:
- component: {fileID: 391479153}
- component: {fileID: 391479152}
- component: {fileID: 391479151}
m_Layer: 7
m_Layer: 11
m_Name: Cube_3
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -128135,7 +128135,7 @@ GameObject:
- component: {fileID: 400024086}
- component: {fileID: 400024085}
- component: {fileID: 400024084}
m_Layer: 7
m_Layer: 11
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -146062,7 +146062,7 @@ GameObject:
- component: {fileID: 474321682}
- component: {fileID: 474321681}
- component: {fileID: 474321680}
m_Layer: 7
m_Layer: 11
m_Name: Cube_5
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -148389,7 +148389,7 @@ GameObject:
- component: {fileID: 482747055}
- component: {fileID: 482747054}
- component: {fileID: 482747053}
m_Layer: 7
m_Layer: 11
m_Name: Cube_6
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -192820,7 +192820,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 666557958}
m_Layer: 0
m_Layer: 11
m_Name: 2F_Grounds
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -199671,6 +199671,11 @@ PrefabInstance:
propertyPath: m_Name
value: MDL_5rh_floor_Ground
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 8e46f05fdea0fc64b8096e05f59e93d9,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@@ -225864,7 +225869,7 @@ GameObject:
- component: {fileID: 800788924}
- component: {fileID: 800788923}
- component: {fileID: 800788922}
m_Layer: 7
m_Layer: 11
m_Name: Cube_8
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -261745,7 +261750,7 @@ GameObject:
- component: {fileID: 954287696}
- component: {fileID: 954287695}
- component: {fileID: 954287694}
m_Layer: 7
m_Layer: 11
m_Name: Cube_7
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -279668,7 +279673,7 @@ GameObject:
- component: {fileID: 1024663396}
- component: {fileID: 1024663395}
- component: {fileID: 1024663394}
m_Layer: 7
m_Layer: 11
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -290113,7 +290118,7 @@ GameObject:
- component: {fileID: 1062637180}
- component: {fileID: 1062637179}
- component: {fileID: 1062637178}
m_Layer: 7
m_Layer: 11
m_Name: Cube_3
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -328193,7 +328198,7 @@ GameObject:
- component: {fileID: 1228365819}
- component: {fileID: 1228365818}
- component: {fileID: 1228365817}
m_Layer: 7
m_Layer: 11
m_Name: Cube_2
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -406228,7 +406233,7 @@ GameObject:
- component: {fileID: 1537985090}
- component: {fileID: 1537985089}
- component: {fileID: 1537985088}
m_Layer: 7
m_Layer: 11
m_Name: Cube_8
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -408602,7 +408607,7 @@ GameObject:
- component: {fileID: 1551907683}
- component: {fileID: 1551907682}
- component: {fileID: 1551907681}
m_Layer: 7
m_Layer: 11
m_Name: Cube_5
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -411698,7 +411703,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1564453275}
m_Layer: 0
m_Layer: 11
m_Name: 1F_Grounds
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -425261,7 +425266,7 @@ GameObject:
- component: {fileID: 1620351730}
- component: {fileID: 1620351729}
- component: {fileID: 1620351728}
m_Layer: 7
m_Layer: 11
m_Name: Cube_1
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -486278,7 +486283,7 @@ GameObject:
- component: {fileID: 1860294057}
- component: {fileID: 1860294056}
- component: {fileID: 1860294055}
m_Layer: 7
m_Layer: 11
m_Name: Cube_4
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -559730,7 +559735,10 @@ MonoBehaviour:
prefab_MachineKPI: {fileID: 0}
defaultNameHeight: 1.5
radius: 50
originScale: {x: 1, y: 1, z: 1}
originScale: {x: 0.8, y: 0.8, z: 0.8}
minScale: 0
maxScale: 1
scaleClamp: 1
--- !u!1 &3008398478103445197
GameObject:
m_ObjectHideFlags: 0

View File

@@ -22,6 +22,12 @@ namespace CHN
public float radius;
public Vector3 originScale;
[Range(0.1f, 0.5f)]
public float minScale;
[Range(0.5f, 1f)]
public float maxScale;
[Range(0.1f, 2f)]
public float scaleClamp;
public void SetMachineKPI(MachineKPIData machineKPIData)
{
foreach (var item in machineKPIs)
@@ -70,6 +76,7 @@ namespace CHN
}
current_MachineKPI = machineKPI;
current_MachineKPI.Expand();
current_MachineKPI.transform.SetAsLastSibling();
}
private void Update()
{
@@ -91,16 +98,6 @@ namespace CHN
}
}
}
bool Test(Machine machine)
{
Vector3 viewPos = cam.camera.WorldToViewportPoint(machine.centerPos);
if (viewPos.x >= 0 && viewPos.x <= 1 &&viewPos.y >= 0 && viewPos.y <= 1 && viewPos.z > 0)
{
return true;
}
return false;
}
void SettingPos()
{
foreach (var machine in matchingMachines)
@@ -116,36 +113,24 @@ namespace CHN
}
void RangeDetection()
{
var colliders = Physics.OverlapSphere(cam.camera.transform.position, radius);
HashSet<Machine> machinesInRange = new HashSet<Machine>();
var layerMask = LayerMask.GetMask("Camera", "Floor Wall");
var layerMask = LayerMask.GetMask("Camera", "Floor Wall", "Floor Ground");
var currentFloor = FindSingle<Building>().currentFloor;
foreach (var collider in colliders)
{
var machine = collider.GetComponent<Machine>();
if (matchingMachines.Contains(machine))
{
if (machine.GetComponentInParent<Floor>() != currentFloor)
continue;
MachineKPIsActive(machine, layerMask);
var distance = Vector3.Distance(cam.transform.position, machine.centerPos);
var machineKPI = machine.machineKPI;
machineKPI.transform.localScale = !machineKPI.isExpand ? (radius - distance) / radius * originScale : originScale;
}
machinesInRange.Add(machine);
}
var max = cam.option.maxDistance - cam.option.minDistance;
var distance = cam.option.currentDistance;
var distanceScale = (max - distance) / max;
distanceScale *= scaleClamp;
distanceScale = Mathf.Clamp(distanceScale, minScale, maxScale);
foreach (var machine in matchingMachines)
{
if (!machinesInRange.Contains(machine))
{
machine.machineKPI.Deactive();
}
if (machine.GetComponentInParent<Floor>() != currentFloor)
continue;
MachineKPIsActive(machine, layerMask);
var machineKPI = machine.machineKPI;
machineKPI.transform.localScale = originScale * distanceScale;
}
}
void MachineKPIsActive(Machine machine, LayerMask layerMask)
@@ -159,9 +144,6 @@ namespace CHN
if (hitCameraLayer)
{
if (!Test(machine))
return;
machine.machineKPI.Active();
}
else

View File

@@ -22,13 +22,6 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
public bool isExpand;
private float eorate;
public float targetHeight;
public float duration;
private float initialHeight;
private Vector2 initialSizeDelta;
private Vector2 initialPosition;
public Action<UI_MachineKPI> onClickKPI;
public void SetData(KPIData kpiData)
@@ -42,10 +35,6 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
goodqtyrate.SetText(DecimalPointCalculate(kpiData.goodqtyrate).ToString());
porate.SetText(DecimalPointCalculate(kpiData.porate).ToString());
initialSizeDelta = DetailsKPI.sizeDelta;
initialPosition = DetailsKPI.anchoredPosition;
initialHeight = DetailsKPI.rect.height;
DetailsKPI.gameObject.SetActive(false);
}
private float DecimalPointCalculate(string value)
@@ -55,57 +44,6 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
return floatValue;
}
IEnumerator ResizeCoroutine()
{
DefaultKPI.gameObject.SetActive(false);
DetailsKPI.gameObject.SetActive(true);
var elapsedTime = 0f;
while (elapsedTime < duration)
{
var progress = elapsedTime / duration;
var newHeight = Mathf.Lerp(initialHeight, targetHeight, progress);
DetailsKPI.sizeDelta = new Vector2(initialSizeDelta.x, newHeight);
var newPosY = Mathf.Lerp(initialPosition.y, initialPosition.y - (targetHeight - initialHeight) / 2f, progress);
DetailsKPI.anchoredPosition = new Vector2(initialPosition.x, newPosY);
elapsedTime += Time.deltaTime;
yield return null;
}
DetailsKPI.sizeDelta = new Vector2(initialSizeDelta.x, targetHeight);
DetailsKPI.anchoredPosition = new Vector2(initialPosition.x, initialPosition.y - (targetHeight - initialHeight) / 2f);
}
IEnumerator ShrinkCoroutine()
{
var elapsedTime = 0f;
var currentHeight = DetailsKPI.rect.height;
var currentPosY = DetailsKPI.anchoredPosition.y;
while (elapsedTime < duration)
{
var progress = elapsedTime / duration;
var newHeight = Mathf.Lerp(currentHeight, initialHeight, progress);
DetailsKPI.sizeDelta = new Vector2(initialSizeDelta.x, newHeight);
var newPosY = Mathf.Lerp(currentPosY, initialPosition.y, progress);
DetailsKPI.anchoredPosition = new Vector2(initialPosition.x, newPosY);
elapsedTime += Time.deltaTime;
yield return null;
}
DetailsKPI.sizeDelta = new Vector2(initialSizeDelta.x, initialHeight);
DetailsKPI.anchoredPosition = new Vector2(initialPosition.x, initialPosition.y);
DefaultKPI.gameObject.SetActive(true);
DetailsKPI.gameObject.SetActive(false);
}
public void OnPointerClick(PointerEventData eventData)
{
onClickKPI?.Invoke(this);
@@ -114,8 +52,8 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
{
if (!isExpand)
{
StopAllCoroutines();
StartCoroutine(ResizeCoroutine());
DefaultKPI.gameObject.SetActive(false);
DetailsKPI.gameObject.SetActive(true);
isExpand = true;
}
}
@@ -123,9 +61,8 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
{
if (isExpand)
{
StopAllCoroutines();
StartCoroutine(ShrinkCoroutine());
DefaultKPI.gameObject.SetActive(true);
DetailsKPI.gameObject.SetActive(false);
isExpand = false;
}
}
@@ -134,10 +71,7 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
gameObject.SetActive(true);
}
public void Deactive()
{
DetailsKPI.sizeDelta = initialSizeDelta;
DetailsKPI.anchoredPosition = new Vector2(initialPosition.x, initialPosition.y);
{
DefaultKPI.gameObject.SetActive(true);
DetailsKPI.gameObject.SetActive(false);
isExpand = false;

View File

@@ -642,7 +642,7 @@
"worknm": "Injector No.19",
"workseq": "1",
"status": "1",
"statusnm": "가동",
"statusnm": "가동",
"itemcd": "55511445-1",
"itemdesc": "PIPE-O/PMP SUC (UPPER)",
"pjtcd": "CSS 50V LM2",
@@ -660,7 +660,7 @@
"sttm": "0759",
"totm": "",
"goaltime": "719",
"ptotm": "2025-03-12 19:51:45",
"ptotm": "2025-03-13 14:45:46",
"psttm": "2025-03-11 07:59:35"
},
"isCheck": false
@@ -677,7 +677,7 @@
"worknm": "Injector No.20",
"workseq": "1",
"status": "1",
"statusnm": "가동",
"statusnm": "가동",
"itemcd": "C10024",
"itemdesc": "FUNNEL KIT-F/TK FILL",
"pjtcd": "9BQX",
@@ -1412,7 +1412,7 @@
"worknm": "최종검사-02",
"workseq": "1",
"status": "1",
"statusnm": "식사시간",
"statusnm": "가동중",
"itemcd": "42805124-KOR",
"itemdesc": "SHIELD-RR CLSR HANDS FREE SEN",
"pjtcd": "9BYC(MCM)",
@@ -1465,7 +1465,7 @@
"sttm": "1229",
"totm": "",
"goaltime": "133",
"ptotm": "2025-03-11 17:48:26",
"ptotm": "2025-03-12 17:08:45",
"psttm": "2025-03-11 12:29:20"
},
"isCheck": false
@@ -1517,7 +1517,7 @@
"worknm": "최종검사-07",
"workseq": "1",
"status": "1",
"statusnm": "식사시간",
"statusnm": "가동중",
"itemcd": "24299051-KOR",
"itemdesc": "BAFFLE-FRT DIFF CARR",
"pjtcd": "GF6 GEN3",
@@ -1552,7 +1552,7 @@
"worknm": "최종검사-09",
"workseq": "1",
"status": "1",
"statusnm": "식사시간",
"statusnm": "가동중",
"itemcd": "24298741-GMA",
"itemdesc": "BAFFLE ASM-FRT DIFF CARR",
"pjtcd": "GF9",
@@ -1587,7 +1587,7 @@
"worknm": "최종검사-10",
"workseq": "1",
"status": "1",
"statusnm": "식사시간",
"statusnm": "가동중",
"itemcd": "24298740-GMA",
"itemdesc": "BAFFLE ASM-FRT DIFF CARR",
"pjtcd": "GF9",
@@ -1622,7 +1622,7 @@
"worknm": "최종검사-06",
"workseq": "4",
"status": "1",
"statusnm": "식사시간",
"statusnm": "가동중",
"itemcd": "24299056-SGM",
"itemdesc": "BAFFLE-FRT DIFF CARR",
"pjtcd": "GF6 GEN3",
@@ -1657,7 +1657,7 @@
"worknm": "최종검사-11",
"workseq": "1",
"status": "1",
"statusnm": "식사시간",
"statusnm": "가동중",
"itemcd": "24298737-SGM",
"itemdesc": "BAFFLE ASM-FRT DIFF CARR",
"pjtcd": "GF9",