예제 #1
0
    void FixedUpdate()
    {
        scale = Smoothing.SpringSmooth(scale, scaleTarget, ref scaleSpeed, 0.1f, Time.deltaTime);
        if (scaleTargetTransform != null)
        {
            ///wtf unity
            if (baseScale == Vector3.zero)
            {
                baseScale   = scaleTargetTransform.localScale;
                targetScale = baseScale * hoverScale;
            }

            scaleTargetTransform.localScale = scale * targetScale + (1 - scale) * baseScale;
        }
        if (backPlate != null)
        {
            Color c = backPlate.material.color;
            c.a = scale * backplateAlpha * plateAlpha;
            backPlate.material.color = c;
            if (backplateScale == Vector3.zero)
            {
                backplateScale = backPlate.transform.localScale;
                targetScale    = baseScale * hoverScale;
            }
            backPlate.transform.localScale = (1 - scale) * backplateScale + scale * (hoverScale * backplateScale);
        }

        if (text != null)
        {
            //Color c = text.color;
            //c.a = scale;
            //text.color = c;
        }
    }
예제 #2
0
    private void Update()
    {
        float f = Mathf.InverseLerp(0f, 2000f, force.magnitude);

        f = Mathf.Sqrt(f);
        float num = Vector3.Dot(boom.transform.right, force.normalized);

        num = Mathf.Clamp(num * 100f, -1f, 1f);
        float num2 = Mathf.Abs(Vector3.Dot(rhs: (wind - boom.GetPointVelocity(forcePoint.position)).normalized, lhs: boom.transform.right));
        float num3 = Mathf.Sqrt(1f - num2 * num2);
        float time = ReplayRecorder.time;
        float num4 = lastFrameTime - time;

        lastFrameTime = time;
        phaseOpen    += num4 * f * f * 100f;
        phaseFill    += num4 * f * 5f;
        float value  = num2 * num * f;
        float value2 = num3 * num * f;

        value  = Smoothing.SmoothValue(smoothFill, value);
        value2 = Smoothing.SmoothValue(smoothOpen, value2);
        SetSignedShape(0, 150f * value + Mathf.Sin(phaseFill) * Mathf.Lerp(5f, 0f, f * 10f));
        SetSignedShape(2, 150f * value2 + Mathf.Sin(phaseOpen) * Mathf.Lerp(10f, 5f, f));
        if (sailSound != null)
        {
            sailSound.SetPitch(Mathf.Lerp(0.4f, 1.2f, f));
            sailSound.SetVolume(Mathf.Lerp(0.2f, 1f, f));
        }
    }
예제 #3
0
        private void Awake()
        {
            dist = new() {
                Lerp = (float x, float y) => Mathf.Lerp(x, y, Common.Damping()),
            };
            dist.Init(defaultDist);

            center = new() {
                Lerp    = (Vector3 x, Vector3 y) => Vector3.Lerp(x, y, Common.Damping()),
                GetDest = () => {
                    if (manager.player == null)
                    {
                        return(center.current);
                    }
                    return(manager.player.transform.position);
                },
            };

            rotation = new() {
                Lerp       = (Quaternion x, Quaternion y) => Quaternion.Slerp(x, y, Common.Damping()),
                GetCurrent = () => transform.rotation,
                SetCurrent = (Quaternion x) => transform.rotation = x,
            };

            persp = new() {
                Lerp    = (float x, float y) => Mathf.Lerp(x, y, Common.Damping()),
                GetDest = () => {
                    if (manager.map is null)
                    {
                        return(persp.current);
                    }
                    return(manager.map.view is Views.Orthogonal ? 0f : 1f);
                },
            };
        }
