Beispiel #1
0
        public bool FromJSON(J.Node n)
        {
            var o = n.AsObject("Movement");

            if (o == null)
            {
                return(false);
            }

            o.Opt <EasingFactory, IEasing>("easing", ref easing_);

            {
                RandomizableFloat m = null;
                o.Opt("minimum", ref m);
                Minimum = m;
            }

            {
                RandomizableFloat m = null;
                o.Opt("maximum", ref m);
                Maximum = m;
            }

            return(true);
        }
Beispiel #2
0
        public bool FromJSON(J.Node n)
        {
            var o = n.AsObject("EyesTargetContainer");

            if (o == null)
            {
                return(false);
            }

            o.Opt("enabled", ref enabled_);

            // migration: constant target removed, was redundant with rigidbody
            if (o.HasChildObject("target"))
            {
                var t = o.Get("target").AsObject();

                string type = "";
                t.Opt("factoryTypeName", ref type);

                if (type == "constant")
                {
                    Synergy.LogInfo("found constant eye target, converting to rigidbody");
                    target_ = new RigidbodyEyesTarget();
                    return(target_.FromJSON(t));
                }
            }


            o.Opt <EyesTargetFactory, IEyesTarget>("target", ref target_);

            return(true);
        }
Beispiel #3
0
        public override bool FromJSON(J.Node n)
        {
            var o = n.AsObject("RampDuration");

            if (o == null)
            {
                return(false);
            }

            o.Opt <EasingFactory, IEasing>("easing", ref easing_);

            o.Opt("minimum", min_);
            o.Opt("maximum", max_);
            o.Opt("hold", hold_);
            o.Opt("rampUp", rampUp_);
            o.Opt("rampDown", rampDown_);

            if (o.HasKey("over"))
            {
                // migration
                var over = new FloatParameter("over", 0, 0);
                o.Opt("over", over);

                TimeUp   = over.Value;
                TimeDown = over.Value;
            }
            else
            {
                o.Opt("timeUp", timeUp_);
                o.Opt("timeDown", timeDown_);
            }

            return(true);
        }
Beispiel #4
0
        public bool FromJSON(J.Node n)
        {
            Clear();

            var o = n.AsObject("Manager");

            if (o == null)
            {
                return(false);
            }

            o.Opt("steps", ref steps_);

            foreach (var s in steps_)
            {
                s.Added();
            }

            IStepProgression sp = null;

            o.Opt <StepProgressionFactory, IStepProgression>(
                "progression", ref sp);
            StepProgression = sp;

            ResetAllSteps();

            return(true);
        }
Beispiel #5
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("RigidbodyModifier");

            if (o == null)
            {
                return(false);
            }

            o.Opt <RigidbodyMovementTypeFactory, IRigidbodyMovementType>(
                "type", ref type_);

            o.OptForceReceiver("receiver", Atom, ref receiver_);

            if (o.HasKey("direction"))
            {
                J.Wrappers.FromJSON(o.Get("direction"), ref direction_);
            }

            return(true);
        }
Beispiel #6
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("LinkModifier");

            if (o == null)
            {
                return(false);
            }

            controllers_.Clear();

            var controllersArray = o.Get("controllers").AsArray();

            if (controllersArray != null)
            {
                controllersArray.ForEach((node) =>
                {
                    var mc = new LinkModifierController();
                    if (mc.FromJSON(node))
                    {
                        AddController(mc);
                    }
                });
            }

            return(true);
        }
Beispiel #7
0
        public override bool FromJSON(J.Node n)
        {
            var o = n.AsObject("OtherModifierSyncedModifier");

            if (o == null)
            {
                return(false);
            }

            o.Opt("modifier", ref modifierIndex_);

            return(true);
        }
Beispiel #8
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("RigidbodyEyesTarget");

            if (o == null)
            {
                return(false);
            }

            if (o.HasKey("atom"))
            {
                var atomUID = o.Get("atom").AsString();
                if (atomUID != null)
                {
                    if (atomUID == Utilities.PresetAtomPlaceholder)
                    {
                        atom_ = Synergy.Instance.DefaultAtom;
                    }
                    else
                    {
                        atom_ = SuperController.singleton.GetAtomByUid(atomUID);
                    }

                    if (atom_ == null)
                    {
                        Synergy.LogError("atom '" + atomUID + "' not found");
                    }
                }
            }

            // migration from constant eye target
            o.OptRigidbody("relative", atom_, ref receiver_);

            if (receiver_ == null)
            {
                o.OptRigidbody("receiver", atom_, ref receiver_);
            }

            if (o.HasKey("offset"))
            {
                J.Wrappers.FromJSON(o.Get("offset"), ref offset_);
            }

            return(true);
        }
