소수점처리
This commit is contained in:
@@ -91,8 +91,8 @@ public class BubbleUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
}
|
||||
datas = new List<string>
|
||||
{
|
||||
sourcedata.total_output.ToString(),
|
||||
sourcedata.total_defects.ToString()
|
||||
IsFourDecimalPlaces(sourcedata.total_output),
|
||||
IsFourDecimalPlaces(sourcedata.total_defects)
|
||||
};
|
||||
detailObject.Set(title,datas);
|
||||
detailObject.GetComponent<RectTransform>().position = rt.position + new Vector3(150f, 75f);
|
||||
@@ -131,8 +131,8 @@ public class BubbleUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
}
|
||||
datas = new List<string>
|
||||
{
|
||||
processordata.total_input.ToString(),
|
||||
processordata.total_processed.ToString()
|
||||
IsFourDecimalPlaces(processordata.total_input),
|
||||
IsFourDecimalPlaces(processordata.total_processed)
|
||||
};
|
||||
detailObject.Set(title, datas);
|
||||
detailObject.GetComponent<RectTransform>().position = rt.position + new Vector3(150f, 75f);
|
||||
@@ -146,8 +146,8 @@ public class BubbleUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
}
|
||||
datas = new List<string>
|
||||
{
|
||||
queuedata.current_length.ToString(),
|
||||
queuedata.capacity.ToString()
|
||||
IsFourDecimalPlaces(queuedata.current_length),
|
||||
IsFourDecimalPlaces(queuedata.capacity)
|
||||
};
|
||||
detailObject.Set(title, datas);
|
||||
detailObject.GetComponent<RectTransform>().position = rt.position + new Vector3(150f, 75f);
|
||||
@@ -161,8 +161,8 @@ public class BubbleUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
}
|
||||
datas = new List<string>
|
||||
{
|
||||
storedata.current_length.ToString(),
|
||||
storedata.capacity.ToString()
|
||||
IsFourDecimalPlaces(storedata.current_length),
|
||||
IsFourDecimalPlaces(storedata.capacity)
|
||||
};
|
||||
detailObject.Set(title, datas);
|
||||
detailObject.GetComponent<RectTransform>().position = rt.position + new Vector3(150f, 75f);
|
||||
@@ -176,11 +176,11 @@ public class BubbleUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
}
|
||||
datas = new List<string>
|
||||
{
|
||||
resourcedata.requesters.ToString(),
|
||||
resourcedata.claimers.ToString(),
|
||||
resourcedata.available.ToString(),
|
||||
resourcedata.original_capacity.ToString(),
|
||||
resourcedata.utilization.ToString()
|
||||
IsFourDecimalPlaces(resourcedata.requesters),
|
||||
IsFourDecimalPlaces(resourcedata.claimers),
|
||||
IsFourDecimalPlaces(resourcedata.available),
|
||||
IsFourDecimalPlaces(resourcedata.original_capacity),
|
||||
IsFourDecimalPlaces(resourcedata.utilization),
|
||||
};
|
||||
detailObject.Set(title, datas);
|
||||
detailObject.GetComponent<RectTransform>().position = rt.position + new Vector3(150f, 100f);
|
||||
@@ -202,6 +202,18 @@ public class BubbleUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
}
|
||||
}
|
||||
|
||||
private string IsFourDecimalPlaces(float value)
|
||||
{
|
||||
string numberString = value.ToString();
|
||||
int decimalIndex = numberString.IndexOf('.');
|
||||
|
||||
if (decimalIndex == -1)
|
||||
{
|
||||
return numberString; // 소수점이 없는 경우
|
||||
}
|
||||
|
||||
return numberString.Length - decimalIndex - 1 >= 4 ? string.Format("{0:N4}", value) : numberString ;
|
||||
}
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (detailObject)
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace Octopus.Simulator.Networks
|
||||
onParameterRecived += FindAnyObjectByType<ProjectDataManager>().RequestInfo;
|
||||
onParameterRecived += FindAnyObjectByType<LogicDataManager>().RequestInfo;
|
||||
#if UNITY_EDITOR
|
||||
config.projectId = "40";
|
||||
config.projectId = "37";
|
||||
//config.simulationId = "15";
|
||||
config.logicId = "45";
|
||||
config.logicId = "42";
|
||||
WebParameters.config = config;
|
||||
onParameterRecived?.Invoke();
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user