예제 #4
0
 public void EndSession()
 {
     song      = null;
     smoothing = null;
     playing   = false;
     foreach (Transform child in transform)
     {
         if (child.name.ToLower().Contains("pool"))
         {
             Destroy(child.gameObject);
         }
     }
     frameIndex = 0;
     //noteInstancePool = null;
     Destroy(guitarSource.clip);
     Destroy(rhythmSource.clip);
     Destroy(songSource.clip);
     Destroy(guitarSource);
     Destroy(rhythmSource);
     Destroy(songSource);
     guitarSource      = rhythmSource = songSource = null;
     time              = previousTime = 0;
     tick              = 0;
     smoothTick        = 0;
     starPowerDuration = 0;
     bpm       = smoothBpm = 0;
     syncIndex = 0;
     for (int i = 0; i < players.Length; ++i)
     {
         players[i].Dispose();
     }
     System.GC.Collect();
 }
        public SmoothingProFunctionChart(ChartView BaseChart)
        {
            line1     = new Line();
            line2     = new Line();
            smoothing = new Smoothing();
            var       = new Variables.Variables();

            BaseChart.Chart.Title.Text                   = "Smoothing";
            BaseChart.Chart.Axes.Left.Automatic          = true;
            BaseChart.Chart.Axes.Left.Ticks.Transparency = 100;
            BaseChart.Chart.Axes.Bottom.Automatic        = true;
            BaseChart.Chart.Axes.Left.Increment          = 1;

            line1.FillSampleValues(6);
            line1.Title              = "Line";
            line1.LinePen.Width      = 3;
            line1.Color              = var.GetPaletteBasic[0];
            line1.Pointer.Visible    = true;
            line1.Marks.Transparency = 100;

            line2.DataSource      = line1;
            line2.Function        = smoothing;
            line2.LinePen.Width   = 3;
            line2.Color           = var.GetPaletteBasic[1];
            line2.Title           = "Line Smoothed";
            line2.Marks.DrawEvery = 12;

            smoothing.Factor = 50;

            BaseChart.Chart.Series.Add(line1);
            BaseChart.Chart.Series.Add(line2);
        }
예제 #6
0
    public void SetSmoothing(Smoothing s)
    {
        smoothing = s;
        switch (s)
        {
        case Smoothing.Noisiest:
            winWidth = 1024;
            break;

        case Smoothing.Noisier:
            winWidth = 1024 * 2;
            break;

        case Smoothing.Normal:
            winWidth = 1024 * 4;
            break;

        case Smoothing.Smoother:
            winWidth = 1024 * 8;
            break;

        case Smoothing.Smoothest:
            winWidth = 1024 * 16;
            break;
        }
        samples = new float[winWidth];
    }
예제 #7
0
    void UpdateReticle()
    {
        //if( target!= null && reticle != null){
        //reticle.SetTarget(target.Position);
        reticle.UpdateReticlePosition();

        if (target == null || target.Invisible)
        {
            reticlePointAlpha       = 1;
            reticleRingAlpha        = 0;
            reticleTransitionTarget = 0;
        }
        else
        {
            reticlePointAlpha = 0;
            reticleRingAlpha  = 1;

            reticleTransitionTarget = 1;
        }
        reticleRotationPercent = 1;
        reticleTransition      = Smoothing.SpringSmooth(reticleTransition, reticleTransitionTarget, ref reticleTransitionSpeed, 0.1f, Time.deltaTime);

        Shader.SetGlobalVector("_Reticle", new Vector4(Mathf.Clamp01(1 - 3f * reticleTransition), reticleTransition, reticleRotationPercent, (1.0f - reticleTransition) * 0.7f));
        //}
    }
