Esempio n. 1
0
        public static Project ReflectLeftRight(string projectStr)
        {
            var feedbackFile = ConvertJsonStringToTactosyFile(projectStr);
            var project      = feedbackFile.Project;

            foreach (var projectTrack in project.Tracks)
            {
                foreach (var projectTrackEffect in projectTrack.Effects)
                {
                    HapticEffectMode right = null, left = null;
                    if (projectTrackEffect.Modes.ContainsKey(TypeRight))
                    {
                        right = projectTrackEffect.Modes[TypeRight];
                    }

                    if (projectTrackEffect.Modes.ContainsKey(TypeLeft))
                    {
                        left = projectTrackEffect.Modes[TypeLeft];
                    }

                    projectTrackEffect.Modes[TypeLeft]  = right;
                    projectTrackEffect.Modes[TypeRight] = left;
                }
            }

            return(project);
        }
        internal static HapticEffectMode ToMode(JSONObject jsonObj)
        {
            var mode = new HapticEffectMode();

            mode.Mode = EnumParser.ToMode(jsonObj["mode"]);

            mode.DotMode = DotMode.ToDotMode(jsonObj["dotMode"].AsObject);

            mode.PathMode = PathMode.ToPathMode(jsonObj["pathMode"].AsObject);

            return(mode);
        }
Esempio n. 3
0
        internal static HapticEffectMode ToMode(JsonObject jsonObj)
        {
            var mode = new HapticEffectMode();

            mode.Mode = EnumParser.ToMode(jsonObj.GetNamedString("mode"));

            mode.DotMode = DotMode.ToDotMode(jsonObj.GetNamedObject("dotMode", new JsonObject()).GetObject());

            mode.PathMode = PathMode.ToPathMode(jsonObj.GetNamedObject("pathMode", new JsonObject()).GetObject());

            return(mode);
        }
        internal static HapticEffect ToEffect(JSONObject jsonObj)
        {
            var effect = new HapticEffect();

            // TODO
            effect.StartTime  = jsonObj.GetValueOrDefault("startTime", -1);
            effect.OffsetTime = jsonObj.GetValueOrDefault("offsetTime", -1);
            effect.Modes      = new Dictionary <string, HapticEffectMode>();

            var modeJson = jsonObj.GetValueOrDefault("modes", new JSONObject());

            foreach (var mode in modeJson)
            {
                effect.Modes[mode.Key] = HapticEffectMode.ToMode(mode.Value.AsObject);
            }

            return(effect);
        }