설비 KPI UI 가시성 개선

This commit is contained in:
정영민
2025-02-25 10:23:33 +09:00
parent 96f4549e7a
commit 3c62a253b7
16 changed files with 4121 additions and 1471 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2f06cd1262ac5414185f7897b2d543be
guid: 9aa8184c1a04bee43a1de58921a5ca09
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 0750312642053cb4dbbe98ff7650f885
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

View File

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 953bbece4bc701249b817d176a397a0a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

View File

@@ -0,0 +1,153 @@
fileFormatVersion: 2
guid: 5eb72a5c503b66647914a148689f3954
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -72,8 +72,6 @@ namespace WI
{
if (IsClickUI)
return;
if (IsOnTheUI)
return;
input.GetInput();
Movement();
var limitCheck = maxRangeLimitter.MoveRangeLimit(nextPosition);

File diff suppressed because it is too large Load Diff

View File

@@ -537927,6 +537927,26 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 870102717076949043, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 870102717076949043, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 870102717076949043, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 870102717076949043, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1523362665566143371, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.x
@@ -537982,6 +538002,26 @@ PrefabInstance:
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2884741858469578461, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2884741858469578461, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2884741858469578461, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2884741858469578461, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3617665121287719749, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.y
@@ -538017,6 +538057,26 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3881160201330421776, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3881160201330421776, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3881160201330421776, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3881160201330421776, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3905519438095063764, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.x
@@ -538037,6 +538097,26 @@ PrefabInstance:
propertyPath: m_Name
value: Canvas_Popup
objectReference: {fileID: 0}
- target: {fileID: 4166823521920760898, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4166823521920760898, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4166823521920760898, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4166823521920760898, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4178052892845385268, guid: c80a8f8cc8344554893e20c68e346e04,
type: 3}
propertyPath: m_AnchorMax.y

1957
Assets/UI_MachineKPI.prefab Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 030c2c8693448634c91aecd1f8154f36
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -16,6 +16,8 @@ namespace CHN
private List<Machine> matchingMachines = new();
private SDictionary<string, UI_MachineKPI> machineKPIs = new();
private UI_MachineKPI current_MachineKPI;
public float defaultNameHeight;
public float radius;
public Vector3 originScale;
@@ -39,6 +41,7 @@ namespace CHN
var machineKPI = Instantiate(prefab_MachineKPI, transform);
machineKPI.SetData(data);
machineKPI.onClickKPI += OnClickMachineKPI;
machineKPI.name = data.workcd;
machineKPIs.Add(data.workcd, machineKPI);
@@ -59,10 +62,34 @@ namespace CHN
}
}
}
private void OnClickMachineKPI(UI_MachineKPI machineKPI)
{
if (current_MachineKPI != null)
{
current_MachineKPI.Shrink();
}
current_MachineKPI = machineKPI;
current_MachineKPI.Expand();
}
private void Update()
{
SettingPos();
RangeDetection();
RectangleContainsPoint();
}
private void RectangleContainsPoint()
{
if (Input.GetMouseButton(0))
{
if (current_MachineKPI == null)
return;
if(!RectTransformUtility.RectangleContainsScreenPoint(current_MachineKPI.DetailsKPI, Input.mousePosition))
{
current_MachineKPI.Shrink();
current_MachineKPI = null;
}
}
}
bool Test(Machine machine)
{

View File

@@ -5,47 +5,48 @@ using UnityEngine.UI;
using TMPro;
using UnityEngine.EventSystems;
using WI;
using System;
public class UI_MachineKPI : UIBase, IPointerEnterHandler, IPointerExitHandler
public class UI_MachineKPI : UIBase, IPointerClickHandler
{
public Image Image_eorate;
public Image Image_RectMask;
public Image Image_Name;
public TextMeshProUGUI Text_eorate;
public TextMeshProUGUI Text_lct;
public TextMeshProUGUI Text_wct;
public TextMeshProUGUI Text_goodqtyrate;
public TextMeshProUGUI Text_porate;
public RectTransform DefaultKPI;
public RectTransform DetailsKPI;
private float originScaleValue;
private float eorate;
private float timer;
private bool isRotating;
private TextMeshProUGUI Default_eorate;
private TextMeshProUGUI Details_eorate;
private TextMeshProUGUI porate;
private TextMeshProUGUI goodqtyrate;
private TextMeshProUGUI lct;
private TextMeshProUGUI wct;
public bool isExpand;
public float duration;
public float pauseTimer;
private float eorate;
public float targetHeight;
public float duration;
private float initialHeight;
private Vector2 initialSizeDelta;
private Vector2 initialPosition;
public Action<UI_MachineKPI> onClickKPI;
public float dataExpandScale;
public float dataReductionScale;
public float nameExpandScale;
public float nameReductionScale;
public float nameExpandPos;
public float nameReductionPos;
public void SetData(KPIData kpiData)
{
eorate = DecimalPointCalculate(kpiData.eorate);
Text_eorate.SetText(eorate.ToString());
Text_lct.SetText(DecimalPointCalculate(kpiData.lct).ToString());
Text_wct.SetText(DecimalPointCalculate(kpiData.wct).ToString());
Text_goodqtyrate.SetText(DecimalPointCalculate(kpiData.goodqtyrate).ToString());
Text_porate.SetText(DecimalPointCalculate(kpiData.porate).ToString());
Default_eorate.SetText(eorate.ToString());
Details_eorate.SetText(eorate.ToString());
lct.SetText(DecimalPointCalculate(kpiData.lct).ToString());
wct.SetText(DecimalPointCalculate(kpiData.wct).ToString());
goodqtyrate.SetText(DecimalPointCalculate(kpiData.goodqtyrate).ToString());
porate.SetText(DecimalPointCalculate(kpiData.porate).ToString());
Image_eorate.color = eorate >= 50f ? Color.green : Color.red;
initialSizeDelta = DetailsKPI.sizeDelta;
initialPosition = DetailsKPI.anchoredPosition;
initialHeight = DetailsKPI.rect.height;
timer = pauseTimer;
originScaleValue = rectTransform.localScale.x;
DetailsKPI.gameObject.SetActive(false);
}
private float DecimalPointCalculate(string value)
{
@@ -54,125 +55,86 @@ public class UI_MachineKPI : UIBase, IPointerEnterHandler, IPointerExitHandler
return floatValue;
}
public void Active()
IEnumerator ResizeCoroutine()
{
gameObject.SetActive(true);
DefaultKPI.gameObject.SetActive(false);
DetailsKPI.gameObject.SetActive(true);
if (!isRotating)
var elapsedTime = 0f;
while (elapsedTime < duration)
{
float rotationAmount = -eorate * Time.deltaTime;
Image_eorate.transform.Rotate(new Vector3(0, 0, rotationAmount));
var progress = elapsedTime / duration;
if (Mathf.Abs(Image_eorate.transform.rotation.eulerAngles.z) <= 180)
{
Image_eorate.transform.localRotation = Quaternion.Euler(Vector3.zero);
isRotating = true;
timer = pauseTimer;
}
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;
}
else
{
timer -= Time.deltaTime;
if (timer <= 0)
{
isRotating = false;
}
}
}
public void Deactive()
{
var originalScale = Image_RectMask.rectTransform.sizeDelta;
var originalNameScale = Image_Name.rectTransform.sizeDelta;
var originalNamePos = Image_Name.rectTransform.localPosition;
var targetScale = new Vector2(0f, originalScale.y);
var targetNameScale = new Vector2(originalNameScale.x, 0f);
var targetNamePos = new Vector3(originalNamePos.x, 0f, originalNamePos.z);
Image_RectMask.rectTransform.sizeDelta = targetScale;
Image_Name.rectTransform.sizeDelta = targetNameScale;
Image_Name.rectTransform.localPosition = targetNamePos;
gameObject.SetActive(false);
DetailsKPI.sizeDelta = new Vector2(initialSizeDelta.x, targetHeight);
DetailsKPI.anchoredPosition = new Vector2(initialPosition.x, initialPosition.y - (targetHeight - initialHeight) / 2f);
}
public void OnPointerEnter(PointerEventData eventData)
IEnumerator ShrinkCoroutine()
{
var expandAbleScale = originScaleValue / 8f;
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);
}
public void Expand()
{
if (!isExpand)
{
if (rectTransform.localScale.x > expandAbleScale)
{
isRotating = false;
timer = 0.0f;
StopAllCoroutines();
StartCoroutine(ExpandAnimation());
isExpand = true;
}
StopAllCoroutines();
StartCoroutine(ResizeCoroutine());
isExpand = true;
}
}
public void OnPointerExit(PointerEventData eventData)
public void Shrink()
{
if (isExpand)
{
StopAllCoroutines();
StartCoroutine(ReductionAnimation());
StartCoroutine(ShrinkCoroutine());
isExpand = false;
}
}
private IEnumerator ExpandAnimation()
public void Active()
{
var originalScale = Image_RectMask.rectTransform.sizeDelta;
var originalNameScale = Image_Name.rectTransform.sizeDelta;
var originalNamePos = Image_Name.rectTransform.localPosition;
var targetScale = new Vector2(dataExpandScale, originalScale.y);
var targetNameScale = new Vector2(originalNameScale.x, nameExpandScale);
var targetNamePos = new Vector3(originalNamePos.x, nameExpandPos, originalNamePos.z);
float elapsedTime = 0f;
while (elapsedTime < duration)
{
var progress = elapsedTime / duration;
Image_RectMask.rectTransform.sizeDelta = Vector2.Lerp(originalScale, targetScale, progress);
Image_Name.rectTransform.sizeDelta = Vector2.Lerp(originalNameScale, targetNameScale, progress);
Image_Name.rectTransform.localPosition = Vector3.Lerp(originalNamePos, targetNamePos, progress);
elapsedTime += Time.deltaTime;
yield return null;
}
Image_RectMask.rectTransform.sizeDelta = targetScale;
Image_Name.rectTransform.sizeDelta = targetNameScale;
Image_Name.rectTransform.localPosition = targetNamePos;
gameObject.SetActive(true);
}
private IEnumerator ReductionAnimation()
public void Deactive()
{
var originalScale = Image_RectMask.rectTransform.sizeDelta;
var originalNameScale = Image_Name.rectTransform.sizeDelta;
var originalNamePos = Image_Name.rectTransform.localPosition;
var targetScale = new Vector2(dataReductionScale, originalScale.y);
var targetNameScale = new Vector2(originalNameScale.x, nameReductionScale);
var targetNamePos = new Vector3(originalNamePos.x, nameReductionPos, originalNamePos.z);
float elapsedTime = 0f;
while (elapsedTime < duration)
{
var progress = elapsedTime / duration;
Image_RectMask.rectTransform.sizeDelta = Vector2.Lerp(originalScale, targetScale, progress);
Image_Name.rectTransform.sizeDelta = Vector2.Lerp(originalNameScale, targetNameScale, progress);
Image_Name.rectTransform.localPosition = Vector3.Lerp(originalNamePos, targetNamePos, progress);
elapsedTime += Time.deltaTime;
yield return null;
}
Image_RectMask.rectTransform.sizeDelta = targetScale;
Image_Name.rectTransform.sizeDelta = targetNameScale;
Image_Name.rectTransform.localPosition = targetNamePos;
gameObject.SetActive(false);
}
}