Tanoda
Incrementable.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
UnityEngine
;
10
using
System.Collections.Generic;
11
#if UNITY_EDITOR
12
using
UnityEditor
;
13
#endif
14
15
namespace
Leap.Unity.Attributes
{
16
17
public
class
Incrementable
:
CombinablePropertyAttribute
,
IAfterFieldAdditiveDrawer
{
18
public
const
float
BUTTON_WIDTH
= 20;
19
20
#if UNITY_EDITOR
21
public
void
Draw(Rect rect, SerializedProperty property) {
22
rect.width =
BUTTON_WIDTH
;
23
24
if
(GUI.Button(rect,
"-"
)) {
25
property
.intValue--;
26
}
27
28
rect.x += rect.width;
29
30
if
(GUI.Button(rect,
"+"
)) {
31
property
.intValue++;
32
}
33
}
34
35
public
float
GetWidth() {
36
return
BUTTON_WIDTH
* 2;
37
}
38
39
public
override
IEnumerable<SerializedPropertyType> SupportedTypes {
40
get
{
41
yield
return
SerializedPropertyType.Integer;
42
}
43
}
44
#endif
45
}
46
}
Leap.Unity.Attributes.CombinablePropertyAttribute
Definition:
CombinablePropertyAttribute.cs:66
Leap.Unity.Attributes.Incrementable
Definition:
Incrementable.cs:17
Leap.Unity.Attributes.Incrementable.BUTTON_WIDTH
const float BUTTON_WIDTH
Definition:
Incrementable.cs:18
Leap.Unity.Attributes.IAfterFieldAdditiveDrawer
Definition:
CombinablePropertyAttribute.cs:64
Leap.Unity.Attributes
Definition:
CombinablePropertyDrawer.cs:16
UnityEditor
Definition:
BoxSliderEditor.cs:6
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Core
Scripts
Attributes
Incrementable.cs
Generated by
1.9.3