Beispiel #1
0
        private void transformRoll(TransformComboRoll transform, int currentValue, int newValue)
        {
            Flush(false, typeof(TransformComboRoll));

            if (RollingDuration < 1)
            {
                DisplayedCount = Current;
                return;
            }

            transform.StartTime  = Time.Current;
            transform.EndTime    = Time.Current + getProportionalDuration(currentValue, newValue);
            transform.StartValue = currentValue;
            transform.EndValue   = newValue;
            transform.Easing     = RollingEasing;

            Transforms.Add(transform);
        }
        protected void TransformVectorTo(Vector2 startValue, Vector2 newValue, double duration, EasingTypes easing, TransformVector transform)
        {
            Type type = transform.GetType();

            if (transformationDelay == 0)
            {
                Transforms.RemoveAll(t => t.GetType() == type);

                if (startValue == newValue)
                {
                    return;
                }
            }
            else
            {
                startValue = (Transforms.FindLast(t => t.GetType() == type) as TransformVector)?.EndValue ?? startValue;
            }

            double startTime = Clock != null ? (Time.Current + transformationDelay) : 0;

            transform.StartTime  = startTime;
            transform.EndTime    = startTime + duration;
            transform.StartValue = startValue;
            transform.EndValue   = newValue;
            transform.Easing     = easing;

            if (Clock == null)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(this);
            }
            else if (duration == 0 && transformationDelay == 0)
            {
                transform.UpdateTime(Time);
                transform.Apply(this);
            }
            else
            {
                Transforms.Add(transform);
            }
        }
        protected void TransformFloatTo(float startValue, float newValue, double duration, EasingTypes easing, TransformFloat transform)
        {
            Type type = transform.GetType();

            if (transformationDelay == 0)
            {
                Transforms.RemoveAll(t => t.GetType() == type);
                if (startValue == newValue)
                {
                    return;
                }
            }
            else
            {
                startValue = (Transforms.FindLast(t => t.GetType() == type) as TransformFloat)?.EndValue ?? startValue;
            }

            double startTime = hasTimeAvailable ? (Time.Current + transformationDelay) : 0;

            transform.StartTime  = startTime;
            transform.EndTime    = startTime + duration;
            transform.StartValue = startValue;
            transform.EndValue   = newValue;
            transform.Easing     = easing;

            if (!hasTimeAvailable)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(this);
            }
            else if (duration == 0 && transformationDelay == 0)
            {
                transform.UpdateTime(Time);
                transform.Apply(this);
            }
            else
            {
                Transforms.Add(transform);
            }
        }
        public void FadeColour(SRGBColour newColour, int duration, EasingTypes easing = EasingTypes.None)
        {
            UpdateTransformsOfType(typeof(TransformColour));
            Color4 startValue = (Transforms.FindLast(t => t is TransformColour) as TransformColour)?.EndValue ?? Colour.Linear;

            if (transformationDelay == 0)
            {
                Transforms.RemoveAll(t => t is TransformColour);
                if (startValue == newColour)
                {
                    return;
                }
            }

            double startTime = Clock != null ? (Time.Current + transformationDelay) : 0;

            TransformColour transform = new TransformColour
            {
                StartTime  = startTime,
                EndTime    = startTime + duration,
                StartValue = startValue,
                EndValue   = newColour.Linear,
                Easing     = easing
            };

            if (Clock == null)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(this);
            }
            else if (duration == 0 && transformationDelay == 0)
            {
                transform.UpdateTime(Time);
                transform.Apply(this);
            }
            else
            {
                Transforms.Add(transform);
            }
        }
        public void FadeOutFromOne(double duration)
        {
            if (transformationDelay == 0)
            {
                Alpha = 1;
                Transforms.RemoveAll(t => t is TransformAlpha);
            }

            double startTime = Time.Current + transformationDelay;

            TransformAlpha tr = new TransformAlpha
            {
                StartTime  = startTime,
                EndTime    = startTime + duration,
                StartValue = 1,
                EndValue   = 0,
            };

            Transforms.Add(tr);
        }
