Skip to content

Commit 9ee17e5

Browse files
committed
added a namespace
1 parent 3a21c73 commit 9ee17e5

8 files changed

Lines changed: 624 additions & 524 deletions

File tree

Assets/GUIWindows/Scripts/Editor/GUIPointerObjectEditor.cs

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,34 @@
22
using System.Collections;
33
using UnityEditor;
44

5-
[CustomEditor(typeof(GUIPointerObject))]
6-
[CanEditMultipleObjects]
7-
public class GUIPointerObjectEditor : Editor {
8-
9-
SerializedProperty onPointerUp;
10-
SerializedProperty onPointerDown;
11-
SerializedProperty onPointerEnter;
12-
SerializedProperty onPointerExit;
13-
14-
void OnEnable()
5+
namespace Rellac.Windows
6+
{
7+
[CustomEditor(typeof(GUIPointerObject))]
8+
[CanEditMultipleObjects]
9+
public class GUIPointerObjectEditor : Editor
1510
{
16-
onPointerUp = serializedObject.FindProperty("onPointerUp");
17-
onPointerDown = serializedObject.FindProperty("onPointerDown");
18-
onPointerEnter = serializedObject.FindProperty("onPointerEnter");
19-
onPointerExit = serializedObject.FindProperty("onPointerExit");
11+
12+
SerializedProperty onPointerUp;
13+
SerializedProperty onPointerDown;
14+
SerializedProperty onPointerEnter;
15+
SerializedProperty onPointerExit;
16+
17+
void OnEnable()
18+
{
19+
onPointerUp = serializedObject.FindProperty("onPointerUp");
20+
onPointerDown = serializedObject.FindProperty("onPointerDown");
21+
onPointerEnter = serializedObject.FindProperty("onPointerEnter");
22+
onPointerExit = serializedObject.FindProperty("onPointerExit");
23+
}
24+
25+
public override void OnInspectorGUI()
26+
{
27+
serializedObject.Update();
28+
EditorGUILayout.PropertyField(onPointerUp);
29+
EditorGUILayout.PropertyField(onPointerDown);
30+
EditorGUILayout.PropertyField(onPointerEnter);
31+
EditorGUILayout.PropertyField(onPointerExit);
32+
serializedObject.ApplyModifiedProperties();
33+
}
2034
}
21-
22-
public override void OnInspectorGUI()
23-
{
24-
serializedObject.Update();
25-
EditorGUILayout.PropertyField(onPointerUp);
26-
EditorGUILayout.PropertyField(onPointerDown);
27-
EditorGUILayout.PropertyField(onPointerEnter);
28-
EditorGUILayout.PropertyField(onPointerExit);
29-
serializedObject.ApplyModifiedProperties();
30-
}
31-
}
35+
}
Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
using UnityEngine;
22

