Ejemplo n.º 1
0
        public void Play(ScaleOption option = null)
        {
            if (option == null)
            {
                option = new ScaleOption(Intensity, Duration);
            }
            switch (FeedbackType)
            {
            case FeedbackType.DotMode:
                if (DotPoints == null)
                {
                    Debug.LogError("DotPoints not defined");
                    return;
                }
                player.Submit(_key, ToPositionType(Position), DotPoints, TimeMillis);
                break;

            case FeedbackType.PathMode:
                if (Points == null)
                {
                    Debug.LogError("Points not defined");
                    return;
                }
                player.Submit(_key, ToPositionType(Position), new List <PathPoint>(Convert(Points)), TimeMillis);
                break;

            case FeedbackType.TactFile:
                if (!isOriginFileRegistered)
                {
                    isOriginFileRegistered = true;
                    var feedbackFile = CommonUtils.ConvertJsonStringToTactosyFile(FeedbackFile.Value);
                    //Debug.Log("Register tact file " + FeedbackFile.Id + ", " + FeedbackFile.Key);
                    player.Register(FeedbackFile.Id, feedbackFile.Project);
                }

                if (FeedbackFile.Type == BhapticsUtils.TypeVest)
                {
                    player.SubmitRegisteredVestRotation(FeedbackFile.Id, _key,
                                                        new RotationOption(VestRotationAngleX + TactFileOffsetX, VestRotationOffsetY + TactFileOffsetY),
                                                        option);
                }
                else if (FeedbackFile.Type == BhapticsUtils.TypeTactosy && IsReflectTactosy)
                {
                    if (!isRegistered)
                    {
                        isRegistered = true;
                        var project = BhapticsUtils.ReflectLeftRight(FeedbackFile.Value);

                        player.Register(FeedbackFile.Id + "Reflect", project);
                    }
                    player.SubmitRegistered(FeedbackFile.Id + "Reflect", _key, option);
                }
                else
                {
                    player.SubmitRegistered(FeedbackFile.Id, _key, option);
                }

                break;
            }
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            _player = new HapticPlayer();

            foreach (var s in arr)
            {
                try
                {
                    var readAllText = File.ReadAllText(s);

                    var hapticFeedbackFile = CommonUtils.ConvertJsonStringToTactosyFile(readAllText);
                    _player.Register(s, hapticFeedbackFile.Project);

                    var button = new Button();
                    button.Content = s;
                    button.Click  += (sender, args) =>
                    {
                        _player.SubmitRegisteredVestRotation(s, s, new RotationOption(0, 0), new ScaleOption(1, 1));
                    };
                    ButtonContainer.Children.Add(button);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message + " " + e.StackTrace);
                }
            }
        }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();
            _player = new HapticPlayer();


            string sssss = "[\"Head\"]";

            var jsonNode = JSON.Parse(sssss);

            foreach (var keyValuePair in jsonNode.AsArray)
            {
                Debug.WriteLine(keyValuePair);

                var positionType = EnumParser.ToPositionType(keyValuePair.Value);

                Debug.WriteLine(positionType);
            }


            foreach (var s in arr)
            {
                try
                {
                    var readAllText = File.ReadAllText(s);

                    var hapticFeedbackFile = CommonUtils.ConvertJsonStringToTactosyFile(readAllText);
                    _player.Register(s, hapticFeedbackFile.Project);

                    var button = new Button();
                    button.Content = s;
                    button.Click  += (sender, args) =>
                    {
                        _player.SubmitRegisteredVestRotation(s, s, new RotationOption(0, 0), new ScaleOption(1, 1));
                    };
                    ButtonContainer.Children.Add(button);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message + " " + e.StackTrace);
                }
            }
        }