예제 #8
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         if (Width != null)
         {
             hashCode = hashCode * 59 + Width.GetHashCode();
         }
         if (Shape != null)
         {
             hashCode = hashCode * 59 + Shape.GetHashCode();
         }
         if (Smoothing != null)
         {
             hashCode = hashCode * 59 + Smoothing.GetHashCode();
         }
         if (Dash != null)
         {
             hashCode = hashCode * 59 + Dash.GetHashCode();
         }
         if (Simplify != null)
         {
             hashCode = hashCode * 59 + Simplify.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #9
0
    float linearTime;     //= 1f - smoothInTime - smoothOutTime;
    void Update()
    {
        if (moving)
        {
            //velocity = Mathf.Clamp(velocity + 2f*Time.deltaTime, 0, maxVelocity);
            if (blend < 1)
            {
                blend = Mathf.Clamp01(blend + currentTarget.MovementSpeed * Time.deltaTime / distance);
            }
            //float smoothedBlend = blend;//Smoothing.CubicEaseInOut(blend);
            if (blend < smoothInTime)
            {
                //if(!SceneManager.Instance.PendingTransition){
                //	Blackout.Instance.TargetBlackoutValue = 1;
                //	Blackout.Instance.SetFogFade(true);
                //}
                //v = 3x^2
                //smoothedBlend = 0;
                smoothedBlend = smoothInTime * Smoothing.CubicEaseIn(blend / smoothInTime);
            }
            else if (blend > (1f - smoothOutTime))
            {
                smoothedBlend = smoothInTime + (linearTime) * 3f + smoothOutTime * Smoothing.CubicEaseOut((blend - (1 - smoothOutTime)) / smoothOutTime);
                //smoothedBlend = 0.9f + 0.1f*Smoothing.CubicEaseOut(10f*(blend-0.9f));
            }
            else
            {
                smoothedBlend = smoothInTime + (blend - smoothInTime) * 3f;
            }

            if (blend > 1.5f * smoothInTime || blend > 0.5)
            {
                //if(!SceneManager.Instance.PendingTransition){
                //	Blackout.Instance.TargetBlackoutValue = 0;
                //	Blackout.Instance.SetFogFade(true);
                //}
            }

            smoothedBlend = smoothedBlend / (smoothInTime + smoothOutTime + 3f * linearTime);

            if (smoothedBlend < 0.001f)
            {
                smoothedBlend = 0;
            }
            else if (smoothedBlend > 0.999f)
            {
                smoothedBlend = 1;
            }

            transform.position = (1 - smoothedBlend) * previousPosition + smoothedBlend * targetPosition;

            if (blend >= 1)
            {
                moving           = false;
                previousPosition = targetPosition;
                //velocity = 0;
            }
        }
    }
예제 #10
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Smoothing smoothing = new Smoothing();

            //map = smoothing.SmoothintMap(map);
            map = smoothing.MakeGrayscale(map);
            DisplacementMap.Image = map;
        }
예제 #11
0
        /// <summary>
        /// Method to perform preparatory work for symbilizing.
        /// </summary>
        /// <param name="g">The graphics object to symbolize upon</param>
        /// <param name="map">The map</param>
        /// <param name="aproximateNumberOfGeometries">An approximate number of geometries to symbolize</param>
        public virtual void Begin(IGraphics g, Map map, int aproximateNumberOfGeometries)
        {
            _oldSmootingMode = g.SmoothingMode;
            _oldPixelOffsetMode = g.PixelOffsetMode;

            g.SmoothingMode = SmoothingMode;
            g.PixelOffsetMode = PixelOffsetMode;
        }
예제 #12
0
        /// <summary>
        /// Method to perform preparatory work for symbilizing.
        /// </summary>
        /// <param name="g">The graphics object to symbolize upon</param>
        /// <param name="map">The map</param>
        /// <param name="aproximateNumberOfGeometries">An approximate number of geometries to symbolize</param>
        public virtual void Begin(IGraphics g, Map map, int aproximateNumberOfGeometries)
        {
            _oldSmootingMode    = g.SmoothingMode;
            _oldPixelOffsetMode = g.PixelOffsetMode;

            g.SmoothingMode   = SmoothingMode;
            g.PixelOffsetMode = PixelOffsetMode;
        }
예제 #13
0
    void UpdateScroll(bool forceLayout = false)
    {
        if (!wasScrolling)
        {
            scrollTarget += momentum * Time.deltaTime;
            momentum     *= Mathf.Clamp01(1 - 10 * Time.deltaTime);
            if (scrollTarget < 0)
            {
                scrollTarget = Smoothing.SpringSmooth(scrollTarget, 0, ref scrollClampVelocity, 0.2f, Time.deltaTime);
                if (Mathf.Abs(scrollTarget) < 0.1f)
                {
                    scrollTarget        = 0;
                    scrollClampVelocity = 0;
                }
            }
            else if (scrollTarget > TotalHeight)
            {
                scrollTarget = Smoothing.SpringSmooth(scrollTarget, TotalHeight, ref scrollClampVelocity, 0.2f, Time.deltaTime);
                if (Mathf.Abs(TotalHeight - scrollTarget) < 0.1f)
                {
                    scrollTarget        = TotalHeight;
                    scrollClampVelocity = 0;
                }
            }
        }
        else
        {
            momentum = scrollVelocity;
        }


        if (scroll != scrollTarget || forceLayout)
        {
            scroll = Smoothing.SpringSmooth(scroll, scrollTarget, ref scrollVelocity, 0.025f, Time.deltaTime);
            if (Mathf.Abs(scroll - scrollTarget) < 0.1f)
            {
                scroll         = scrollTarget;
                scrollVelocity = 0;
            }


            int   newOffset    = (int)(scroll / elementHeight);
            float scrollOffset = -scroll % elementHeight;

            if (indexOffset != newOffset)
            {
                indexOffset = newOffset;
                UpdateOffset();
            }


            for (int i = 0; i < elementPool.Length; i++)
            {
                elementPool[i].root.Position = new Vector2(0, elementHeight * i + scrollOffset);
                //elementPool[i].UpdateTexture();
            }
        }
    }
