Skip to content

Commit b261791

Browse files
committed
update 1.1.2
1 parent d8b68d0 commit b261791

28 files changed

+1312
-3985
lines changed
Binary file not shown.
Binary file not shown.
-417 Bytes
Binary file not shown.
-133 Bytes
Binary file not shown.

Assets/CVVTuberExample/CVVTuber/Examples/FpsMonitor.cs

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace CVVTuberExample
55
{
6+
// v1.0.2
67
public class FpsMonitor : MonoBehaviour
78
{
89
int tick = 0;
@@ -25,7 +26,7 @@ public enum Alignment
2526
const float MARGIN_Y = 10f;
2627
const float INNER_X = 8f;
2728
const float INNER_Y = 5f;
28-
const float GUI_CONSOLE_HEIGHT = 50f;
29+
const float GUI_CONSOLE_HEIGHT = 100f;
2930

3031
public Vector2 offset = new Vector2(MARGIN_X, MARGIN_Y);
3132
public bool boxVisible = true;
@@ -48,7 +49,19 @@ public enum Alignment
4849
int oldScrHeight;
4950

5051
Dictionary<string, string> outputDict = new Dictionary<string, string>();
51-
public string consoleText;
52+
53+
protected string _consoleText = null;
54+
public virtual string consoleText
55+
{
56+
get { return _consoleText; }
57+
set
58+
{
59+
_consoleText = value;
60+
toast_time = -1;
61+
}
62+
}
63+
64+
int toast_time = -1;
5265

5366
// Use this for initialization
5467
void Start()
@@ -75,6 +88,11 @@ void Update()
7588
tick = 0;
7689
elapsed = 0;
7790
}
91+
92+
if (toast_time > 0)
93+
{
94+
toast_time = toast_time - 1;
95+
}
7896
}
7997

8098
void OnGUI()
@@ -105,18 +123,21 @@ void OnGUI()
105123

106124
if (!string.IsNullOrEmpty(consoleText))
107125
{
108-
if (boxVisible)
109-
{
110-
GUI.Box(console_outer, "");
111-
}
112-
113-
GUILayout.BeginArea(console_inner);
126+
if (toast_time != 0)
114127
{
115-
GUILayout.BeginVertical();
116-
GUILayout.Label(consoleText, console_labelStyle);
117-
GUILayout.EndVertical();
128+
if (boxVisible)
129+
{
130+
GUI.Box(console_outer, "");
131+
}
132+
133+
GUILayout.BeginArea(console_inner);
134+
{
135+
GUILayout.BeginVertical();
136+
GUILayout.Label(consoleText, console_labelStyle);
137+
GUILayout.EndVertical();
138+
}
139+
GUILayout.EndArea();
118140
}
119-
GUILayout.EndArea();
120141
}
121142
}
122143

@@ -155,6 +176,12 @@ public void LocateGUI()
155176
console_inner = new Rect(console_x + padding.x, console_y + padding.y, Screen.width - offset.x * 2 - padding.x, consoleHeight);
156177
}
157178

179+
public void Toast(string message, int time = 120)
180+
{
181+
_consoleText = message;
182+
toast_time = (time < 60) ? 60 : time;
183+
}
184+
158185
float GetAlignedX(Alignment anchor, float w)
159186
{
160187
switch (anchor)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace CVVTuberExample
66
{
7-
public class WebCamTextureCVVTuberExample : MonoBehaviour
7+
public class MultiSourceCVVTuberExample : MonoBehaviour
88
{
99
/// <summary>
10-
/// The webcam texture mat source getter.
10+
/// The multi source mat source getter.
1111
/// </summary>
12-
public WebCamTextureMatSourceGetter webCamTextureMatSourceGetter;
12+
public MultiSourceMatSourceGetter multiSourceMatSourceGetter;
1313

1414
/// <summary>
1515
/// The dlib face landmark getter.
@@ -37,7 +37,7 @@ public void OnBackButtonClick()
3737
/// </summary>
3838
public void OnChangeCameraButtonClick()
3939
{
40-
webCamTextureMatSourceGetter.ChangeCamera();
40+
multiSourceMatSourceGetter.ChangeCamera();
4141
}
4242
}
4343
}
Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)