Beispiel #6
0
            protected ASCBundle(string virtualPath, params IBundleTransform[] transforms)
                : base(virtualPath, transforms)
            {
                Transforms.Add(new CopyrigthTransform());

                if (!BundleTable.Bundles.UseCdn)
                {
                    return;
                }

                if (CoreContext.Configuration.Standalone)
                {
                    Transforms.Add(new DiscTransform());
                    CdnPath = DiscTransform.GetUri(Path, ContentType);
                }
                else
                {
                    Transforms.Add(new CdnTransform());
                }
            }
        public Drawable FlashColour(Color4 flashColour, int duration)
        {
            Debug.Assert(transformationDelay == 0, @"FlashColour doesn't support Delay() currently");

            Color4 startValue = (Transforms.FindLast(t => t is TransformColour) as TransformColour)?.EndValue ?? Colour;

            Transforms.RemoveAll(t => t is TransformColour);

            double startTime = Time + transformationDelay;

            Transforms.Add(new TransformColour(Clock)
            {
                StartTime  = startTime,
                EndTime    = startTime + duration,
                StartValue = flashColour,
                EndValue   = startValue,
            });

            return(this);
        }
Beispiel #8
0
        public void FlashColour(SRGBColour flashColour, int duration)
        {
            Debug.Assert(transformationDelay == 0, @"FlashColour doesn't support Delay() currently");

            Color4 startValue = (Transforms.FindLast(t => t is TransformColour) as TransformColour)?.EndValue ?? Colour.Linear;

            Transforms.RemoveAll(t => t is TransformColour);

            double startTime = Time.Current + transformationDelay;

            // We need to pass colours in linear space, since colour transformations work in linear colour space.
            Transforms.Add(new TransformColour
            {
                StartTime  = startTime,
                EndTime    = startTime + duration,
                StartValue = flashColour.Linear,
                EndValue   = startValue,
            });

            return;
        }
        public TransformAlpha FadeOutFromOne(double duration)
        {
            if (transformationDelay == 0)
            {
                Alpha = 1;
                Transforms.RemoveAll(t => t is TransformAlpha);
            }

            double startTime = Time + transformationDelay;

            TransformAlpha tr = new TransformAlpha(Clock)
            {
                StartTime  = startTime,
                EndTime    = startTime + duration,
                StartValue = 1,
                EndValue   = 0,
            };

            Transforms.Add(tr);
            return(tr);
        }
Beispiel #10
0
        /// <summary>
        /// Reset the currently playing clip
        /// </summary>
        public void Reset()
        {
            _tickCount     = 0;
            AnimationSpeed = 1.0f;

            if (_clipSet && CurrentClip != null)
            {
                //first bone transform
                var transform = CurrentClip.Keys[0].BoneTransforms;
                Transforms.Clear();
                Transforms = (transform.ToList());
            }
            else
            {
                //fill with identity matrix
                Transforms.Clear();

                for (var i = 0; i < _mesh.AnimationData.BoneCount; ++i)
                {
                    Transforms.Add(Matrix.Identity);
                }
            }
        }
        private Drawable transformVectorTo(Vector2 startValue, Vector2 newValue, double duration, EasingTypes easing, TransformVector transform)
        {
            Type type = transform.GetType();

            if (transformationDelay == 0)
            {
                Transforms.RemoveAll(t => t.GetType() == type);

                if (startValue == newValue)
                {
                    return(this);
                }
            }
            else
            {
                startValue = (Transforms.FindLast(t => t.GetType() == type) as TransformVector)?.EndValue ?? startValue;
            }

            double startTime = Time + transformationDelay;

            transform.StartTime  = startTime;
            transform.EndTime    = startTime + duration;
            transform.StartValue = startValue;
            transform.EndValue   = newValue;
            transform.Easing     = easing;

            if (duration == 0)
            {
                transform.Apply(this);
            }
            else
            {
                Transforms.Add(transform);
            }

            return(this);
        }