예제 #14
0
        public static void ApplySmoothingGroup(PBMesh pbMesh, MeshSelection selection, float angleThreshold)
        {
            selection = selection.ToFaces(false);

            ProBuilderMesh mesh  = pbMesh.ProBuilderMesh;
            IList <Face>   faces = new List <Face>();

            mesh.GetFaces(selection.GetFaces(pbMesh).ToArray(), faces);
            Smoothing.ApplySmoothingGroups(mesh, faces, angleThreshold);
        }
예제 #15
0
 protected override void DoUpdate()
 {
     base.DoUpdate();
     if (current != target)
     {
         current          = Smoothing.SpringSmooth(current, target, ref speed, 0.1f, Time.deltaTime);
         material.color   = new Color(1, 1, 1, current);
         frame.localScale = (1f + 0.2f * current) * initialScale;
     }
 }
예제 #16
0
 void Update()
 {
     if (currentColor != targetColor)
     {
         currentColor.r = Smoothing.SpringSmooth(currentColor.r, targetColor.r, ref colorSpeed.x, 0.1f, Time.deltaTime);
         currentColor.g = Smoothing.SpringSmooth(currentColor.g, targetColor.g, ref colorSpeed.y, 0.1f, Time.deltaTime);
         currentColor.b = Smoothing.SpringSmooth(currentColor.b, targetColor.b, ref colorSpeed.z, 0.1f, Time.deltaTime);
         currentColor.a = Smoothing.SpringSmooth(currentColor.a, targetColor.a, ref colorSpeed.w, 0.1f, Time.deltaTime);
         meshRenderer.material.color = currentColor;
     }
 }
예제 #17
0
        public void SmoothMethod1()
        {
            var     value    = Smoothing.Smooth(5, inputValue3);
            decimal accuracy = 0.001m;

            for (int i = 0; i < value.Length; i++)
            {
                if (Abs(value[i] - output1[i]) > accuracy)
                {
                    Assert.Fail(Abs(value[i] - output1[i]).ToString());
                }
            }
        }
        public double[,] GetPressureTrace(double startTime, double endTime, Smoothing smoothing = Smoothing.None, int smoothingPoints = 3)
        {
            // @@ TODO:
            // Set Controller to 2 to get A/D card. That's where pressure trace is stored
            _rawConnection.SetCurrentController(2, 1);
            object chro  = null;
            object flags = null;
            int    size  = 0;

            _rawConnection.GetChroData(0, 0, 0, string.Empty, string.Empty, string.Empty, 0.0, startTime, endTime, (int)smoothing, smoothingPoints, ref chro, ref flags, ref size);
            _rawConnection.SetCurrentController(0, 1);
            return((double[, ])chro);
        }
예제 #19
0
 void Update()
 {
     // scale enlarging
     scale = Smoothing.SpringSmooth(scale, scaleTarget, ref scaleSpeed, 0.1f, Time.deltaTime);
     if (scaleTargetTransform != null)
     {
         ///wtf unity
         if (baseScale == Vector3.zero)
         {
             baseScale   = scaleTargetTransform.localScale;
             targetScale = baseScale * hoverScale;
         }
         scaleTargetTransform.localScale = scale * targetScale + (1 - scale) * baseScale;
     }
 }
예제 #20
0
 void Update()
 {
     transform.localPosition = initialPosition + (1 + startup) * new Vector3(0.05f * Mathf.Sin(0.837f * Time.time + startup), 0.1f * Mathf.Sin(Time.time + startup), 0.023f * Mathf.Sin(0.776f * Time.time + startup));
     if (popping)
     {
         float time    = 0.5f * (Time.time - popTime);
         float expTime = Smoothing.ExponentialEaseOut(time);
         meshRenderer.material.SetFloat("_Explosion", expTime);
         collider.enabled = false;
         if (time > 1)
         {
             gameObject.SetActive(false);
         }
     }
 }
