Пример #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 (currentFeedbackFileKey != FeedbackFile.Id)
                {
                    currentFeedbackFileKey = FeedbackFile.Id;
                    player.RegisterTactFileStr(currentFeedbackFileKey, FeedbackFile.Value);
                }

                if (FeedbackFile.Type == BhapticsUtils.TypeVest || FeedbackFile.Type == BhapticsUtils.TypeTactot)
                {
                    player.SubmitRegisteredVestRotation(currentFeedbackFileKey, _key,
                                                        new RotationOption(VestRotationAngleX + TactFileOffsetX, VestRotationOffsetY + TactFileOffsetY),
                                                        option);
                }
                else if (IsReflectTactosy && (FeedbackFile.Type == BhapticsUtils.TypeTactosy ||
                                              FeedbackFile.Type == BhapticsUtils.TypeTactosy2))
                {
                    var reflectKey = FeedbackFile.Id + "Reflect";
                    if (currentFeedbackFileKeyReflect != reflectKey)
                    {
                        player.RegisterTactFileStrReflected(reflectKey,
                                                            FeedbackFile.Value);
                        currentFeedbackFileKeyReflect = reflectKey;
                    }
                    player.SubmitRegistered(reflectKey, _key, option);
                }
                else
                {
                    player.SubmitRegistered(currentFeedbackFileKey, _key, option);
                }

                break;
            }
        }
Пример #2
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;
            }
        }
Пример #3
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);
                }
            }
        }
Пример #4
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);
                }
            }
        }
Пример #5
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
//            _player.Submit("VestFront", PositionType.VestFront, new DotPoint(0, 100), 2000);
//            _player.Submit("VestBack", PositionType.VestBack, new DotPoint(0, 100), 2000);
            _player.SubmitRegisteredVestRotation("Swirl", "Swirl", new RotationOption(0, 0), new ScaleOption(0.5f, 1));
        }
Пример #6
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;
                    player.RegisterTactFileStr(FeedbackFile.Id, FeedbackFile.Value);
                }

//#if UNITY_EDITOR_WIN
//                    // WHEN CHANGED // TODO
                player.RegisterTactFileStr(FeedbackFile.Id, FeedbackFile.Value);
//#endif

                if (FeedbackFile.Type == BhapticsUtils.TypeVest || FeedbackFile.Type == BhapticsUtils.TypeTactot)
                {
                    player.SubmitRegisteredVestRotation(FeedbackFile.Id, _key,
                                                        new RotationOption(VestRotationAngleX + TactFileOffsetX, VestRotationOffsetY + TactFileOffsetY),
                                                        option);
                }
                else if (IsReflectTactosy && (FeedbackFile.Type == BhapticsUtils.TypeTactosy ||
                                              FeedbackFile.Type == BhapticsUtils.TypeTactosy2))
                {
                    var reflectKey = FeedbackFile.Id + "Reflect";
                    if (!isRegistered)
                    {
                        isRegistered = true;
                        player.RegisterTactFileStrReflected(reflectKey,
                                                            FeedbackFile.Value);
                    }
                    player.SubmitRegistered(reflectKey, _key, option);
                }
                else
                {
                    player.SubmitRegistered(FeedbackFile.Id, _key, option);
                }

                break;
            }
        }