8using System.Collections;
9using System.Collections.Generic;
33 int curCount, lineCount;
37 static Transform stTr;
38 static GameObject[] stLines;
39 static int stNumLines;
51 stLines =
new GameObject[stNumLines];
53 for (
int i = 0; i < stNumLines; i++)
55 stLines[i] =
new GameObject();
56 stLines[i].SetActive(
false);
57 stLines[i].name =
"Line_" + i;
58 stLines[i].transform.parent = stTr;
63 StartCoroutine(DrawGraph());
76 curCount = StFPS.Counter(
frameUpdate, Time.deltaTime);
86 IEnumerator DrawGraph()
94 GameObject obj = GiveLine();
96 img.rectTransform.anchorMin =
new Vector2(ofsetX, 0);
98 img.rectTransform.offsetMax = img.rectTransform.offsetMin =
new Vector2(0, 0);
103 foreach (Transform child
in graph) child.gameObject.SetActive(
false);
104 ofsetX = lineCount = 0;
106 else ofsetX += 0.02f;
116 static GameObject GiveLine()
120 for (
int i = 0; i < stNumLines; i++)
if (!stLines[i].activeSelf)
return stLines[i];
135public static class StFPS
140 static List<float> fpsBuffer =
new List<float>();
148 public static int Counter(
int frameUpdate,
float deltaTime)
152 int fpsBCount = fpsBuffer.Count;
154 if (fpsBCount <= frameUpdate) fpsBuffer.Add(1.0f / Time.deltaTime);
157 for (
int f = 0; f < fpsBCount; f++) fpsB += fpsBuffer[f];
158 fpsBuffer =
new List<float> { 1.0f / Time.deltaTime };
159 fpsB = fpsB / fpsBCount;
160 fps = Mathf.RoundToInt(fpsB);
System.Drawing.Image Image