Tanoda
GraphicCallbackInfo.cs
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) Ultraleap, Inc. 2011-2020. *
3
* *
4
* Use subject to the terms of the Apache License 2.0 available at *
5
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6
* between Ultraleap and you, your company or other organization. *
7
******************************************************************************/
8
9
using
System;
10
using
UnityEngine
;
11
12
namespace
Leap.Unity.GraphicalRenderer.Tests
{
13
14
public
static
class
GraphicExtensions {
15
16
public
static
GraphicCallbackInfo
.
GraphicInfo
OnAwake(
this
LeapGraphic
graphic) {
17
return
graphic.GetComponent<
GraphicCallbackInfo
>().awakeInfo;
18
}
19
20
public
static
GraphicCallbackInfo
.
GraphicInfo
OnEnable(
this
LeapGraphic
graphic) {
21
return
graphic.GetComponent<
GraphicCallbackInfo
>().enableInfo;
22
}
23
24
public
static
GraphicCallbackInfo
.
GraphicInfo
OnStart(
this
LeapGraphic
graphic) {
25
return
graphic.GetComponent<
GraphicCallbackInfo
>().startInfo;
26
}
27
}
28
29
public
class
GraphicCallbackInfo
: MonoBehaviour {
30
31
public
GraphicInfo
awakeInfo
,
enableInfo
,
startInfo
;
32
33
private
void
Awake() {
34
awakeInfo
=
new
GraphicInfo
(gameObject);
35
}
36
37
private
void
OnEnable() {
38
enableInfo
=
new
GraphicInfo(gameObject);
39
}
40
41
private
void
Start() {
42
startInfo
=
new
GraphicInfo(gameObject);
43
}
44
45
public
struct
GraphicInfo
{
46
public
readonly
bool
hasFired
;
47
48
private
bool
_wasAttached;
49
private
LeapGraphicGroup
_attachedGroup;
50
51
public
bool
hasNotFired
{
52
get
{
53
return
!
hasFired
;
54
}
55
}
56
57
public
bool
wasAttached
{
58
get
{
59
if
(!
hasFired
)
throw
new
Exception(
"Event has not fired yet."
);
60
return
_wasAttached;
61
}
62
}
63
64
public
LeapGraphicGroup
attachedGroup
{
65
get
{
66
if
(!
hasFired
)
throw
new
Exception(
"Event has not fired yet."
);
67
return
_attachedGroup;
68
}
69
}
70
71
public
GraphicInfo
(GameObject obj) {
72
var graphic = obj.GetComponent<
LeapGraphic
>();
73
hasFired
=
true
;
74
_wasAttached = graphic.isAttachedToGroup;
75
_attachedGroup = graphic.attachedGroup;
76
}
77
}
78
}
79
}
Leap.Unity.GraphicalRenderer.LeapGraphicGroup
Definition:
LeapGraphicGroupEditorApi.cs:24
Leap.Unity.GraphicalRenderer.LeapGraphic
Definition:
LeapGraphicEditorApi.cs:14
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo
Definition:
GraphicCallbackInfo.cs:29
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.awakeInfo
GraphicInfo awakeInfo
Definition:
GraphicCallbackInfo.cs:31
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.startInfo
GraphicInfo startInfo
Definition:
GraphicCallbackInfo.cs:31
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.enableInfo
GraphicInfo enableInfo
Definition:
GraphicCallbackInfo.cs:31
Leap.Unity.GraphicalRenderer.Tests
Definition:
GraphicCallbackInfo.cs:12
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.GraphicInfo
Definition:
GraphicCallbackInfo.cs:45
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.GraphicInfo.hasNotFired
bool hasNotFired
Definition:
GraphicCallbackInfo.cs:51
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.GraphicInfo.GraphicInfo
GraphicInfo(GameObject obj)
Definition:
GraphicCallbackInfo.cs:71
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.GraphicInfo.attachedGroup
LeapGraphicGroup attachedGroup
Definition:
GraphicCallbackInfo.cs:64
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.GraphicInfo.hasFired
readonly bool hasFired
Definition:
GraphicCallbackInfo.cs:46
Leap.Unity.GraphicalRenderer.Tests.GraphicCallbackInfo.GraphicInfo.wasAttached
bool wasAttached
Definition:
GraphicCallbackInfo.cs:57
Source
Assets
Plugins
LeapMotion
Legacy
GraphicRenderer
Testing
Scripts
GraphicCallbackInfo.cs
Generated by
1.9.3