Beispiel #12
0
        /// <summary>
        /// Intended to be used by TransformCount(T currentValue, T newValue).
        /// </summary>
        protected void TransformCount(Transform <T, Drawable> transform, T currentValue, T newValue)
        {
            Type type = transform.GetType();

            Flush(false, type);

            if (RollingDuration < 1)
            {
                DisplayedCount = Current;
                return;
            }

            double rollingTotalDuration =
                IsRollingProportional
                    ? GetProportionalDuration(currentValue, newValue)
                    : RollingDuration;

            transform.StartTime = TransformStartTime;
            transform.EndTime   = TransformStartTime + rollingTotalDuration;
            transform.EndValue  = newValue;
            transform.Easing    = RollingEasing;

            Transforms.Add(transform);
        }
 /// <summary>
 /// Called by UIElement3D.InvalidateModel() to update the 3D model.
 /// </summary>
 protected override void OnUpdateModel()
 {
     foreach (UIElement3D element in Children)
     {
         if (Transforms.ContainsKey(element) && element.Transform != null)
         {
             (element.Transform as Transform3DGroup).Children.Remove(Transforms[element]);
             Transforms[element] = ComputeTransform(element);
             (element.Transform as Transform3DGroup).Children.Add(Transforms[element]);
         }
         else
         {
             Transforms.Add(element, ComputeTransform(element));
             var tg = new Transform3DGroup();
             if (element.Transform != null)
             {
                 tg.Children.Add(element.Transform);
             }
             tg.Children.Add(Transforms[element]);
             element.Transform = tg;
         }
     }
     base.OnUpdateModel();
 }
        public void FlashColour(SRGBColour flashColour, int duration, EasingTypes easing = EasingTypes.None)
        {
            Debug.Assert(transformationDelay == 0, @"FlashColour doesn't support Delay() currently");

            Color4 startValue = (Transforms.FindLast(t => t is TransformColour) as TransformColour)?.EndValue ?? Colour.Linear;

            Transforms.RemoveAll(t => t is TransformColour);

            double startTime = Clock != null ? (Time.Current + transformationDelay) : 0;

            TransformColour transform = new TransformColour
            {
                StartTime  = startTime,
                EndTime    = startTime + duration,
                StartValue = flashColour.Linear,
                EndValue   = startValue,
                Easing     = easing
            };

            if (Clock == null)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(this);
            }
            else if (duration == 0 && transformationDelay == 0)
            {
                transform.UpdateTime(Time);
                transform.Apply(this);
            }
            else
            {
                Transforms.Add(transform);
            }
        }
Beispiel #15
0
 /// <summary>
 /// Add a new transform object to this encoded entity. These are used by EntityProcessor
 /// implementations to facilitate in exporting and imported complex entities that need
 /// a little extra customization done to them.
 /// </summary>
 /// <param name="name">The name of the transform, this is the full class name of the processor.</param>
 /// <param name="value">The black box value for the transform.</param>
 public void AddTransformData(string name, object value)
 {
     Transforms.Add(name, value);
 }
Beispiel #16
0
 public TaskManagerScriptsBundle(string virtualPath) : base(virtualPath)
 {
     this.Builder = new NullBuilder();
     this.Orderer = new AsIsBundleOrderer();
     Transforms.Add(new ScriptTransformer());
 }
Beispiel #17
0
 public TaskManagerStylesBundle(string virtualPath) : base(virtualPath)
 {
     this.Builder = new NullBuilder();
     this.Orderer = new NullOrderer();
     Transforms.Add(new StyleTransformer());
 }