3-
/// <summary>
4-
/// Contains a reference to all GUIWindowHandle objects below this Transform for ease of referencing
5-
/// </summary>
6-
public class GUIBorderParent : MonoBehaviour {
7-
private GUIWindowHandle[] handles;
8-
// Use this for initialization
9-
void Start () {
10-
handles = GetComponentsInChildren<GUIWindowHandle> ();
11-
}
12-
3+
namespace Rellac.Windows
4+
{
135
/// <summary>
14-
/// Toggle interactivity of handles
6+
/// Contains a reference to all GUIWindowHandle objects below this Transform for ease of referencing
157
/// </summary>
16-
/// <param name="input">is interactive</param>
17-
public void SetIsLocked(bool input) {
18-
for (int i = 0; i < handles.Length; i++) {
19-
handles[i].SetIsLocked(input);
8+
public class GUIBorderParent : MonoBehaviour
9+
{
10+
private GUIWindowHandle[] handles;
11+
// Use this for initialization
12+
void Start()
13+
{
14+
handles = GetComponentsInChildren<GUIWindowHandle>();
15+
}
16+
17+
/// <summary>
18+
/// Toggle interactivity of handles
19+
/// </summary>
20+
/// <param name="input">is interactive</param>
21+
public void SetIsLocked(bool input)
22+
{
23+
for (int i = 0; i < handles.Length; i++)
24+
{
25+
handles[i].SetIsLocked(input);
26+
}
2027
}
2128
}
22-
}
29+
}

Assets/GUIWindows/Scripts/GUIPointerObject.cs

Lines changed: 54 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,65 @@
22
using UnityEngine.Events;
33
using UnityEngine.EventSystems;
44

5-
/// <summary>
6-
/// Contains events referencing IPointerHandlers
7-
/// </summary>
8-
public class GUIPointerObject : MonoBehaviour, IPointerUpHandler, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler {
5+
namespace Rellac.Windows
6+
{
97
/// <summary>
10-
/// Fires when a pointer up is detected
8+
/// Contains events referencing IPointerHandlers
119
/// </summary>
12-
[HideInInspector]
13-
[Tooltip("Fires when a pointer up is detected")]
14-
public UnityEvent onPointerUp = null;
15-
/// <summary>
16-
/// Fires when a pointer down is detected
17-
/// </summary>
18-
[HideInInspector]
19-
[Tooltip("Fires when a pointer down is detected")]
20-
public UnityEvent onPointerDown = null;
21-
/// <summary>
22-
/// Fires when a pointer enter is detected
23-
/// </summary>
24-
[HideInInspector]
25-
[Tooltip("Fires when a pointer enter is detected")]
26-
public UnityEvent onPointerEnter = null;
27-
/// <summary>
28-
/// Fires when a pointer exit is detected
29-
/// </summary>
30-
[HideInInspector]
31-
[Tooltip("Fires when a pointer exit is detected")]
32-
public UnityEvent onPointerExit = null;
10+
public class GUIPointerObject : MonoBehaviour, IPointerUpHandler, IPointerDownHandler, IPointerEnterHandler, IPointerExitHandler
11+
{
12+
/// <summary>
13+
/// Fires when a pointer up is detected
14+
/// </summary>
15+
[HideInInspector]
16+
[Tooltip("Fires when a pointer up is detected")]
17+
public UnityEvent onPointerUp = null;
18+
/// <summary>
19+
/// Fires when a pointer down is detected
20+
/// </summary>
21+
[HideInInspector]
22+
[Tooltip("Fires when a pointer down is detected")]
23+
public UnityEvent onPointerDown = null;
24+
/// <summary>
25+
/// Fires when a pointer enter is detected
26+
/// </summary>
27+
[HideInInspector]
28+
[Tooltip("Fires when a pointer enter is detected")]
29+
public UnityEvent onPointerEnter = null;
30+
/// <summary>
31+
/// Fires when a pointer exit is detected
32+
/// </summary>
33+
[HideInInspector]
34+
[Tooltip("Fires when a pointer exit is detected")]
35+
public UnityEvent onPointerExit = null;
3336

34-
public void OnPointerUp (PointerEventData eventData) {
35-
if (onPointerUp != null) {
36-
onPointerUp.Invoke();
37+
public void OnPointerUp(PointerEventData eventData)
38+
{
39+
if (onPointerUp != null)
40+
{
41+
onPointerUp.Invoke();
42+
}
3743
}
38-
}
39-
public void OnPointerDown (PointerEventData eventData) {
40-
if (onPointerDown != null) {
41-
onPointerDown.Invoke();
44+
public void OnPointerDown(PointerEventData eventData)
45+
{
46+
if (onPointerDown != null)
47+
{
48+
onPointerDown.Invoke();
49+
}
4250
}
43-
}
44-
public void OnPointerEnter (PointerEventData eventData) {
45-
if (onPointerEnter != null) {
46-
onPointerEnter.Invoke();
51+
public void OnPointerEnter(PointerEventData eventData)
52+
{
53+
if (onPointerEnter != null)
54+
{
55+
onPointerEnter.Invoke();
56+
}
4757
}
48-
}
49-
public void OnPointerExit (PointerEventData eventData) {
50-
if (onPointerExit != null) {
51-
onPointerExit.Invoke();
58+
public void OnPointerExit(PointerEventData eventData)
59+
{
60+
if (onPointerExit != null)
61+
{
62+
onPointerExit.Invoke();
63+
}
5264
}
5365
}
54-
}
66+
}
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
using UnityEngine;
22

3-
/// <summary>
4-
/// Simple script to destroy the target GameObject when window is closed
5-
/// </summary>
6-
public class GUIWindow : MonoBehaviour {
3+
namespace Rellac.Windows
4+
{
75
/// <summary>
8-
/// Close window by destroying this GameObject
6+
/// Simple script to destroy the target GameObject when window is closed
97
/// </summary>
10-
public void CloseWindow () {
11-
Destroy(gameObject);
8+
public class GUIWindow : MonoBehaviour
9+
{
10+
/// <summary>
11+
/// Close window by destroying this GameObject
12+
/// </summary>
13+
public void CloseWindow()
14+
{
15+
Destroy(gameObject);
16+
}
1217
}
1318
}

0 commit comments

Comments
 (0)