예제 #1
0
    // Use this for initialization
    void Start()
    {
        CM = FindObjectOfType <CalibrationManager> ();

        loadedNotes = new Queue <Note>();
        SpawnNotes();
    }
예제 #2
0
        protected override void OnTouchUp(TouchEventArgs e)
        {
            base.OnTouchUp(e);

            int x, y;

            e.GetPosition(this, 0, out x, out y);

            CalibrationManager.CalibrationPoints.TouchX[idx] = (short)x;
            CalibrationManager.CalibrationPoints.TouchY[idx] = (short)y;

            idx++;

            if (idx == CalibrationManager.CalibrationPoints.Count)
            {
                // The last point has been reached.
                CalibrationManager.ApplyCalibrationPoints();
                CalibrationManager.SaveCalibrationPoints();

                Close();

                if (CalibrationComplete != null)
                {
                    CalibrationComplete(this, EventArgs.Empty);
                }
            }

            Invalidate();
        }
예제 #3
0
        public GraphicsManager(int width, int height)
        {
            //mouseManager = new MouseManager(canvas);
            //mouseManager.OnMouseDblClick = InterceptMouseDblClick;
            //mouseManager.OnMouseDown = InterceptMouseDown;
            //mouseManager.OnMouseUp = InterceptMouseUp;
            //mouseManager.OnMouseMove = InterceptMouseMove;
            //mouseManager.OnMouseOut = InterceptMouseOut;

            TouchManager.TouchDown           += new TouchEventHandler(TouchManager_TouchDown);
            TouchManager.TouchMove           += new TouchEventHandler(TouchManager_TouchMove);
            TouchManager.TouchUp             += new TouchEventHandler(TouchManager_TouchUp);
            TouchManager.TouchGestureStarted += new TouchGestureEventHandler(TouchManager_TouchGestureStarted);
            TouchManager.TouchGestureChanged += new TouchGestureEventHandler(TouchManager_TouchGestureChanged);
            TouchManager.TouchGestureEnded   += new TouchGestureEventHandler(TouchManager_TouchGestureEnded);
            TouchManager.Initialize();

            bitmap  = new Bitmap(width, height);
            desktop = new Desktop(width, height, this);
            cw      = new CalibrationWindow(width, height, this)
            {
                Background   = new SolidColorBrush(Color.CornflowerBlue),
                CrosshairPen = new Pen(Color.Red, 1)
            };

            if (CalibrationManager.IsCalibrated)
            {
                CalibrationManager.ApplyCalibrationPoints();
            }

            desktop.Invalidate();
        }
예제 #4
0
        public CalibrationWindow(Font font, string txt)
        {
            Height     = SystemMetrics.ScreenHeight;
            Width      = SystemMetrics.ScreenWidth;
            Visibility = Visibility.Visible;
            //Buttons.Focus(this);

            pen = new Pen(ColorUtility.ColorFromRGB(255, 0, 0), 1);

            Text text = new Text();

            text.Font        = font;
            text.ForeColor   = Colors.Blue;
            text.TextContent = txt;
            text.TextWrap    = true;
            text.SetMargin(0, 0, 0, SystemMetrics.ScreenHeight / 2);
            text.TextAlignment       = TextAlignment.Center;
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment   = VerticalAlignment.Center;
            Child = text;

            CalibrationManager.PrepareCalibrationPoints();
            CalibrationManager.StartCalibration();
            idx = 0;

            Invalidate();
        }
예제 #5
0
    void Start()
    {
        GameObject f = GameObject.Find("HandController");

        gestureManager = f.GetComponent <GestureManager> ();
        GameObject g = GameObject.Find("LeapControllerBlockHand");

        calibrationManager = g.GetComponent <CalibrationManager>();
    }