Beispiel #18
0
        /// <summary>
        /// Loop through all the keyframes
        /// </summary>
        public void Animate()
        {
            //Do nothing when not playing or no clip is set
            if (!IsPlaying && !_clipSet)
            {
                return;
            }

            var passedTime = (float)(DateTime.Now - _prevFrameTime).Milliseconds / 1000;
            //Debug.Log(LogLevel.Info, string.Format("Time since Last Frame: {0}",passedTime));

            //Make sure that the passedTicks stay between the m_CurrentClip.Duration bounds
            double passedTicks = passedTime * CurrentClip.TicksPerSecond * AnimationSpeed;

            passedTicks = Math.IEEERemainder(passedTicks, CurrentClip.Duration);

            //Debug.Log(LogLevel.Info, string.Format("Ticks: {0}", passedTicks));

            _tickCount += (float)passedTicks;

            //Reset when reaching the end
            if (_tickCount > CurrentClip.Duration)
            {
                _tickCount -= CurrentClip.Duration;
            }

            //Find the enclosing keys
            //Iterate all the keys of the clip and find the following keys:
            //keyA > Closest Key with Tick before/smaller than m_TickCount
            //keyB > Closest Key with Tick after/bigger than m_TickCount
            AnimationKey keyA = null, keyB = null;
            var          prevKey = CurrentClip.Keys[0]; //start at first1
            var          found   = false;

            foreach (var k in CurrentClip.Keys)
            {
                if (!found && k.Tick > _tickCount && _tickCount > 0.0f && k.Tick != _tickCount)
                {
                    keyA  = prevKey;
                    keyB  = k;
                    found = true;
                }
                prevKey = k;
            }

            if (keyA == null || keyB == null)
            {
                return;
            }

            //lerp between keys
            var blendA = _tickCount - keyA.Tick;
            var blendB = 1.0f - blendA;

            blendB = _tickCount - blendB;
            var lerpAmount = blendA / blendB;

            Transforms.Clear();

            for (var i = 0; i < _mesh.AnimationData.BoneCount; ++i)
            {
                if (i >= keyA.BoneTransforms.Count || i >= keyB.BoneTransforms.Count)
                {
                    break;
                }

                Transforms.Add(Matrix.Lerp(keyA.BoneTransforms[i], keyB.BoneTransforms[i], lerpAmount));
            }


            _prevFrameTime = DateTime.Now;
        }
Beispiel #19
0
        /// <summary>
        ///     Instantiate the Doppeganger recursively. Makes a fully copy of all visual
        ///     components of the object, discarding non-visual components.
        /// </summary>
        /// <param name="currentLevel">Current level to target</param>
        private void InstantiateDoppleganger(Transform currentLevel)
        {
            var other = SKSGeneralUtils.FindAnalogousTransform(currentLevel, Doppleganger.transform, Root, true);

            //Remove the MainCamera tag if it's been erroniously copied.
            if (currentLevel.tag.Equals("MainCamera"))
            {
                currentLevel.tag = Keywords.Tags.Untagged;
            }

            currentLevel.gameObject.name = currentLevel.gameObject.name;
            foreach (var component in currentLevel.GetComponents <Component>())
            {
                if (component is Teleportable)
                {
                    component.SafeDestroyComponent();
                }
                //Copies Transforms for later updating
                else if (component is Transform)
                {
                    if (other)
                    {
                        if (!Transforms.ContainsKey(other))
                        {
                            Transforms.Add(other, (Transform)component);
                        }
                    }
                    else
                    {
                        Destroy(currentLevel.gameObject);
                        break;
                    }
                }
                else if (component is Renderer)
                {
                    if (component is SkinnedMeshRenderer)
                    {
                        SkinnedRenderers.Add(component as SkinnedMeshRenderer);
                    }

                    var meshRenderer = component as MeshRenderer;
                    if (meshRenderer != null)
                    {
                        var otherRend = other.GetComponent <MeshRenderer>();
                        if (!Renderers.ContainsKey(otherRend))
                        {
                            Renderers[otherRend] = meshRenderer;
                        }
                        //Adds colliders to list for collision ignoring upon Portal entry
                    }
                    else
                    {
                        var otherRend = other.GetComponent <Renderer>();
                        if (!Renderers.ContainsKey(otherRend))
                        {
                            Renderers[otherRend] = (Renderer)component;
                        }
                        //Adds colliders to list for collision ignoring upon Portal entry
                    }
                }
                else if (component is Collider)
                {
                    if (!component.GetComponent <TeleportablePhysExclude>())
                    {
                        var c = other.GetComponent <Collider>();
                        if (!_colliders.ContainsKey(c.GetInstanceID()))
                        {
                            _colliders.Add(c.GetInstanceID(), c);
                        }
#if SKS_VR
                        else
                        {
                            //Fix for VRTK double-genning body colliders for no reason

                            currentLevel.gameObject.transform.SetParent(null);
                            c.enabled = false;
                            int key = c.GetInstanceID();
                            _colliders[key].enabled   = false;
                            c.isTrigger               = true;
                            _colliders[key].isTrigger = true;
                            DestroyImmediate(_colliders[key].gameObject);
                            DestroyImmediate(currentLevel.gameObject);
                            continue;
                        }
#endif
                    }

                    if (StripColliders && component)
                    {
                        component.SafeDestroyComponent();
                    }
                }
                else if (component is Rigidbody)
                {
                    if (StripRigidbodies)
                    {
                        component.SafeDestroyComponent();
                    }
                }
                else if (component is Joint)
                {
                    if (StripJoints)
                    {
                        component.SafeDestroyComponent();
                    }
                }
                else if (component is MonoBehaviour)
                {
                    //Handling of teleportable scripts
                    if (component is TeleportableScript)
                    {
                        TeleportableScripts.Add(other.GetComponent <TeleportableScript>());
                    }

                    if (!StripScripts)
                    {
                        ((MonoBehaviour)component).enabled = true;
                    }
                    else
                    {
                        component.SafeDestroyComponent();
                    }
                    //Nonspecific setup copying
                }
                else
                {
                    var system = component as ParticleSystem;
                    if (system != null)
                    {
                        var otherSystem = other.GetComponent <ParticleSystem>();
                        system.randomSeed = otherSystem.randomSeed;
                        system.time       = otherSystem.time;
                    }
                    else if (component is MeshFilter || component is Light)
                    {
                        //nothin to do
                    }
                    else
                    {
                        component.SafeDestroyComponent();
                    }
                }
            }

            if (other)
            {
                currentLevel.gameObject.SetActive(other.gameObject.activeSelf);
            }

            foreach (Transform t in currentLevel)
            {
                InstantiateDoppleganger(t);
            }
        }
