AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
WidgetReceiver.cs
Go to the documentation of this file.
1 using ARDesign.Widgets;
4 using System;
5 using System.Collections;
6 using System.Collections.Generic;
7 using UnityEngine;
8 
10 {
11  [SerializeField]
12  private GameObject widgetparent;
13  [SerializeField]
14  private GameObject widgetobj;
15 
16  #region PRIVATE_MEMBER_VARIABLES
17  private DataWidgetHandler handler;
18  private DataWidget wid;
19  private HandDraggable handDraggable;
20  private bool isDraggable = false;
21  #endregion //PRIVATE_MEMBER_VARIABLES
22 
23  #region UNITY_MONOBEHAVIOUR_METHODS
24  private void Start()
25  {
26  wid = widgetobj.GetComponent <DataWidget>();
27  handler = widgetparent.GetComponent<DataWidgetHandler>();
28 
29  handDraggable = widgetobj.GetComponent<HandDraggable>();
30 
31  // Dragging is off by default
32  handDraggable.enabled = isDraggable;
33 
34  // When finished dragging, handDraggable should be disabled
35  handDraggable.StoppedDragging += StopDragging;
36  }
37 
38  protected override void InputDown(GameObject obj, InputEventData eventData)
39  {
40  Debug.Log(obj.name);
41  switch (obj.name)
42  {
43  case "PinButton":
44  PinAction();
45  break;
46  case "StorageButton":
47  StorageAction();
48  break;
49  case "DragButton":
50  DragAction();
51  break;
52  case "ResizeButton":
53  ResizeAction();
54  break;
55  case "CloseButton":
56  CloseAction();
57  break;
58  default:
59  base.InputDown(obj, eventData);
60  break;
61  }
62 
63  }
64  #endregion //UNITY_MONOBEHAVIOUR_METHODS
65 
66  #region PRIVATE_METHODS
67  private void ResizeAction()
68  {
69  throw new NotImplementedException();
70  }
71 
72  private void StorageAction()
73  {
74  throw new NotImplementedException();
75  }
76 
77  private void PinAction()
78  {
79  throw new NotImplementedException();
80  }
81 
82  private void StopDragging()
83  {
84  handDraggable.enabled = false;
85  }
86 
87  private void CloseAction()
88  {
89  handler.EnableWidget(false);
90  }
91  private void DragAction()
92  {
93  handDraggable.enabled = !isDraggable;
94  isDraggable = !isDraggable;
95  }
96  #endregion //PRIVATE_METHODS
97 
98 
99 }
100 
override void InputDown(GameObject obj, InputEventData eventData)
Handler class for data displaying widgets
An interaction receiver is simply a component that attached to a list of interactable objects and doe...
Component that allows dragging an object with your hand on HoloLens. Dragging is done by calculating ...
Describes an input event that has a source id and a press kind.
Widget storing data for a specific type dataVal is of type IDictionary<DateTime, Vector2> ...
Definition: DataWidget.cs:16