예제 #21
0
    void LateUpdate()
    {
        float cameraDistance = bird.NormalizedVelocityMagnitude * (maxDistance - minDistance) + minDistance;

        Vector3 currentPosition = transform.position;
        Vector3 targetPosition  = target.position + cameraDistance * cameraTransform.forward;      //prev -10 distance

        currentPosition.x = Smoothing.SpringSmooth(currentPosition.x, targetPosition.x, ref speed.x, 0.5f, Time.deltaTime);
        currentPosition.y = Smoothing.SpringSmooth(currentPosition.y, targetPosition.y, ref speed.y, 0.5f, Time.deltaTime);
        currentPosition.z = Smoothing.SpringSmooth(currentPosition.z, targetPosition.z, ref speed.z, 0.5f, Time.deltaTime);

        transform.position = currentPosition;
        Quaternion targetRotation = target.rotation * Quaternion.AngleAxis(20f, Vector3.right);

        transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Mathf.Clamp01(Time.deltaTime * 5f));
    }
예제 #22
0
    void Update()
    {
        // if(Input.GetMouseButtonDown(0)){
        //  Toast();
        // }
        time += Time.deltaTime;

        arrowTransform.localPosition = initialArrowPosition + new Vector3(0, amplitude * Mathf.Sin(frequency * Time.time), 0);
        if (time < toastTime)
        {
            val = Smoothing.SpringSmooth(val, 1, ref valSpeed, 0.25f, Time.deltaTime);
            Color c = textMesh.color;
            c.a            = val;
            textMesh.color = c;
            c   = backplate.material.color;
            c.a = val;
            backplate.material.color = c;

            c   = arrow.material.color;
            c.a = val;
            arrow.material.color = c;
            currentPitch         = (1 - val) * startPitch + val * endPitch;
            menu.Pitch           = currentPitch;
        }
        else
        {
            if (val != 0)
            {
                val = Smoothing.SpringSmooth(val, 0, ref valSpeed, 0.1f, Time.deltaTime);
                if (Mathf.Abs(val) < 0.01f)
                {
                    val = 0;
                }
                Color c = textMesh.color;
                c.a            = val;
                textMesh.color = c;

                c   = backplate.material.color;
                c.a = val;
                backplate.material.color = c;

                c   = arrow.material.color;
                c.a = val;
                arrow.material.color = c;
            }
        }
    }
예제 #23
0
    public void UpdateReticlePosition()
    {
        float springSpeed = 0.05f;

        if (targetFocalDepth < currentFocalDepth)
        {
            springSpeed = 0.05f;
        }
        else
        {
            springSpeed = .5f;
        }

        currentFocalDepth = Smoothing.SpringSmooth(currentFocalDepth, targetFocalDepth, ref focalDepthSpeed, springSpeed, Time.deltaTime);
        //currentFocalDepth = targetFocalDepth;
        transform.localPosition = new Vector3(0, 0, currentFocalDepth);
    }
예제 #24
0
        public void CreateBoundary()
        {
            var boundaryPoints = Config.BoundaryGeoData.GetPathInStreamingAssets().GetBoundaryPoints().AddTileIntersectionPoints();

            // Create vertices
            var wallVertices = new List <Vector3>();

            for (int p = 0; p < boundaryPoints.Length - 1; p++)
            {
                var point0 = boundaryPoints[p];
                var point1 = boundaryPoints[p + 1];

                wallVertices.Add(point0);
                wallVertices.Add(point1);
                wallVertices.Add(new Vector3(point0.x, point0.y + Config.BoundaryHeight, point0.z));
                wallVertices.Add(new Vector3(point1.x, point1.y + Config.BoundaryHeight, point1.z));
            }

            // Create faces
            var faces = new List <Face>();

            for (int f = 0; f < wallVertices.Count - 3; f += 4)
            {
                var faceVertices = new int[] { f, f + 1, f + 2, f + 1, f + 3, f + 2 };
                faces.Add(new Face(faceVertices));
            }

            var wall = ProBuilderMesh.Create(wallVertices, faces);

            Normals.CalculateNormals(wall);
            Normals.CalculateTangents(wall);
            Smoothing.ApplySmoothingGroups(wall, faces, 30);
            wall.ToMesh();
            wall.Refresh();
            EditorMeshUtility.Optimize(wall);

            var meshRenderer = wall.GetComponent <MeshRenderer>();

            meshRenderer.material          = Config.BoundaryMaterial;
            meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            meshRenderer.lightProbeUsage   = UnityEngine.Rendering.LightProbeUsage.Off;

            wall.gameObject.name = wall.name = Path.GetFileNameWithoutExtension(Config.BoundaryGeoData).Replace('_', ' ');
            wall.transform.SetParent(null, true);
        }