Beispiel #20
0
 public void Register(ITransform transform)
 {
     Context.Debug(() => $"Registering {transform.GetType().Name}.");
     Transforms.Add(transform);
 }
Beispiel #21
0
        private void InstantiateDoppleganger(Transform currentLevel)
        {
            Transform other = SKSGeneralUtils.FindAnalogousTransform(currentLevel, Doppleganger.transform, root, true);

            if (currentLevel.tag.Equals("MainCamera"))
            {
                currentLevel.tag = "Untagged";
            }
            currentLevel.gameObject.name = currentLevel.gameObject.name;
            foreach (Component component in currentLevel.GetComponents <Component>())
            {
                if (component is Teleportable)
                {
                    component.SafeDestroyComponent();
                }
                //Copies Transforms for later updating
                else if (component is Transform)
                {
                    if (other)
                    {
                        if (!Transforms.ContainsKey(other))
                        {
                            Transforms.Add(other, (Transform)component);
                        }
                    }
                    else
                    {
                        Destroy(currentLevel.gameObject);
                        break;
                    }
                }
                else if (component is Renderer)
                {
                    if (component is SkinnedMeshRenderer)
                    {
                        SkinnedRenderers.Add(component as SkinnedMeshRenderer);
                    }
                    if (component is Renderer)
                    {
                        if (!Renderers.ContainsKey((Renderer)component))
                        {
                            Renderers[other.GetComponent <Renderer>()] = (Renderer)component;
                        }
                        //Adds colliders to list for collision ignoring upon Portal entry
                    }
                }
                else if (component is Collider)
                {
                    if (!component.GetComponent <TeleportablePhysExclude>())
                    {
                        Collider c = other.GetComponent <Collider>();
                        if (!Colliders.ContainsKey(c.GetInstanceID()))
                        {
                            Colliders.Add(c.GetInstanceID(), c);
                        }
                        else
                        {
                            //Fix for VRTK double-genning body colliders for no reason
                            currentLevel.gameObject.transform.SetParent(null);
                            c.enabled = false;
                            Colliders[c.GetInstanceID()].enabled = false;
                            c.isTrigger = true;
                            Colliders[c.GetInstanceID()].isTrigger = true;
                            DestroyImmediate(Colliders[c.GetInstanceID()].gameObject);
                            DestroyImmediate(currentLevel.gameObject);
                            return;
                        }
                    }
                    if (StripColliders && component)
                    {
                        component.SafeDestroyComponent();
                    }
                }
                else if (component is Rigidbody)
                {
                    if (StripRigidbodies)
                    {
                        component.SafeDestroyComponent();
                    }
                }
                else if (component is Joint)
                {
                    if (StripJoints)
                    {
                        component.SafeDestroyComponent();
                    }
                }
                else if (component is MonoBehaviour)
                {
                    //Handling of teleportable scripts
                    if (component is TeleportableScript)
                    {
                        TeleportableScripts.Add(other.GetComponent <TeleportableScript>());
                    }

                    if (!StripScripts)
                    {
                        if (component != null)
                        {
                            ((MonoBehaviour)component).enabled = true;
                        }
                    }
                    else
                    {
                        component.SafeDestroyComponent();
                    }
                    //Nonspecific setup copying
                }
                else if (component is MeshFilter || component is ParticleSystem || component is Light)
                {
                    //nothin to do
                }
                else
                {
                    component.SafeDestroyComponent();
                }
            }

            if (other)
            {
                currentLevel.gameObject.SetActive(other.gameObject.activeSelf);
            }

            foreach (Transform t in currentLevel)
            {
                InstantiateDoppleganger(t);
            }
        }