예제 #6
0
    private void Awake()
    {
        //singleton pattern a la Unity
        if (Instance == null)
        {
            Instance = this;
            // DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        _desktopPath       = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        _desktopFolderPath = Path.GetFullPath(Path.Combine(_desktopPath, "WestdriveLoopARData"));

        _calibrationFilePath = GetPathForSaveFile("CalibrationData");

        if (!File.Exists(_desktopPath))
        {
            Directory.CreateDirectory(Path.GetFullPath(Path.Combine(_desktopPath, "WestdriveLoopARData")));
        }

        if (File.Exists(_calibrationFilePath))
        {
            _calibrationData = LoadCalibrationFile(_calibrationFilePath);
        }
        else
        {
            _calibrationData = new CalibrationData();
        }


        if (!File.Exists(GetPathForSaveFolder("Input")))
        {
            Directory.CreateDirectory(Path.GetFullPath(Path.Combine(_desktopFolderPath, "Input")));
        }

        if (!File.Exists(GetPathForSaveFolder("EyeTracking")))
        {
            Directory.CreateDirectory(Path.GetFullPath(Path.Combine(_desktopFolderPath, "EyeTracking")));
        }

        if (!File.Exists(GetPathForSaveFolder("ParticipantCalibrationData")))
        {
            Directory.CreateDirectory(Path.GetFullPath(Path.Combine(_desktopFolderPath, "ParticipantCalibrationData")));
        }

        if (!File.Exists(GetPathForSaveFolder("SceneData")))
        {
            Directory.CreateDirectory(Path.GetFullPath(Path.Combine(_desktopFolderPath, "SceneData")));
        }

        _random = new Random();
    }
예제 #7
0
        private void RunMethodGroups()
        {
            var frequencies = ParseInputs(@"Inputs\Day1.txt");

            CalibrationManager.PrintSums(frequencies);
            CalibrationManager.CalibrateEveryTwice(frequencies);

            var idList = ParseStrings(@"Inputs\Day2.txt");

            Scanner.ShowCheckSum(idList);
            Scanner.FindAdjescentBox(idList);

            var claimsInputList = ParseStrings(@"Inputs\Day3.txt");
            var claims          = ParseFactory.ParseClaims(claimsInputList);

            Tailor.FindOverlaps(claims);

            var parsedShifts = ParseStrings(@"Inputs\Day4.txt");
            var sortedShifts = ParseFactory.ParseShifts(parsedShifts);

            GuardPicker.FindWeakestGuard(sortedShifts);

            var parsedPolymer = ParseString(@"Inputs\Day5.txt");
            var myPolyzer     = new Polymerizer();

            myPolyzer.React(parsedPolymer);

            var coords       = ParseStrings(@"Inputs\Day6.txt");
            var parsedCoords = ParseFactory.ParseCoordinates(coords);
            var cabber       = new Taxicabber();

            cabber.FindTheLargestArea(parsedCoords);
            cabber.FindTheSafeRegion(parsedCoords);

            var parsedInput = ParseStringPure(@"Inputs\Day7.txt");
            var orderer     = new StepOrderer();

            orderer.PartOne(parsedInput);
            orderer.PartTwo(parsedInput);
        }
예제 #8
0
        private void calibrationBtn_Click(object sender, EventArgs e)
        {
            if (calibrationDroneComboBox.SelectedIndex < 0)
            {
                parent.ShowMessageBox("Please select drone");
                return;
            }

            int index = -1;

            try
            {
                index = int.Parse((string)calibrationDroneComboBox.SelectedItem);
            }
            catch (FormatException ex)
            {
                parent.ShowMessageBox("Id가 숫자가 아닙니다.");
                return;
            }
            droneList[index].CheckConnection();
            droneList[index].AddACKCheckEvent(
                delegate() {
                System.Threading.Thread thread = new System.Threading.Thread(
                    delegate()
                {
                    CalibrationInfo cInfo = CalibrationManager.Calibrate(parent,
                                                                         droneList[index],
                                                                         parent.GetUWBManager(),
                                                                         droneList[index].GetTagID(),
                                                                         "temp",
                                                                         powers.ToArray(),
                                                                         times.ToArray());
                    CalibrationList.AddCalibrationData(parent, "temp", cInfo);
                });
                thread.Start();
            }, 3000, "Check your device is connected to the drone.");

            this.Close();
        }
예제 #9
0
    public bool calibrationTriggered; // check if hand is within calibration area

    // Use this for initialization
    void Start()
    {
        leapManager  = this.gameObject.GetComponent <LeapManager> ();
        musicManager = GameObject.Find("AudioManager").GetComponent <MusicManager> ();
        GameObject g = GameObject.Find("LeapControllerBlockHand");

        calibrationManagerNew = g.GetComponent <CalibrationManagerNew>();
        calibrationManager    = g.GetComponent <CalibrationManager>();
        glowController        = GameObject.Find("StoneHandModel 1").GetComponentInChildren <GlowControl>();
        //Debug.Log("Found hand + glow");
        activeSpell = "none";

        calibratedDownFrame = new List <Vector3> ();
        calibratedDown      = new Vector3(0f, -1f, -0.1f);     //Default down-vector

        calibrateOnStart     = false;
        calibrationTriggered = false;

        if (calibrateOnStart)
        {
            Debug.Log("Calibrating... ");
        }
    }
예제 #10
0
 public CalibrationForm(CalibrationManager calibrationManager)
 {
     this._calibrationManager = calibrationManager;
     InitializeComponent();
     InitializeString();
 }
예제 #11
0
 // Use this for initialization
 void Start()
 {
     CM = FindObjectOfType <CalibrationManager> ();
 }
예제 #12
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            Quilt quilt = (Quilt)target;

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Quilt -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            GUI.enabled = false;
            EditorGUILayout.PropertyField(quiltRT);
            GUI.enabled = true;

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Take 2D Screenshot", EditorStyles.miniButton))
            {
                quilt.Screenshot2D();
            }
            if (GUILayout.Button("Take 3D Screenshot", EditorStyles.miniButton))
            {
                quilt.Screenshot3D();
            }
            EditorGUILayout.EndHorizontal();

            advancedFoldout.boolValue = EditorGUILayout.Foldout(
                advancedFoldout.boolValue,
                "Advanced",
                true
                );
            if (advancedFoldout.boolValue)
            {
                EditorGUI.indentLevel++;

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Captures -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(captures, true);
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Add Capture", EditorStyles.miniButton))
                {
                    AddCapture(quilt);
                    EditorUtility.SetDirty(quilt);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                EditorGUI.BeginChangeCheck();
                if (GUILayout.Button("Remove Capture", EditorStyles.miniButton))
                {
                    RemoveCapture(quilt);
                    EditorUtility.SetDirty(quilt);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Quilt Settings -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(overrideQuilt);
                // EditorGUILayout.PropertyField(overrideViews, true);
                EditorGUILayout.PropertyField(renderOverrideBehind);
                EditorGUILayout.PropertyField(debugPrintoutKey);
                EditorGUILayout.PropertyField(screenshot2DKey);
                EditorGUILayout.PropertyField(screenshot3DKey);

                EditorGUILayout.PropertyField(forceResolution);

                List <string> tilingPresetNames = new List <string>();
                foreach (var p in System.Enum.GetValues(typeof(Quilt.QuiltPreset)))
                {
                    tilingPresetNames.Add(p.ToString());
                }
                tilingPresetNames.Add("Default (determined by quality setting)");
                tilingPresetNames.Add("Custom");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(currentQuiltPreset);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                // if it's a custom
                if (currentQuiltPreset.intValue == (int)Quilt.QuiltPreset.Custom)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(viewWidth);
                    EditorGUILayout.PropertyField(viewHeight);
                    EditorGUILayout.PropertyField(numViews);
                    if (EditorGUI.EndChangeCheck())
                    {
                        quilt.ApplyPreset();
                        EditorUtility.SetDirty(quilt);
                    }
                }

                string tilingDisplay = numViews.displayName + ": " + numViews.intValue.ToString() + "\n";

                tilingDisplay += "View Tiling: " + viewsHorizontal.intValue + " x " +
                                 viewsVertical.intValue.ToString() + "\n";

                tilingDisplay += "View Size: " + viewWidth.intValue.ToString() + " x " +
                                 viewHeight.intValue.ToString() + " px" + "\n";

                tilingDisplay += "Quilt Size: " + quiltWidth.intValue.ToString() + " x " +
                                 quiltHeight.intValue.ToString() + " px";

                EditorGUILayout.LabelField(tilingDisplay, EditorStyles.helpBox);
                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Multi Display -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(calibrationIndex);

                // change display if displayIndex changes
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(displayIndex);
                if (EditorGUI.EndChangeCheck())
                {
                    quilt.QuiltCam.targetDisplay = displayIndex.intValue;
                }

                EditorGUILayout.PropertyField(multiDisplayKey);
                EditorGUILayout.HelpBox(
                    "Display Index 0 = Display 1.\n" +
                    "Unity names it Display 1 but the array is 0 indexed.\n\n" +
                    "Keep in mind that the main display is usually Display 1, and the plugged in Looking Glass is likely Display 2.\n\n" +
                    "In most cases, you will want to leave this at 0 and set the display in the Launch window, but " +
                    "if you're using Multi Display you can set this manually for multiple Looking Glasses.",
                    MessageType.None);

                // on quilt setup event
                EditorGUILayout.PropertyField(onQuiltSetup);

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Preview -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            EditorGUILayout.PropertyField(renderIn2D);

            string previewerShortcutKey = "Ctrl + E";
            string settingsShortcutKey  = "Ctrl + Shift + E";

#if UNITY_EDITOR_OSX
            previewerShortcutKey = "⌘E";
            settingsShortcutKey  = "⌘^E";
#endif

            if (GUILayout.Button(new GUIContent(
                                     "Toggle Preview (" + previewerShortcutKey + ")",
                                     "If your LKG device is set up as a second display, " +
                                     "this will generate a game window on it to use as a " +
                                     "realtime preview"),
                                 EditorStyles.miniButton
                                 ))
            {
                PreviewWindow.ToggleWindow();
            }

            if (GUILayout.Button(new GUIContent(
                                     "Settings (" + settingsShortcutKey + ")",
                                     "Use to set previewer position"),
                                 EditorStyles.miniButton
                                 ))
            {
                EditorApplication.ExecuteMenuItem("HoloPlay/Preview Settings");
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Calibration -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            if (GUILayout.Button(new GUIContent(
                                     "Reload Calibration",
                                     "Reload the calibration, only really necessary if " +
                                     "you edited externally and the new calibration settings won't load"),
                                 EditorStyles.miniButton
                                 ))
            {
                CalibrationManager.LoadCalibrations();
                EditorUtility.SetDirty(quilt);
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Project Settings -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            if (GUILayout.Button(new GUIContent(
                                     "Optimization Settings",
                                     "Open a window that will let you select project settings " +
                                     "to be optimized for best performance with HoloPlay"),
                                 EditorStyles.miniButton
                                 ))
            {
                OptimizationSettings window = EditorWindow.GetWindow <OptimizationSettings>();
                window.Show();
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }
예제 #13
0
 public void ShowCalibration()
 {
     _calibrationManager = new CalibrationManager(_cameraManager);
 }
예제 #14
0
 void Start()
 {
     instance = this;
 }