예제 #25
0
    void Update()
    {
        //We don't want to be setting the material values every frame.
        if (currentBlackoutValue != targetBlackoutValue)
        {
            currentBlackoutValue = Smoothing.SpringSmooth(currentBlackoutValue, targetBlackoutValue, ref blackoutSpeed, smoothPower, Time.deltaTime);

            if (Mathf.Abs(currentBlackoutValue - targetBlackoutValue) < epsilon)
            {
                currentBlackoutValue = targetBlackoutValue;
                blackoutSpeed        = 0;
            }

            SetMeshRendererVisibility();

            blackoutMaterial.color = new Color(color.r, color.g, color.b, currentBlackoutValue);
        }
    }
예제 #26
0
 void Update()
 {
     if (animating)
     {
         time = Mathf.Clamp01(2f * Time.deltaTime + time);
         float val = Smoothing.QuinticEaseOut(time);
         val = val * xTarget + (1 - val) * xStart;
         uiTransform.RelativePosition = new Vector2(val, 0);
         if (time == 1)
         {
             animating = false;
             if (!activating)
             {
                 gameObject.SetActive(false);
             }
         }
     }
 }
예제 #27
0
    IEnumerator Close()
    {
        float elapsedTime = 0;
        float startHeight = 0;
        float endHeight   = panelTransform.sizeDelta.y - barHeight;

        while (elapsedTime < openingTime)
        {
            elapsedTime += Time.deltaTime;
            float percentage = Smoothing.SmoothStep(elapsedTime / openingTime, 2);
            MovePanel(Mathf.Lerp(startHeight, endHeight, percentage));
            reverseTopBar.alpha = Mathf.Lerp(1, 0, percentage);
            yield return(null);
        }
        MovePanel(endHeight);
        state = States.closed;
        reverseTopBar.interactable = false;
    }
예제 #28
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Line other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                     ) &&
                 (
                     Width == other.Width ||
                     Width != null &&
                     Width.Equals(other.Width)
                 ) &&
                 (
                     Shape == other.Shape ||
                     Shape != null &&
                     Shape.Equals(other.Shape)
                 ) &&
                 (
                     Smoothing == other.Smoothing ||
                     Smoothing != null &&
                     Smoothing.Equals(other.Smoothing)
                 ) &&
                 (
                     Dash == other.Dash ||
                     Dash != null &&
                     Dash.Equals(other.Dash)
                 ) &&
                 (
                     Simplify == other.Simplify ||
                     Simplify != null &&
                     Simplify.Equals(other.Simplify)
                 ));
        }
예제 #29
0
    IEnumerator SlideMenu()
    {
        sliding = true;

        while (true)
        {
            slidePosition = Smoothing.SpringSmooth(slidePosition, slideTo, ref slideSpeed, 0.16f, Time.deltaTime);
            slideRect.anchoredPosition = new Vector2(slidePosition, slideRect.anchoredPosition.y);

            if (Mathf.Abs(slidePosition - slideTo) < 0.01f)
            {
                break;
            }

            yield return(null);
        }

        // snap to final position
        slideRect.SetAnchoredHorizontalPosition(slideTo);
        sliding = false;
    }
예제 #30
0
        public static void DrawHandle(Canvas canvas, XGraphics graphics, Palette palette, Rect bounds, DrawingContext context, bool alwaysAlpha, bool round)
        {
            if (bounds.Width <= 0 || bounds.Height <= 0)
            {
                return;
            }

            using (var quality = new Smoothing(graphics, XSmoothingMode.Default)) {
                XBrush brush;
                Pen    pen;
                var    alpha = 180;

                if (context.Selected)
                {
                    if (!alwaysAlpha)
                    {
                        alpha = 255;
                    }
                    brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LemonChiffon), Color.FromArgb(alpha, Color.DarkOrange));
                    pen   = palette.Pen(Color.FromArgb(alpha, Color.Chocolate), 0);
                }
                else
                {
                    brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LightCyan), Color.FromArgb(alpha, Color.SteelBlue));
                    pen   = palette.Pen(Color.FromArgb(alpha, Color.Navy), 0);
                }

                if (round)
                {
                    graphics.DrawEllipse(brush, bounds.ToRectangleF());
//          graphics.DrawRectangle(new XPen(Color.Red), bounds.ToRectangleF() );
                    graphics.DrawEllipse(pen, bounds.ToRectangleF());
                }
                else
                {
                    graphics.DrawRectangle(brush, bounds.ToRectangleF());
                    graphics.DrawRectangle(pen, bounds.ToRectangleF());
                }
            }
        }