Beispiel #9
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("AudioModifier");

            if (o == null)
            {
                return(false);
            }

            if (o.HasChildArray("clips"))
            {
                var clipsArray = o.Get("clips").AsArray();

                if (clipsArray != null)
                {
                    var cm = URLAudioClipManager.singleton;

                    clipsArray.ForEach((clipNode) =>
                    {
                        var clipUID = clipNode?.AsString("Clip node");
                        if (string.IsNullOrEmpty(clipUID))
                        {
                            return;
                        }

                        var clip = cm.GetClip(clipUID);

                        if (clip == null)
                        {
                            Synergy.LogError("clip '" + clipUID + "' not found");
                        }
                        else
                        {
                            clips_.Add(clip);
                        }
                    });

                    Reshuffle();
                }
            }

            o.Opt("playType", ref playType_);

            return(true);
        }
Beispiel #10
0
        public virtual bool FromJSON(J.Node n)
        {
            var o = n.AsObject("BasicModifier");

            if (o == null)
            {
                return(false);
            }

            o.Opt("name", ref loadedUdn_);
            o.Opt <ModifierSyncFactory, IModifierSync>("sync", ref loadedSync_);

            return(true);
        }
Beispiel #11
0
            public static bool FromJSON(J.Node n, ref Vector3 v)
            {
                var o = n.AsObject("Vector3");

                if (o == null)
                {
                    return(false);
                }

                o.Opt("x", ref v.x);
                o.Opt("y", ref v.y);
                o.Opt("z", ref v.z);

                return(true);
            }
Beispiel #12
0
        public bool FromJSON(J.Node node)
        {
            var o = node.AsObject("Options");

            if (o == null)
            {
                return(false);
            }

            o.Opt("resetValuesOnFreeze", ref resetValuesOnFreeze_);
            o.Opt("resetCountersOnThaw", ref resetCountersOnThaw_);
            o.Opt("overlapTime", ref overlapTime_);

            return(true);
        }
Beispiel #13
0
        public override bool FromJSON(J.Node n)
        {
            var o = n.AsObject("RandomizableInt");

            if (o == null)
            {
                return(false);
            }

            o.Opt("initial", initial_);
            o.Opt("range", range_);
            o.Opt("interval", interval_);

            return(true);
        }
Beispiel #14
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("PlayerTargetType");

            if (o == null)
            {
                return(false);
            }

            return(true);
        }
Beispiel #15
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("RandomEyesTarget");

            if (o == null)
            {
                return(false);
            }

            if (o.HasKey("atom"))
            {
                var atomUID = o.Get("atom").AsString();
                if (atomUID != null)
                {
                    if (atomUID == Utilities.PresetAtomPlaceholder)
                    {
                        atom_ = Synergy.Instance.DefaultAtom;
                    }
                    else
                    {
                        atom_ = SuperController.singleton.GetAtomByUid(atomUID);
                    }

                    if (atom_ == null)
                    {
                        Synergy.LogError("atom '" + atomUID + "' not found");
                    }
                }
            }

            o.OptRigidbody("relative", atom_, ref rel_);

            o.Opt("distance", ref distance_);
            o.Opt("xCenter", ref centerX_);
            o.Opt("yCenter", ref centerY_);
            o.Opt("xRange", ref xRange_);
            o.Opt("yRange", ref yRange_);
            o.Opt("avoidXRange_", ref avoidXRange_);
            o.Opt("avoidYRange_", ref avoidYRange_);

            return(true);
        }
Beispiel #16
0
        public bool FromJSON(J.Node n)
        {
            var o = n.AsObject("LinkModifierController");

            if (o == null)
            {
                return(false);
            }

            o.Opt("controllerName", ref controllerName_);
            o.Opt("atomName", ref atomName_);
            o.Opt("rbName", ref rbName_);
            o.Opt("position", ref position_);
            o.Opt("rotation", ref rotation_);

            return(true);
        }
Beispiel #17
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("StepExtenderModifier");

            if (o == null)
            {
                return(false);
            }

            holder_.FromJSON(Atom, o);

            return(true);
        }
Beispiel #18
0
        public override bool FromJSON(J.Node n)
        {
            var o = n.AsObject("RandomDuration");

            if (o == null)
            {
                return(false);
            }

            RandomizableTime t = null;

            o.Opt("time", ref t);
            Time = t;

            Time.Reset(true);

            return(true);
        }
Beispiel #19
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("ParamDerivedStorableParameter");

            if (o == null)
            {
                return(false);
            }

            o.Opt("param", ref paramName_);

            return(true);
        }
Beispiel #20
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("StringListStorableParameter");

            if (o == null)
            {
                return(false);
            }

            o.Opt("strings", ref strings_);

            return(true);
        }
Beispiel #21
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("ColorLightProperty");

            if (o == null)
            {
                return(false);
            }

            o.Opt("color1", ref color1_);
            o.Opt("color2", ref color2_);

            return(true);
        }