Beispiel #22
0
        public static bool IsRearFace(string name)
        {
            if (Transforms == null)
            {
                Transforms = new List <string>();
                if (File.Exists("transforms.txt"))
                {
                    Transforms.AddRange(File.ReadAllLines("transforms.txt"));
                }
            }

            if (Transforms.Contains(name))
            {
                return(true);
            }

            if (NotTransforms.Contains(name))
            {
                return(false);
            }

            var url = $"https://api.scryfall.com/cards/named?exact={name}";

            using (var wc = new WebClient())
            {
                try
                {
                    var     blob = wc.DownloadString(url);
                    var     json = JsonConvert.DeserializeObject(blob) as JObject;
                    JObject face;

                    switch (json.Value <string>("layout"))
                    {
                    case "transform":
                    case "flip":
                        face = json["card_faces"].First(f => f.Value <string>(nameof(name)) == name) as JObject;
                        break;

                    case "meld":
                        face = json;
                        break;

                    case "adventure":
                        face = json["card_faces"].First(f => f.Value <string>(nameof(name)) == name) as JObject;
                        break;

                    default:
                        return(false);
                    }

                    if (!face.TryGetValue("mana_cost", out var cost) || string.IsNullOrEmpty(face.Value <string>("mana_cost")) || face.Value <string>("type_line").Contains("Adventure"))
                    {
                        Transforms.Add(name);
                        try
                        {
                            File.AppendAllLines("transforms.txt", new string[] { name });
                        }
                        catch (IOException)
                        {
                        }
                        return(true);
                    }
                    else
                    {
                        NotTransforms.Add(name);
                        return(false);
                    }
                }
                catch (WebException c)
                {
                    NotTransforms.Add(name);
                    Console.WriteLine(name);
                    SentrySdk.CaptureException(c);
                }

                return(false);
            }
        }
            protected ASCBundle(string virtualPath, params IBundleTransform[] transforms)
                : base(virtualPath, transforms)
            {
                Transforms.Add(new CopyrigthTransform());

                if (!BundleTable.Bundles.UseCdn)
                {
                    return;
                }

                bool isCDN = false;

                var section = (StorageConfigurationSection)WebConfigurationManager.GetSection("storage");

                foreach (HandlerConfigurationElement h in section.Handlers)
                {
                    if (String.Compare(h.Name, "cdn", true) != 0)
                    {
                        continue;
                    }

                    if (h.Type.Equals(typeof(SelectelStorage)))
                    {
                        Transforms.Add(new SelectelStorageTransform());
                    }
                    else if (h.Type.Equals(typeof(S3Storage)))
                    {
                        Transforms.Add(new CloudFrontTransform());
                    }
                    else if (h.Type.Equals(typeof(GoogleCloudStorage)))
                    {
                        Transforms.Add(new GoogleCloudStorageTransform());
                    }
                    else if (h.Type.Equals(typeof(RackspaceCloudStorage)))
                    {
                        Transforms.Add(new RackspaceCloudStorageTransform());
                    }
                    else
                    {
                        throw new Exception("unknown argument");
                    }

                    isCDN = true;

                    break;
                }

                if (!isCDN)
                {
                    if (CoreContext.Configuration.Standalone)
                    {
                        if (DiscTransform.SuccessInitialized)
                        {
                            Transforms.Add(new DiscTransform());
                            CdnPath = DiscTransform.GetUri(Path, ContentType);
                        }
                        else
                        {
                            Transforms.Add(new StorageTransform());
                        }
                    }
                }
            }