예제 #31
0
 static public void RunPeTM(PorSForJointje PorS, Smoothing SmoothingBE, BnOrNot bnOrNot)
 {
     double[] accuracyOfPersonalityForEachGroup = new double[GroupVariable.AnnotatorGroups.Length];
     for (int groupIndex = 0; groupIndex < GroupVariable.AnnotatorGroups.Length; ++groupIndex)
     {
         IDictionary <Annotator, IDictionary <Character, IDictionary <Will, double> > > okcx = PersonalityFunction.CalculateOkcx(groupIndex);//模拟人对角色个性的标注,计算一次就不变了
         Mce  mce  = InitializeMce(groupIndex);
         Sije sije = null;
         if (bnOrNot == BnOrNot.Yes)
         {
             sije = InitializeSijeWithBN(mce, groupIndex);
         }
         else
         {
             sije = InitializeSije(mce, groupIndex); //old new
         }
         Pje            pje    = null;               //p(t|e)
         Pdata          pdata  = null;
         IList <double> Pdatas = new List <double>();
         for (int convergeTime = 1; convergeTime <= Variable.ConvergeTimeThreshold; ++convergeTime)
         {
             mce = CalculateMce(sije, groupIndex);
             PAkjl pakjl = CoreFunction.CalculatePAkjl(Variable.LabelArray, sije.ToSij, convergeTime, groupIndex);
             BEkef bekef = PersonalityFunction.CalculateBExy(mce, okcx, SmoothingBE, convergeTime, groupIndex);
             if (PorS == PorSForJointje.P)
             {
                 pje = CalculatePje(sije, convergeTime);
             }
             if (CalculatePdataAndSije(ref sije, pakjl, bekef, pje, mce, okcx, ref pdata, Pdatas, groupIndex))//old/new
             {
                 break;
             }
         }
         IDictionary <Sentence, IDictionary <Will, double> > sic = ObtainBinaryResult(sije, mce, groupIndex);
         WriteBinaryResultFile(sic, mce, groupIndex);
         PersonalityFunction.WriteMVResultFile(mce, groupIndex);
         accuracyOfPersonalityForEachGroup[groupIndex] = PersonalityPaperFunction.AccuracyOfPersonalityForEachGroup(PersonalityVariable.TruePersonality, mce.EstimatedPersonality);
     }
     Function.ConsoleWriteLine("Accuracy Of PeTM: " + PersonalityPaperFunction.AccuracyOfPersonality(accuracyOfPersonalityForEachGroup));
 }
 public void SetSmoothing(Smoothing s)
 {
     smoothing = s;
     switch(s){
         case Smoothing.Noisiest:
             winWidth = 1024;
             break;
         case Smoothing.Noisier:
             winWidth = 1024*2;
             break;
         case Smoothing.Normal:
             winWidth = 1024*4;
             break;
         case Smoothing.Smoother:
             winWidth = 1024*8;
             break;
         case Smoothing.Smoothest:
             winWidth = 1024*16;
             break;
     }
     samples = new float[winWidth];
 }
예제 #33
0
 public double[,] GetChro(string scanFilter, MzRange range, double startTime, double endTime, Smoothing smoothing = Smoothing.None, int smoothingPoints = 3)
 {
     object chro = null;
     object flags =null;
     int size = 0;
     string mzrange = range.Minimum.ToString("F4") + "-" + range.Maximum.ToString("F4");
     _rawConnection.GetChroData(0, 0, 0, scanFilter, mzrange, string.Empty, 0.0, startTime, endTime, (int)smoothing, smoothingPoints, ref chro, ref flags, ref size);
     return (double[,])chro;
 }