Beispiel #22
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("LightModifier");

            if (o == null)
            {
                return(false);
            }

            o.Opt <LightPropertyFactory, ILightProperty>(
                "property", ref property_);

            return(true);
        }
Beispiel #23
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("ColorStorableParameter");

            if (o == null)
            {
                return(false);
            }

            o.Opt("color1", ref c1_);
            o.Opt("color2", ref c2_);

            return(true);
        }
Beispiel #24
0
        public bool FromJSON(J.Node n)
        {
            Clear();

            var o = n.AsObject("Step");

            if (o == null)
            {
                return(false);
            }

            o.Opt("enabled", enabled_);
            o.Opt("paused", ref paused_);
            o.Opt("name", ref name_);
            o.Opt("halfMove", halfMove_);
            o.Opt("modifiers", ref modifiers_);

            {
                IDuration d = null;
                o.Opt <DurationFactory, IDuration>("duration", ref d);
                Duration = d;
            }

            {
                RandomizableTime t = null;
                o.Opt("repeat", ref t);
                Repeat = t;
            }

            {
                Delay d = null;
                o.Opt("delay", ref d);
                Delay = d;
            }

            foreach (var m in modifiers_)
            {
                m.ParentStep = this;
            }

            return(true);
        }
Beispiel #25
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("EyesModifier");

            if (o == null)
            {
                return(false);
            }

            targets_.Clear();

            var targetsArray = o.Get("targets").AsArray();

            if (targetsArray != null)
            {
                targetsArray.ForEach((node) =>
                {
                    var tc = new EyesTargetContainer();
                    if (tc.FromJSON(node))
                    {
                        targets_.Add(tc);
                    }
                });
            }

            o.Opt("saccadeTime", ref saccadeTime_);
            o.Opt("saccadeMin", saccadeMin_);
            o.Opt("saccadeMax", saccadeMax_);
            o.Opt("minDistance", minDistance_);
            o.Opt("focusDuration", ref focusDuration_);
            o.Opt("gaze", ref gazeSetting_);
            o.Opt("blink", ref blinkSetting_);

            UpdateAtom();

            return(true);
        }
Beispiel #26
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("ActionStorableParameter");

            if (o == null)
            {
                return(false);
            }

            o.Opt("triggerMag", ref triggerMag_);
            o.Opt("triggerType", ref triggerType_);
            o.Opt("param", ref paramName_);

            return(true);
        }
Beispiel #27
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("AtomWithMovementModifier");

            if (o == null)
            {
                return(false);
            }

            Movement m = null;

            o.Opt("movement", ref m);
            Movement = m;

            return(true);
        }
Beispiel #28
0
        public override bool FromJSON(J.Node n)
        {
            if (!base.FromJSON(n))
            {
                return(false);
            }

            var o = n.AsObject("MorphModifier");

            if (o == null)
            {
                return(false);
            }

            if (Atom != null)
            {
                var morphsArray = o.Get("selectedMorphs").AsArray();

                if (morphsArray != null)
                {
                    morphsArray.ForEach((morphNode) =>
                    {
                        var sm = SelectedMorph.Create(Atom, null);

                        if (sm.FromJSON(morphNode))
                        {
                            morphs_.Add(sm);
                        }
                    });
                }

                IMorphProgression p = null;
                o.Opt <MorphProgressionFactory, IMorphProgression>(
                    "progression", ref p);

                Progression = p;
            }

            return(true);
        }
Beispiel #29
0
        public bool FromJSON(J.Node n)
        {
            var o = n.AsObject("StepDelay");

            if (o == null)
            {
                return(false);
            }

            IDuration d = null;

            if (o.HasKey("duration"))
            {
                // migration from v3
                o.Opt <DurationFactory, IDuration>("duration", ref d);
                HalfwayDuration      = d;
                EndForwardsDuration  = new RandomDuration();
                EndBackwardsDuration = new RandomDuration();
            }
            else
            {
                o.Opt <DurationFactory, IDuration>("halfwayDuration", ref d);
                HalfwayDuration = d;

                o.Opt <DurationFactory, IDuration>("endForwardsDuration", ref d);
                EndForwardsDuration = d;

                o.Opt <DurationFactory, IDuration>("endBackwardsDuration", ref d);
                EndBackwardsDuration = d;
            }

            o.Opt("halfway", halfway_);
            o.Opt("endForwards", endForwards_);
            o.Opt("endBackwards", endBackwards_);
            o.Opt("sameDelay", ref sameDelay_);

            return(true);
        }
Beispiel #30
0
        public override bool FromJSON(J.Node n)
        {
            var o = n.AsObject("UnsyncedModifier");

            if (o == null)
            {
                return(false);
            }

            {
                IDuration d = null;
                o.Opt <DurationFactory, IDuration>("duration", ref d);
                Duration = d;
            }

            {
                Delay d = null;
                o.Opt("delay", ref d);
                Delay = d;
            }

            return(true);
        }