Beispiel #24
0
        public void TransformCopyIntoParameters(Entity entity = null)
        {
            if (RequiresCopyParameters())
            {
                if (!Transforms.Any())
                {
                    Transforms.Add(new Transform {
                        Method = "copy"
                    });
                }
                var first      = Transforms.First();
                var expression = Utility.Split(T, ExpressionSplitter)[0];
                var parameters = Utility.Split(expression.Substring(expression.IndexOf('(') + 1), ',');

                foreach (var p in parameters)
                {
                    var parameter = new Parameter();
                    var modified  = p.TrimEnd(')');
                    if (modified.Contains(":"))
                    {
                        //named values
                        var named = modified.Split(':');
                        parameter.Name  = named[0];
                        parameter.Value = named[1];
                    }
                    else if (modified.Contains("."))
                    {
                        // entity, field combinations
                        var dotted = modified.Split('.');
                        parameter.Entity = dotted[0];
                        parameter.Field  = dotted[1];
                    }
                    else
                    {
                        parameter.Field = modified; // just fields
                        if (entity != null)
                        {
                            parameter.Entity = entity.Alias;
                        }
                    }
                    first.Parameters.Add(parameter);
                }
                // hack
                if (first.Parameters.Count == 1 && first.Parameters.First().Field == "*")
                {
                    first.Parameter = "*";
                    first.Parameters.Clear();
                }
            }

            // e.g. t="copy(x).is(int).between(3,5), both is() and between() should refer to x.
            if (RequiresCompositeValidator())
            {
                var first = Transforms.First();
                foreach (var transform in Transforms.Skip(1))
                {
                    transform.Parameter  = transform.Parameter == string.Empty ? first.Parameter : transform.Parameter;
                    transform.Parameters = transform.Parameters.Count == 0 ? first.Parameters : transform.Parameters;
                }
            }
        }
Beispiel #25
0
        protected override void UpdateState(ArmedState state)
        {
            if (!IsLoaded)
            {
                return;
            }

            Flush(); //move to DrawableHitObject

            Transforms.Add(new TransformAlpha(Clock)
            {
                StartTime = h.StartTime - 1000, EndTime = h.StartTime - 800, StartValue = 0, EndValue = 1
            });

            approachCircle.Transforms.Add(new TransformScale(Clock)
            {
                StartTime = h.StartTime - 1000, EndTime = h.StartTime, StartValue = new Vector2(2f), EndValue = new Vector2(0.6f)
            });
            approachCircle.Transforms.Add(new TransformAlpha(Clock)
            {
                StartTime = h.StartTime, EndTime = h.StartTime, StartValue = 1, EndValue = 0
            });

            glow.Transforms.Add(new TransformAlpha(Clock)
            {
                StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = glow.Alpha, EndValue = 0
            });

            switch (state)
            {
            case ArmedState.Disarmed:
                Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0
                });
                break;

            case ArmedState.Armed:
                const float flashIn = 30;
                const float fadeOut = 800;

                //Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = Scale, EndValue = Scale * 1.1f });

                ring.Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0
                });
                circle.Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0
                });
                number.Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0
                });

                flash.Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0.8f
                });
                flash.Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + 100, StartValue = 0.8f, EndValue = 0
                });

                explode.Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 1
                });

                Transforms.Add(new TransformAlpha(Clock)
                {
                    StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + fadeOut, StartValue = 1, EndValue = 0
                });

                Transforms.Add(new TransformScale(Clock)
                {
                    StartTime = h.StartTime + h.Duration, EndTime = h.StartTime + h.Duration + 400, StartValue = Scale, EndValue = Scale * 1.5f, Easing = EasingTypes.OutQuad
                });
                break;
            }
        }
 public JuCheapScriptBundle(string virtrualPath)
     : base(virtrualPath)
 {
     Transforms.Add(_jso);
 }