Skip to content

Commit dd7a297

Browse files
committed
v1.8.0
Updated NatCorder version to 1.8.0. Updated NatShare version to 1.2.5. Updated OpenCVForUnity version to 2.4.4.
1 parent 7d8e9e9 commit dd7a297

File tree

8 files changed

+188
-83
lines changed

8 files changed

+188
-83
lines changed

Assets/NatCorderWithOpenCVForUnityExample/NatCorderWithOpenCVForUnityExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class NatCorderWithOpenCVForUnityExample : MonoBehaviour
99
{
1010
public static string GetNatCorderVersion()
1111
{
12-
return "1.7.3";
12+
return "1.8.0";
1313
}
1414

1515
public Text exampleTitle;
Binary file not shown.

Assets/NatCorderWithOpenCVForUnityExample/Scripts/Utils/FpsMonitor.cs

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

44
namespace NatCorderWithOpenCVForUnityExample
55
{
6+
// v1.0.1
67
public class FpsMonitor : MonoBehaviour
78
{
89
int tick = 0;
@@ -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,20 @@ 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);
114-
{
115-
GUILayout.BeginVertical();
116-
GUILayout.Label(consoleText, console_labelStyle);
117-
GUILayout.EndVertical();
126+
if (toast_time != 0) {
127+
if (boxVisible)
128+
{
129+
GUI.Box(console_outer, "");
130+
}
131+
132+
GUILayout.BeginArea(console_inner);
133+
{
134+
GUILayout.BeginVertical();
135+
GUILayout.Label(consoleText, console_labelStyle);
136+
GUILayout.EndVertical();
137+
}
138+
GUILayout.EndArea();
118139
}
119-
GUILayout.EndArea();
120140
}
121141
}
122142

@@ -155,6 +175,12 @@ public void LocateGUI()
155175
console_inner = new Rect(console_x + padding.x, console_y + padding.y, Screen.width - offset.x * 2 - padding.x, consoleHeight);
156176
}
157177

178+
public void Toast(string message, int time = 120)
179+
{
180+
_consoleText = message;
181+
toast_time = (time < 60) ? 60 : time;
182+
}
183+
158184
float GetAlignedX(Alignment anchor, float w)
159185
{
160186
switch (anchor)
-16.3 KB
Binary file not shown.
-17 KB
Binary file not shown.

0 commit comments

Comments
 (0)