Skip to content

Commit e84ca41

Browse files
committed
clean up examples
1 parent c91b296 commit e84ca41

4 files changed

Lines changed: 33 additions & 4 deletions

File tree

Allow2/Allow2.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ resultClosure callback
272272

273273
public static void GetQR(MonoBehaviour behavior, string name, imageClosure callback) {
274274
DateTime now = new DateTime();
275+
Debug.Log(qrDebounce.CompareTo(now));
275276
if ((qrCall != null) && (qrDebounce.CompareTo(now) > 0)) {
276277
Debug.Log("debounce");
277278
Coroutine oldCall = qrCall;

Allow2/Examples/CheckButton.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,33 @@ public void Check()
5050
true);
5151
}
5252

53+
public void StartChecking()
54+
{
55+
Debug.Log("Start Checking");
56+
Allow2.StartChecking(
57+
this,
58+
childId,
59+
activities,
60+
delegate (string err, Allow2CheckResult result)
61+
{
62+
Debug.Log("Check Error" + err);
63+
Debug.Log("Paired: " + Allow2.IsPaired);
64+
if (result != null)
65+
{
66+
Debug.Log("Allowed: " + result.IsAllowed);
67+
if (!result.IsAllowed)
68+
{
69+
Debug.Log(result.Explanation);
70+
}
71+
}
72+
},
73+
true);
74+
}
75+
76+
public void StopChecking()
77+
{
78+
Debug.Log("Stop Checking");
79+
Allow2.StopChecking();
80+
}
5381
}
5482
}

Allow2/Examples/DeviceNameInput.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class DeviceNameInput : MonoBehaviour
2323
{
2424

2525
public InputField inputField;
26+
public Image qrImage;
2627

2728
void Awake()
2829
{
@@ -34,8 +35,6 @@ public void InputValueChanged(string input)
3435
Allow2.GetQR(this, input, delegate (string err, Texture qrCode)
3536
{
3637
Debug.Log("qrcode error: " + (err ?? "No Error") + " : " + (qrCode ? "yes" : "no"));
37-
GameObject qrImage = GameObject.Find("qrcode");
38-
Debug.Log("qrImage error: " + (qrImage ? "yes" : "no"));
3938
qrImage.GetComponent<RawImage>().texture = qrCode;
4039
});
4140
}

Allow2/Examples/SceneClass.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ namespace Allow2.Allow2Examples
2121

2222
public class SceneClass : MonoBehaviour
2323
{
24+
25+
public Image qrImage;
26+
2427
void Awake()
2528
{
2629
// staging is only really for Allow2 internal development, omit this line in your code
@@ -42,8 +45,6 @@ void Awake()
4245
Allow2.GetQR(this, SystemInfo.deviceName, delegate (string err, Texture qrCode)
4346
{
4447
Debug.Log("qrcode error: " + (err ?? "No Error") + " : " + (qrCode ? "yes" : "no"));
45-
GameObject qrImage = GameObject.Find("qrcode");
46-
Debug.Log("qrImage error: " + (qrImage ? "yes" : "no"));
4748
qrImage.GetComponent<RawImage>().texture = qrCode;
4849
});
4950
}

0 commit comments

Comments
 (0)