Exemple #1
0
    public dfList <T> Clone()
    {
        dfList <T> ts = dfList <T> .Obtain(this.count);

        Array.Copy(this.items, ts.items, this.count);
        ts.count = this.count;
        return(ts);
    }
Exemple #2
0
    public dfList <T> Concat(dfList <T> list)
    {
        dfList <T> ts = dfList <T> .Obtain(this.count + list.count);

        ts.AddRange(this);
        ts.AddRange(list);
        return(ts);
    }
Exemple #3
0
        public static PooledEnumerator Obtain(dfList <T> list, Func <T, bool> predicate)
        {
            var enumerator = (pool.Count > 0) ? pool.Dequeue() : new PooledEnumerator();

            enumerator.ResetInternal(list, predicate);

            return(enumerator);
        }
Exemple #4
0
    public void AddRange(T[] list)
    {
        this.EnsureCapacity(this.count + (int)list.Length);
        Array.Copy(list, 0, this.items, this.count, (int)list.Length);
        dfList <T> length = this;

        length.count = length.count + (int)list.Length;
    }
Exemple #5
0
 private void ResetInternal(dfList <T> list, Func <T, bool> predicate)
 {
     this.isValid      = true;
     this.list         = list;
     this.predicate    = predicate;
     this.currentIndex = 0;
     this.currentValue = default(T);
 }
Exemple #6
0
    /// <summary>
    /// Adds the elements of the specified collection to the end of the <see cref="dfList"/>
    /// </summary>
    public void AddRange(dfList <T> list)
    {
        var listCount = list.count;

        EnsureCapacity(this.count + listCount);
        Array.Copy(list.items, 0, this.items, this.count, listCount);
        this.count += listCount;
    }
Exemple #7
0
 internal void Process(Transform transform, Camera renderCamera, dfList <Touch> touches, bool retainFocus)
 {
     for (int i = 0; i < touches.Count; i++)
     {
         Touch        item            = touches[i];
         Ray          ray             = renderCamera.ScreenPointToRay(item.position);
         float        single          = renderCamera.farClipPlane - renderCamera.nearClipPlane;
         RaycastHit[] raycastHitArray = Physics.RaycastAll(ray, single, renderCamera.cullingMask);
         dfInputManager.controlUnderMouse = this.clipCast(transform, raycastHitArray);
         if (dfInputManager.controlUnderMouse == null && item.phase == TouchPhase.Began)
         {
             this.untracked.Add(item.fingerId);
         }
         else if (!this.untracked.Contains(item.fingerId))
         {
             dfInputManager.TouchInputManager.TouchRaycast        touchRaycast        = new dfInputManager.TouchInputManager.TouchRaycast(dfInputManager.controlUnderMouse, item, ray);
             dfInputManager.TouchInputManager.ControlTouchTracker controlTouchTracker = this.tracked.FirstOrDefault <dfInputManager.TouchInputManager.ControlTouchTracker>((dfInputManager.TouchInputManager.ControlTouchTracker x) => x.IsTrackingFinger(touchRaycast.FingerID));
             if (controlTouchTracker == null)
             {
                 bool flag = false;
                 int  num  = 0;
                 while (num < this.tracked.Count)
                 {
                     if (!this.tracked[num].Process(touchRaycast))
                     {
                         num++;
                     }
                     else
                     {
                         flag = true;
                         break;
                     }
                 }
                 if (!flag && dfInputManager.controlUnderMouse != null)
                 {
                     if (!this.tracked.Any <dfInputManager.TouchInputManager.ControlTouchTracker>((dfInputManager.TouchInputManager.ControlTouchTracker x) => x.control == dfInputManager.controlUnderMouse))
                     {
                         if (dfInputManager.controlUnderMouse == null)
                         {
                             Debug.Log(string.Concat("Tracking touch with no control: ", item.fingerId));
                         }
                         dfInputManager.TouchInputManager.ControlTouchTracker controlTouchTracker1 = new dfInputManager.TouchInputManager.ControlTouchTracker(this.manager, dfInputManager.controlUnderMouse);
                         this.tracked.Add(controlTouchTracker1);
                         controlTouchTracker1.Process(touchRaycast);
                     }
                 }
             }
             else
             {
                 controlTouchTracker.Process(touchRaycast);
             }
         }
         else if (item.phase == TouchPhase.Ended)
         {
             this.untracked.Remove(item.fingerId);
         }
     }
 }
 private static void addTriangleIndices(dfList<Vector3> verts, dfList<int> triangles)
 {
     int count = verts.Count;
     int[] tRIANGLEINDICES = dfMarkupBoxSprite.TRIANGLE_INDICES;
     for (int i = 0; i < (int)tRIANGLEINDICES.Length; i++)
     {
         triangles.Add(count + tRIANGLEINDICES[i]);
     }
 }
Exemple #9
0
    private static void rebuildColors(dfRenderData renderData, RenderOptions options)
    {
        dfList <Color32> colors = renderData.Colors;

        colors.Add(options.color);
        colors.Add(options.color);
        colors.Add(options.color);
        colors.Add(options.color);
    }
Exemple #10
0
    void container_ControlCollectionChanged(dfControl panel, dfControl child)
    {
        controls = new dfList <dfControl>(panel.Controls);

        if (autoSelectOnStart && Application.isPlaying)
        {
            setSelectedIndex(controls.Count / 2);
        }
    }
        /// <summary>
        /// Render the given text as mesh data to the given destination buffer
        /// </summary>
        /// <param name="text">The text to be rendered</param>
        /// <param name="destination">The dfRenderData buffer that will hold the
        /// text mesh information</param>
        public override void Render(string text, dfRenderData destination)
        {
            //@Profiler.BeginSample( "Render dynamic font text" );

            textColors.Clear();
            textColors.Push(Color.white);

            // Ensure that the required characters can be found in the dynamic font's
            // character data.
            var font     = (dfDynamicFont)Font;
            var fontSize = Mathf.CeilToInt(font.FontSize * TextScale);

            font.RequestCharacters(text, fontSize, FontStyle.Normal);

            tokenize(text);
            var lines = calculateLinebreaks();

            destination.EnsureCapacity(getAnticipatedVertCount(tokens));

            var maxWidth  = 0;
            var maxHeight = 0;

            var position = (VectorOffset / PixelRatio).CeilToInt();

            for (int i = 0; i < lines.Count; i++)
            {
                var line             = lines[i];
                var lineStartIndex   = destination.Vertices.Count;
                var spriteStartIndex = (SpriteBuffer != null) ? SpriteBuffer.Vertices.Count : 0;

                renderLine(lines[i], textColors, position, destination);

                position.y -= line.lineHeight;

                maxWidth   = Mathf.Max((int)line.lineWidth, maxWidth);
                maxHeight += Mathf.CeilToInt(line.lineHeight);

                if (line.lineWidth > MaxSize.x)
                {
                    clipRight(destination, lineStartIndex);
                    clipRight(SpriteBuffer, spriteStartIndex);
                }

                clipBottom(destination, lineStartIndex);
                clipBottom(SpriteBuffer, spriteStartIndex);
            }

            this.RenderedSize = new Vector2(
                Mathf.Min(MaxSize.x, maxWidth),
                Mathf.Min(MaxSize.y, maxHeight)
                ) * TextScale;

            this.tokens.Release();
            this.tokens = null;

            //@Profiler.EndSample();
        }
    /// <summary>
    /// Returns a concatenated list containing all elements both lists
    /// </summary>
    public dfList <T> Concat(dfList <T> list)
    {
        var result = dfList <T> .Obtain(this.count + list.count);

        result.AddRange(this);
        result.AddRange(list);

        return(result);
    }
Exemple #13
0
    public dfList <TResult> Convert <TResult>()
    {
        dfList <TResult> tResults = dfList <TResult> .Obtain(this.count);

        for (int i = 0; i < this.count; i++)
        {
            tResults.Add((TResult)Convert.ChangeType(this.items[i], typeof(TResult)));
        }
        return(tResults);
    }
Exemple #14
0
        private static void addTriangleIndices(dfList <Vector3> verts, dfList <int> triangles)
        {
            int count = verts.Count;

            int[] tRIANGLEINDICES = dfFont.BitmappedFontRenderer.TRIANGLE_INDICES;
            for (int i = 0; i < (int)tRIANGLEINDICES.Length; i++)
            {
                triangles.Add(count + tRIANGLEINDICES[i]);
            }
        }
Exemple #15
0
    private void addQuadIndices(dfList <Vector3> verts, dfList <int> triangles)
    {
        int count = verts.Count;

        int[] numArray = new int[] { 0, 1, 3, 3, 1, 2 };
        for (int i = 0; i < numArray.Length; i++)
        {
            triangles.Add(count + numArray[i]);
        }
    }
Exemple #16
0
 internal dfRenderData(int capacity = 32)
 {
     this.Vertices  = new dfList <Vector3>(capacity);
     this.Triangles = new dfList <int>(capacity);
     this.Normals   = new dfList <Vector3>(capacity);
     this.Tangents  = new dfList <Vector4>(capacity);
     this.UV        = new dfList <Vector2>(capacity);
     this.Colors    = new dfList <Color32>(capacity);
     this.Transform = Matrix4x4.identity;
 }
Exemple #17
0
    public dfList <TResult> Convert <TResult>()
    {
        dfList <TResult> list = dfList <TResult> .Obtain(this.count);

        for (int i = 0; i < this.count; i++)
        {
            list.Add((TResult)System.Convert.ChangeType(this.items[i], typeof(TResult)));
        }
        return(list);
    }
Exemple #18
0
    public dfList <TResult> Select <TResult>(Func <T, TResult> selector)
    {
        dfList <TResult> list = dfList <TResult> .Obtain(this.count);

        for (int i = 0; i < this.count; i++)
        {
            list.Add(selector(this.items[i]));
        }
        return(list);
    }
Exemple #19
0
    private void addQuadColors(dfList <Color32> colors)
    {
        colors.EnsureCapacity(colors.Count + 4);
        Color32 color32 = base.ApplyOpacity((!base.IsEnabled ? this.disabledColor : this.color));

        for (int i = 0; i < 4; i++)
        {
            colors.Add(color32);
        }
    }
    private static void addTriangleIndices(dfList <Vector3> verts, dfList <int> triangles)
    {
        int count = verts.Count;

        int[] tRIANGLEINDICES = dfMarkupBoxSprite.TRIANGLE_INDICES;
        for (int i = 0; i < (int)tRIANGLEINDICES.Length; i++)
        {
            triangles.Add(count + tRIANGLEINDICES[i]);
        }
    }
    private static void addTriangleIndices(dfList <Vector3> verts, dfList <int> triangles)
    {
        int count = verts.Count;

        int[] numArray = TRIANGLE_INDICES;
        for (int i = 0; i < numArray.Length; i++)
        {
            triangles.Add(count + numArray[i]);
        }
    }
    private void addQuadColors(dfList <Color32> colors)
    {
        colors.EnsureCapacity(colors.Count + 4);
        var color = ApplyOpacity(IsEnabled ? this.color : this.disabledColor);

        for (int i = 0; i < 4; i++)
        {
            colors.Add(color);
        }
    }
Exemple #23
0
        private static void addTriangleIndices(dfList <Vector3> verts, dfList <int> triangles)
        {
            var vcount  = verts.Count;
            var indices = TRIANGLE_INDICES;

            for (int ii = 0; ii < indices.Length; ii++)
            {
                triangles.Add(vcount + indices[ii]);
            }
        }
Exemple #24
0
    private void addQuadColors(dfList <Color32> colors)
    {
        colors.EnsureCapacity(colors.Count + 4);
        Color32 item = base.ApplyOpacity(!base.IsEnabled ? base.disabledColor : base.color);

        for (int i = 0; i < 4; i++)
        {
            colors.Add(item);
        }
    }
Exemple #25
0
    private static void rebuildTriangles(dfRenderData renderData, dfSprite.RenderOptions options)
    {
        int          baseIndex = options.baseIndex;
        dfList <int> triangles = renderData.Triangles;

        for (int i = 0; i < triangleIndices.Length; i++)
        {
            triangles.Add(baseIndex + triangleIndices[i]);
        }
    }
Exemple #26
0
    /// <summary>
    /// Initializes a new instance of the <see cref="dfRenderData"/> class.
    /// Direct instantiation of this class is discouraged in favor of using
    /// the <see cref="Lookup"/> method to benefit from object pooling.
    /// </summary>
    /// <param name="capacity">The initial capacity of the internal lists</param>
    internal dfRenderData( int capacity = 32 )
    {
        Vertices = new dfList<Vector3>( capacity );
        Triangles = new dfList<int>( capacity );
        Normals = new dfList<Vector3>( capacity );
        Tangents = new dfList<Vector4>( capacity );
        UV = new dfList<Vector2>( capacity );
        Colors = new dfList<Color32>( capacity );

        this.Transform = Matrix4x4.identity;
    }
Exemple #27
0
    private static void rebuildTriangles(dfRenderData renderData, RenderOptions options)
    {
        int          baseIndex = options.baseIndex;
        dfList <int> triangles = renderData.Triangles;

        triangles.EnsureCapacity(triangles.Count + TRIANGLE_INDICES.Length);
        for (int i = 0; i < TRIANGLE_INDICES.Length; i++)
        {
            triangles.Add(baseIndex + TRIANGLE_INDICES[i]);
        }
    }
Exemple #28
0
    public void Add(T item)
    {
        this.EnsureCapacity(this.count + 1);
        T[]        tArray  = this.items;
        dfList <T> _dfList = this;
        int        num     = _dfList.count;
        int        num1    = num;

        _dfList.count = num + 1;
        tArray[num1]  = item;
    }
Exemple #29
0
    public void Insert(int index, T item)
    {
        this.EnsureCapacity(this.count + 1);
        if (index < this.count)
        {
            Array.Copy(this.items, index, this.items, index + 1, this.count - index);
        }
        this.items[index] = item;
        dfList <T> _dfList = this;

        _dfList.count = _dfList.count + 1;
    }
Exemple #30
0
	private void clipQuads(dfRenderData buffer, int startIndex)
	{
		dfList<Vector3> vertices = buffer.Vertices;
		dfList<Vector2> uV = buffer.UV;
		float units = base.PixelsToUnits();
		Vector3 upperLeft = base.Pivot.TransformToUpperLeft(base.Size);
		float single = (upperLeft.y - (float)this.listPadding.top) * units;
		float single1 = single - (this.size.y - (float)this.listPadding.vertical) * units;
		for (int i = startIndex; i < vertices.Count; i = i + 4)
		{
			Vector3 item = vertices[i];
			Vector3 vector3 = vertices[i + 1];
			Vector3 item1 = vertices[i + 2];
			Vector3 vector31 = vertices[i + 3];
			float single2 = item.y - vector31.y;
			if (vector31.y < single1)
			{
				float single3 = 1f - Mathf.Abs(-single1 + item.y) / single2;
				item = new Vector3(item.x, Mathf.Max(item.y, single1), vector3.z);
				vertices[i] = item;
				vector3 = new Vector3(vector3.x, Mathf.Max(vector3.y, single1), vector3.z);
				vertices[i + 1] = vector3;
				item1 = new Vector3(item1.x, Mathf.Max(item1.y, single1), item1.z);
				vertices[i + 2] = item1;
				vector31 = new Vector3(vector31.x, Mathf.Max(vector31.y, single1), vector31.z);
				vertices[i + 3] = vector31;
				float item2 = uV[i + 3].y;
				Vector2 vector2 = uV[i];
				float single4 = Mathf.Lerp(item2, vector2.y, single3);
				Vector2 vector21 = uV[i + 3];
				uV[i + 3] = new Vector2(vector21.x, single4);
				Vector2 vector22 = uV[i + 2];
				uV[i + 2] = new Vector2(vector22.x, single4);
				single2 = Mathf.Abs(vector31.y - item.y);
			}
			if (item.y > single)
			{
				float single5 = Mathf.Abs(single - item.y) / single2;
				vertices[i] = new Vector3(item.x, Mathf.Min(single, item.y), item.z);
				vertices[i + 1] = new Vector3(vector3.x, Mathf.Min(single, vector3.y), vector3.z);
				vertices[i + 2] = new Vector3(item1.x, Mathf.Min(single, item1.y), item1.z);
				vertices[i + 3] = new Vector3(vector31.x, Mathf.Min(single, vector31.y), vector31.z);
				float item3 = uV[i].y;
				Vector2 vector23 = uV[i + 3];
				float single6 = Mathf.Lerp(item3, vector23.y, single5);
				Vector2 item4 = uV[i];
				uV[i] = new Vector2(item4.x, single6);
				Vector2 vector24 = uV[i + 1];
				uV[i + 1] = new Vector2(vector24.x, single6);
			}
		}
	}
Exemple #31
0
    public dfList <T> Where(Func <T, bool> predicate)
    {
        dfList <T> list = dfList <T> .Obtain(this.count);

        for (int i = 0; i < this.count; i++)
        {
            if (predicate(this.items[i]))
            {
                list.Add(this.items[i]);
            }
        }
        return(list);
    }
Exemple #32
0
 public override void Release()
 {
     this.Reset();
     this.tokens = null;
     if (this.lines != null)
     {
         this.lines.Release();
         this.lines = null;
     }
     dfFont.LineRenderInfo.ResetPool();
     base.BottomColor = null;
     objectPool.Enqueue(this);
 }
Exemple #33
0
 private dfList<dfDynamicFont.LineRenderInfo> calculateLinebreaks()
 {
     dfList<dfDynamicFont.LineRenderInfo> lineRenderInfos;
     bool flag;
     try
     {
         if (this.lines == null)
         {
             this.lines = dfList<dfDynamicFont.LineRenderInfo>.Obtain();
             dfDynamicFont font = (dfDynamicFont)base.Font;
             int num = 0;
             int num1 = 0;
             int num2 = 0;
             int num3 = 0;
             float baseline = (float)font.Baseline * base.TextScale;
             while (num2 < this.tokens.Count)
             {
                 Vector2 maxSize = base.MaxSize;
                 if ((float)this.lines.Count * baseline > maxSize.y + baseline)
                 {
                     break;
                 }
                 dfMarkupToken item = this.tokens[num2];
                 dfMarkupTokenType tokenType = item.TokenType;
                 if (tokenType != dfMarkupTokenType.Newline)
                 {
                     int num4 = Mathf.CeilToInt((float)item.Width);
                     if (!base.WordWrap || num <= num1)
                     {
                         flag = false;
                     }
                     else if (tokenType == dfMarkupTokenType.Text)
                     {
                         flag = true;
                     }
                     else
                     {
                         flag = (tokenType != dfMarkupTokenType.StartTag ? false : item.Matches("sprite"));
                     }
                     if (!flag || (float)(num3 + num4) < base.MaxSize.x)
                     {
                         if (tokenType == dfMarkupTokenType.Whitespace)
                         {
                             num = num2;
                         }
                         num3 = num3 + num4;
                         num2++;
                     }
                     else if (num <= num1)
                     {
                         this.lines.Add(dfDynamicFont.LineRenderInfo.Obtain(num1, num - 1));
                         int num5 = num2 + 1;
                         num2 = num5;
                         num = num5;
                         num1 = num5;
                         num3 = 0;
                     }
                     else
                     {
                         this.lines.Add(dfDynamicFont.LineRenderInfo.Obtain(num1, num - 1));
                         int num6 = num + 1;
                         num = num6;
                         num2 = num6;
                         num1 = num6;
                         num3 = 0;
                     }
                 }
                 else
                 {
                     this.lines.Add(dfDynamicFont.LineRenderInfo.Obtain(num1, num2));
                     int num7 = num2 + 1;
                     num2 = num7;
                     num = num7;
                     num1 = num7;
                     num3 = 0;
                 }
             }
             if (num1 < this.tokens.Count)
             {
                 this.lines.Add(dfDynamicFont.LineRenderInfo.Obtain(num1, this.tokens.Count - 1));
             }
             for (int i = 0; i < this.lines.Count; i++)
             {
                 this.calculateLineSize(this.lines[i]);
             }
             lineRenderInfos = this.lines;
         }
         else
         {
             lineRenderInfos = this.lines;
         }
     }
     finally
     {
     }
     return lineRenderInfos;
 }
Exemple #34
0
    private void addQuadIndices( dfList<Vector3> verts, dfList<int> triangles )
    {
        var vcount = verts.Count;
        var indices = new int[] { 0, 1, 3, 3, 1, 2 };

        for( int ii = 0; ii < indices.Length; ii++ )
        {
            triangles.Add( vcount + indices[ ii ] );
        }
    }
Exemple #35
0
 private void addQuadColors(dfList<Color32> colors)
 {
     colors.EnsureCapacity(colors.Count + 4);
     Color32 color32 = base.ApplyOpacity((!base.IsEnabled ? this.disabledColor : this.color));
     for (int i = 0; i < 4; i++)
     {
         colors.Add(color32);
     }
 }
    private void gatherRenderBuffers( dfMarkupBox box, dfList<dfRenderData> buffers )
    {
        var intersectionType = getViewportIntersection( box );
        if( intersectionType == dfIntersectionType.None )
        {
            return;
        }

        var buffer = box.Render();
        if( buffer != null )
        {

            if( buffer.Material == null )
            {
                if( this.atlas != null )
                {
                    buffer.Material = atlas.Material;
                }
            }

            var p2u = PixelsToUnits();
            var scroll = -scrollPosition.Scale( 1, -1 ).RoundToInt();
            var offset = (Vector3)( scroll + box.GetOffset().Scale( 1, -1 ) ) + pivot.TransformToUpperLeft( Size );

            var vertices = buffer.Vertices;
            for( int i = 0; i < buffer.Vertices.Count; i++ )
            {
                vertices[ i ] = ( offset + vertices[ i ] ) * p2u;
            }

            if( intersectionType == dfIntersectionType.Intersecting )
            {
                clipToViewport( buffer );
            }

            buffer.Transform = transform.localToWorldMatrix;
            buffers.Add( buffer );

        }

        for( int i = 0; i < box.Children.Count; i++ )
        {
            gatherRenderBuffers( box.Children[ i ], buffers );
        }
    }
	private dfTriangleClippingRegion()
	{
		planes = new dfList<Plane>();
	}
		private static void addUVCoords( dfList<Vector2> uvs, UnityEngine.CharacterInfo glyph )
		{

			var region = glyph.uv;
			var uvLeft = region.x;
			var uvTop = region.y + region.height;
			var uvRight = uvLeft + region.width;
			var uvBottom = region.y;

			if( glyph.flipped )
			{
				uvs.Add( new Vector2( uvRight, uvBottom ) );
				uvs.Add( new Vector2( uvRight, uvTop ) );
				uvs.Add( new Vector2( uvLeft, uvTop ) );
				uvs.Add( new Vector2( uvLeft, uvBottom ) );
			}
			else
			{
				uvs.Add( new Vector2( uvLeft, uvTop ) );
				uvs.Add( new Vector2( uvRight, uvTop ) );
				uvs.Add( new Vector2( uvRight, uvBottom ) );
				uvs.Add( new Vector2( uvLeft, uvBottom ) );
			}

		}
		/// <summary>
		/// Render the given text as mesh data to the given destination buffer
		/// </summary>
		/// <param name="text">The text to be rendered</param>
		/// <param name="destination">The dfRenderData buffer that will hold the 
		/// text mesh information</param>
		public override void Render( string text, dfRenderData destination )
		{

			//@Profiler.BeginSample( "Render dynamic font text" );

			textColors.Clear();
			textColors.Push( Color.white );

			// Ensure that the required characters can be found in the dynamic font's
			// character data.
			var font = (dfDynamicFont)Font;
			var fontSize = Mathf.CeilToInt( font.FontSize * TextScale );
			font.RequestCharacters( text, fontSize, FontStyle.Normal );

			tokenize( text );
			var lines = calculateLinebreaks();

			destination.EnsureCapacity( getAnticipatedVertCount( tokens ) );

			var maxWidth = 0;
			var maxHeight = 0;

			var position = ( VectorOffset / PixelRatio ).CeilToInt();

			for( int i = 0; i < lines.Count; i++ )
			{

				var line = lines[ i ];
				var lineStartIndex = destination.Vertices.Count;
				var spriteStartIndex = ( SpriteBuffer != null ) ? SpriteBuffer.Vertices.Count : 0;

				renderLine( lines[ i ], textColors, position, destination );

				position.y -= line.lineHeight;

				maxWidth = Mathf.Max( (int)line.lineWidth, maxWidth );
				maxHeight += Mathf.CeilToInt( line.lineHeight );

				if( line.lineWidth > MaxSize.x )
				{
					clipRight( destination, lineStartIndex );
					clipRight( SpriteBuffer, spriteStartIndex );
				}

				clipBottom( destination, lineStartIndex );
				clipBottom( SpriteBuffer, spriteStartIndex );

			}

			this.RenderedSize = new Vector2(
				Mathf.Min( MaxSize.x, maxWidth ),
				Mathf.Min( MaxSize.y, maxHeight )
			) * TextScale;

			this.tokens.Release();
			this.tokens = null;

			//@Profiler.EndSample();

		}
Exemple #40
0
 private void addQuadIndices(dfList<Vector3> verts, dfList<int> triangles)
 {
     int count = verts.Count;
     int[] numArray = new int[] { 0, 1, 3, 3, 1, 2 };
     for (int i = 0; i < (int)numArray.Length; i++)
     {
         triangles.Add(count + numArray[i]);
     }
 }
	public void clipToPlanes( dfList<Plane> planes, dfRenderData data, dfRenderData dest, uint controlChecksum )
	{

		if( data == null || data.Vertices.Count == 0 )
			return;

		if( planes == null || planes.Count == 0 )
		{
			dest.Merge( data );
			return;
		}

		dfClippingUtil.Clip( planes, data, dest );

	}
Exemple #42
0
    public void OnEnable()
    {
        container = GetComponent<dfPanel>();
        container.Pivot = dfPivotPoint.MiddleCenter;
        container.ControlAdded += container_ControlCollectionChanged;
        container.ControlRemoved += container_ControlCollectionChanged;

        controls = new dfList<dfControl>( container.Controls );

        if( rotationCurve.keys.Length == 0 )
        {
            rotationCurve.AddKey( 0, 0 );
            rotationCurve.AddKey( 1, 1 );
        }
    }
    internal void Render( Camera renderCamera, dfControl control, dfList<Rect> occluders, dfList<dfControl> controlsRendered, uint checksum, float opacity )
    {
        if( meshRenderer == null )
        {
            initialize();
        }

        this.renderCamera = renderCamera;
        this.attachedControl = control;

        if( !isDirty )
        {

            // Update the caller's lists
            occluders.AddRange( groupOccluders );
            controlsRendered.AddRange( groupControls );

            return;

        }

        // Clear lists that will contain the results of the rendering process
        groupOccluders.Clear();
        groupControls.Clear();
        renderGroups.Clear();
        resetDrawCalls();

        // Disable shader clipping by default
        this.clipInfo = new ClipRegionInfo();
        this.clipRect = new Rect();

        // Define the main draw call buffer, which will be assigned as needed
        // by the renderControl() method
        var buffer = (dfRenderData)null;

        using( var defaultClipRegion = dfTriangleClippingRegion.Obtain() )
        {

            // Initialize the clipping region stack
            clipStack.Clear();
            clipStack.Push( defaultClipRegion );

            // Render the control and all of its children
            renderControl( ref buffer, control, checksum, opacity );

            // The clip stack is reset after every frame as it's only needed during rendering
            clipStack.Pop();

        }

        // Remove any empty draw call buffers. There might be empty
        // draw call buffers due to controls that were clipped.
        drawCallBuffers.RemoveAll( isEmptyBuffer );
        drawCallCount = drawCallBuffers.Count;

        // At this point, the drawCallCount variable contains the
        // number of draw calls needed to render the user interface.
        if( drawCallBuffers.Count == 0 )
        {
            meshRenderer.enabled = false;
            return;
        }
        else
        {
            meshRenderer.enabled = true;
        }

        // Consolidate all draw call buffers into one master buffer
        // that will be used to build the Mesh
        var masterBuffer = compileMasterBuffer();

        // Build the master mesh
        var mesh = renderMesh;
        mesh.Clear( true );
        mesh.vertices = masterBuffer.Vertices.ToTempArray();
        mesh.uv = masterBuffer.UV.ToTempArray();
        mesh.colors32 = masterBuffer.Colors.ToTempArray();

        #region Set sub-meshes

        mesh.subMeshCount = submeshes.Count;
        for( int i = 0; i < submeshes.Count; i++ )
        {

            // Calculate the start and length of the submesh array
            var startIndex = submeshes[ i ];
            var length = masterBuffer.Triangles.Count - startIndex;
            if( i < submeshes.Count - 1 )
            {
                length = submeshes[ i + 1 ] - startIndex;
            }

            var submeshTriangles = dfTempArray<int>.Obtain( length, 128 );
            masterBuffer.Triangles.CopyTo( startIndex, submeshTriangles, 0, length );

            // Set the submesh's triangle index array
            mesh.SetTriangles( submeshTriangles, i );

        }

        #endregion

        // This render group no longer requires updating
        isDirty = false;

        // Update the caller's lists
        occluders.AddRange( groupOccluders );
        controlsRendered.AddRange( groupControls );
    }
Exemple #44
0
 private static void addUVCoords(dfList<Vector2> uvs, CharacterInfo glyph)
 {
     Rect rect = glyph.uv;
     float single = rect.x;
     float single1 = rect.y + rect.height;
     float single2 = single + rect.width;
     float single3 = rect.y;
     if (!glyph.flipped)
     {
         uvs.Add(new Vector2(single, single1));
         uvs.Add(new Vector2(single2, single1));
         uvs.Add(new Vector2(single2, single3));
         uvs.Add(new Vector2(single, single3));
     }
     else
     {
         uvs.Add(new Vector2(single2, single3));
         uvs.Add(new Vector2(single2, single1));
         uvs.Add(new Vector2(single, single1));
         uvs.Add(new Vector2(single, single3));
     }
 }
		public override void Release()
		{

			if( !inUse )
				return;

			inUse = false;

			this.Reset();

			if( this.tokens != null )
			{
				this.tokens.Release();
				this.tokens = null;
			}

			if( lines != null )
			{
				lines.ReleaseItems();
				lines.Release();
				lines = null;
			}

			this.BottomColor = (Color32?)null;

			objectPool.Enqueue( this );

		}
Exemple #46
0
 private void addQuadColors( dfList<Color32> colors )
 {
     colors.EnsureCapacity( colors.Count + 4 );
     var color = ApplyOpacity( IsEnabled ? this.color : this.disabledColor );
     for( int i = 0; i < 4; i++ )
     {
         colors.Add( color );
     }
 }
		/// <summary>
		/// Measures the given text and returns the size (in pixels) required 
		/// to render the text.
		/// </summary>
		/// <param name="text">The text to be measured</param>
		/// <returns>The size required to render the text</returns>
		public override Vector2 MeasureString( string text )
		{

			// Ensure that the required characters can be found in the dynamic font's
			// character data.
			var font = (dfDynamicFont)Font;
			var fontSize = Mathf.CeilToInt( font.FontSize * TextScale );
			font.RequestCharacters( text, fontSize, FontStyle.Normal );

			tokenize( text );
			var lines = calculateLinebreaks();

			var totalWidth = 0f;
			var totalHeight = 0f;

			for( int i = 0; i < lines.Count; i++ )
			{
				totalWidth = Mathf.Max( lines[ i ].lineWidth, totalWidth );
				totalHeight += lines[ i ].lineHeight;
			}

			this.tokens.Release();
			this.tokens = null;

			var result = new Vector2( totalWidth, totalHeight );

			return result;

		}
Exemple #48
0
 private void addQuadTriangles( dfList<int> triangles, int baseIndex )
 {
     for( int i = 0; i < quadTriangles.Length; i++ )
     {
         triangles.Add( quadTriangles[ i ] + baseIndex );
     }
 }
		private int getAnticipatedVertCount( dfList<dfMarkupToken> tokens )
		{

			var textSize = 4 + ( Shadow ? 4 : 0 ) + ( Outline ? 4 : 0 );

			var count = 0;
			for( int i = 0; i < tokens.Count; i++ )
			{

				var token = tokens[ i ];

				if( token.TokenType == dfMarkupTokenType.Text )
				{
					count += textSize * token.Length;
				}
				else if( token.TokenType == dfMarkupTokenType.StartTag )
				{
					count += 4;
				}

			}

			return count;

		}
Exemple #50
0
 private void addQuadUV( dfList<Vector2> uv, Vector2[] spriteUV )
 {
     uv.AddRange( spriteUV );
 }
		/// <summary>
		/// Determine where each line of text starts. Assumes that the
		/// tokens array is already populated and that the render size
		/// of each token has already been determined.
		/// </summary>
		/// <returns></returns>
		private dfList<LineRenderInfo> calculateLinebreaks()
		{

			try
			{

				//@Profiler.BeginSample( "Calculate line breaks" );

				if( lines != null )
				{
					return lines;
				}

				lines = dfList<LineRenderInfo>.Obtain();

				var font = (dfDynamicFont)Font;
				var lastBreak = 0;
				var startIndex = 0;
				var index = 0;
				var lineWidth = 0;
				var lineHeight = font.Baseline * TextScale;

				while( index < tokens.Count && lines.Count * lineHeight <= MaxSize.y + lineHeight )
				{

					var token = tokens[ index ];
					var type = token.TokenType;

					if( type == dfMarkupTokenType.Newline )
					{

						lines.Add( LineRenderInfo.Obtain( startIndex, index ) );

						startIndex = lastBreak = ++index;
						lineWidth = 0;

						continue;

					}

					var tokenWidth = Mathf.CeilToInt( token.Width );

					var canWrap =
						WordWrap &&
						lastBreak > startIndex &&
						(
							type == dfMarkupTokenType.Text ||
							( type == dfMarkupTokenType.StartTag && token.Matches( "sprite" ) )
						);

					if( canWrap && lineWidth + tokenWidth >= MaxSize.x )
					{

						if( lastBreak > startIndex )
						{

							lines.Add( LineRenderInfo.Obtain( startIndex, lastBreak - 1 ) );

							startIndex = index = ++lastBreak;
							lineWidth = 0;

						}
						else
						{

							lines.Add( LineRenderInfo.Obtain( startIndex, lastBreak - 1 ) );

							startIndex = lastBreak = ++index;
							lineWidth = 0;

						}

						continue;

					}

					if( type == dfMarkupTokenType.Whitespace )
					{
						lastBreak = index;
					}

					lineWidth += tokenWidth;
					index += 1;

				}

				if( startIndex < tokens.Count )
				{
					lines.Add( LineRenderInfo.Obtain( startIndex, tokens.Count - 1 ) );
				}

				for( int i = 0; i < lines.Count; i++ )
				{
					calculateLineSize( lines[ i ] );
				}

				return lines;

			}
			finally
			{
				//@Profiler.EndSample();
			}

		}
Exemple #52
0
    private void clipQuads( dfList<Vector3> verts, dfList<Vector2> uv )
    {
        var minX = 0f;
        var maxX = size.x;
        var minY = -size.y;
        var maxY = 0f;

        if( fillAmount < 1f )
        {
            if( fillDirection == dfFillDirection.Horizontal )
            {
                if( !invertFill )
                    maxX = size.x * fillAmount;
                else
                    minX = size.x - size.x * fillAmount;
            }
            else
            {
                if( !invertFill )
                    minY = -size.y * fillAmount;
                else
                    maxY = -size.y * ( 1f - fillAmount );
            }
        }

        for( int i = 0; i < verts.Count; i += 4 )
        {

            var ul = verts[ i + 0 ];
            var ur = verts[ i + 1 ];
            var br = verts[ i + 2 ];
            var bl = verts[ i + 3 ];

            var w = ur.x - ul.x;
            var h = ul.y - bl.y;

            if( ul.x < minX )
            {

                var clip = ( minX - ul.x ) / w;

                verts[ i + 0 ] = ul = new Vector3( Mathf.Max( minX, ul.x ), ul.y, ul.z );
                verts[ i + 1 ] = ur = new Vector3( Mathf.Max( minX, ur.x ), ur.y, ur.z );
                verts[ i + 2 ] = br = new Vector3( Mathf.Max( minX, br.x ), br.y, br.z );
                verts[ i + 3 ] = bl = new Vector3( Mathf.Max( minX, bl.x ), bl.y, bl.z );

                var uvx = Mathf.Lerp( uv[ i ].x, uv[ i + 1 ].x, clip );
                uv[ i + 0 ] = new Vector2( uvx, uv[ i ].y );
                uv[ i + 3 ] = new Vector2( uvx, uv[ i + 3 ].y );

                w = ur.x - ul.x;

            }

            if( ur.x > maxX )
            {

                var clip = 1f - ( ( maxX - ur.x + w ) / w );

                verts[ i + 0 ] = ul = new Vector3( Mathf.Min( ul.x, maxX ), ul.y, ul.z );
                verts[ i + 1 ] = ur = new Vector3( Mathf.Min( ur.x, maxX ), ur.y, ur.z );
                verts[ i + 2 ] = br = new Vector3( Mathf.Min( br.x, maxX ), br.y, br.z );
                verts[ i + 3 ] = bl = new Vector3( Mathf.Min( bl.x, maxX ), bl.y, bl.z );

                var uvx = Mathf.Lerp( uv[ i + 1 ].x, uv[ i ].x, clip );
                uv[ i + 1 ] = new Vector2( uvx, uv[ i + 1 ].y );
                uv[ i + 2 ] = new Vector2( uvx, uv[ i + 2 ].y );

                w = ur.x - ul.x;

            }

            // Bottom of clip rect
            if( bl.y < minY )
            {

                var clip = 1f - ( Mathf.Abs( -minY + ul.y ) / h );

                verts[ i + 0 ] = ul = new Vector3( ul.x, Mathf.Max( ul.y, minY ), ur.z );
                verts[ i + 1 ] = ur = new Vector3( ur.x, Mathf.Max( ur.y, minY ), ur.z );
                verts[ i + 2 ] = br = new Vector3( br.x, Mathf.Max( br.y, minY ), br.z );
                verts[ i + 3 ] = bl = new Vector3( bl.x, Mathf.Max( bl.y, minY ), bl.z );

                var uvy = Mathf.Lerp( uv[ i + 3 ].y, uv[ i ].y, clip );
                uv[ i + 3 ] = new Vector2( uv[ i + 3 ].x, uvy );
                uv[ i + 2 ] = new Vector2( uv[ i + 2 ].x, uvy );

                h = Mathf.Abs( bl.y - ul.y );

            }

            // Top of clip rect
            if( ul.y > maxY )
            {

                var clip = Mathf.Abs( maxY - ul.y ) / h;

                verts[ i + 0 ] = ul = new Vector3( ul.x, Mathf.Min( maxY, ul.y ), ul.z );
                verts[ i + 1 ] = ur = new Vector3( ur.x, Mathf.Min( maxY, ur.y ), ur.z );
                verts[ i + 2 ] = br = new Vector3( br.x, Mathf.Min( maxY, br.y ), br.z );
                verts[ i + 3 ] = bl = new Vector3( bl.x, Mathf.Min( maxY, bl.y ), bl.z );

                var uvy = Mathf.Lerp( uv[ i ].y, uv[ i + 3 ].y, clip );
                uv[ i ] = new Vector2( uv[ i ].x, uvy );
                uv[ i + 1 ] = new Vector2( uv[ i + 1 ].x, uvy );

            }

        }
    }
Exemple #53
0
        private static void addTriangleIndices( dfList<Vector3> verts, dfList<int> triangles )
        {

        var vcount = verts.Count;
        var indices = TRIANGLE_INDICES;

        for( int ii = 0; ii < indices.Length; ii++ )
        {
            triangles.Add( vcount + indices[ ii ] );
        }

        }
Exemple #54
0
    private bool processTouchInput()
    {
        var touchCount = Input.touchCount;
        if( touchCount == 0 )
            return false;

        if( touches == null )
            touches = new dfList<Touch>();

        // Gather touches in a dfList<> instead of an array to
        // avoid per-frame allocation of temporary variables

        touches.Clear();
        for( int i = 0; i < touchCount; i++ )
        {
            touches.Add( Input.GetTouch( i ) );
        }

        this.touchHandler.Process( this.transform, renderCamera, touches, retainFocus );

        return true;
    }
    private void processMarkup()
    {
        releaseMarkupReferences();

        this.elements = dfMarkupParser.Parse( this, this.text );

        var scaleMultiplier = getTextScaleMultiplier();

        var scaledFontSize = Mathf.CeilToInt( this.FontSize * scaleMultiplier );
        var scaledLineHeight = Mathf.CeilToInt( this.LineHeight * scaleMultiplier );

        var style = new dfMarkupStyle()
        {
            Host = this,
            Atlas = this.Atlas,
            Font = this.Font,
            FontSize = scaledFontSize,
            FontStyle = this.FontStyle,
            LineHeight = scaledLineHeight,
            Color = ApplyOpacity( this.Color ),
            Opacity = this.CalculateOpacity(),
            Align = this.TextAlignment,
            PreserveWhitespace = this.preserveWhitespace
        };

        viewportBox = new dfMarkupBox( null, dfMarkupDisplayType.block, style )
        {
            Size = this.Size
        };

        //@Profiler.BeginSample( "Perform layout on markup" );
        for( int i = 0; i < elements.Count; i++ )
        {
            var child = elements[ i ];
            if( child != null )
            {
                child.PerformLayout( viewportBox, style );
            }
        }
        Profiler.EndSample();
    }
Exemple #56
0
        internal void Process( Transform transform, Camera renderCamera, dfList<Touch> touches, bool retainFocus )
        {
            for( int i = 0; i < touches.Count; i++ )
            {

                // Dereference Touch information
                var touch = touches[ i ];

                // Raycast from touch position to find the top-most control under the touch
                var ray = renderCamera.ScreenPointToRay( touch.position );
                var maxDistance = renderCamera.farClipPlane - renderCamera.nearClipPlane;
                var hits = Physics.RaycastAll( ray, maxDistance, renderCamera.cullingMask );

                // Keep track of the last control under the "mouse"
                controlUnderMouse = clipCast( transform, hits );

                #region Don't track touches on empty space

                if( controlUnderMouse == null )
                {
                    if( touch.phase == TouchPhase.Began )
                    {
                        untracked.Add( touch.fingerId );
                        continue;
                    }
                }

                if( untracked.Contains( touch.fingerId ) )
                {

                    if( touch.phase == TouchPhase.Ended )
                        untracked.Remove( touch.fingerId );

                    continue;

                }

                #endregion

                var info = new TouchRaycast( controlUnderMouse, touch, ray );

                var captured = tracked.FirstOrDefault( x => x.IsTrackingFinger( info.FingerID ) );
                if( captured != null )
                {
                    captured.Process( info );
                    continue;
                }

                var processed = false;
                for( int x = 0; x < tracked.Count; x++ )
                {
                    if( tracked[ x ].Process( info ) )
                    {
                        processed = true;
                        break;
                    }
                }

                if( !processed && controlUnderMouse != null )
                {

                    if( !tracked.Any( x => x.control == controlUnderMouse ) )
                    {

                        if( controlUnderMouse == null )
                            Debug.Log( "Tracking touch with no control: " + touch.fingerId );

                        var newTracker = new ControlTouchTracker( manager, controlUnderMouse );

                        tracked.Add( newTracker );
                        newTracker.Process( info );

                    }

                }

            }

            }
Exemple #57
0
 private void clipQuads(dfList<Vector3> verts, dfList<Vector2> uv)
 {
     float single = 0f;
     float single1 = this.size.x;
     float single2 = -this.size.y;
     float single3 = 0f;
     if (this.fillAmount < 1f)
     {
         if (this.fillDirection == dfFillDirection.Horizontal)
         {
             if (this.invertFill)
             {
                 single = this.size.x - this.size.x * this.fillAmount;
             }
             else
             {
                 single1 = this.size.x * this.fillAmount;
             }
         }
         else if (this.invertFill)
         {
             single3 = -this.size.y * (1f - this.fillAmount);
         }
         else
         {
             single2 = -this.size.y * this.fillAmount;
         }
     }
     for (int i = 0; i < verts.Count; i = i + 4)
     {
         Vector3 item = verts[i];
         Vector3 vector3 = verts[i + 1];
         Vector3 item1 = verts[i + 2];
         Vector3 vector31 = verts[i + 3];
         float single4 = vector3.x - item.x;
         float single5 = item.y - vector31.y;
         if (item.x < single)
         {
             float single6 = (single - item.x) / single4;
             item = new Vector3(Mathf.Max(single, item.x), item.y, item.z);
             verts[i] = item;
             vector3 = new Vector3(Mathf.Max(single, vector3.x), vector3.y, vector3.z);
             verts[i + 1] = vector3;
             item1 = new Vector3(Mathf.Max(single, item1.x), item1.y, item1.z);
             verts[i + 2] = item1;
             vector31 = new Vector3(Mathf.Max(single, vector31.x), vector31.y, vector31.z);
             verts[i + 3] = vector31;
             float item2 = uv[i].x;
             Vector2 vector2 = uv[i + 1];
             float single7 = Mathf.Lerp(item2, vector2.x, single6);
             Vector2 vector21 = uv[i];
             uv[i] = new Vector2(single7, vector21.y);
             Vector2 vector22 = uv[i + 3];
             uv[i + 3] = new Vector2(single7, vector22.y);
             single4 = vector3.x - item.x;
         }
         if (vector3.x > single1)
         {
             float single8 = 1f - (single1 - vector3.x + single4) / single4;
             item = new Vector3(Mathf.Min(item.x, single1), item.y, item.z);
             verts[i] = item;
             vector3 = new Vector3(Mathf.Min(vector3.x, single1), vector3.y, vector3.z);
             verts[i + 1] = vector3;
             item1 = new Vector3(Mathf.Min(item1.x, single1), item1.y, item1.z);
             verts[i + 2] = item1;
             vector31 = new Vector3(Mathf.Min(vector31.x, single1), vector31.y, vector31.z);
             verts[i + 3] = vector31;
             float item3 = uv[i + 1].x;
             Vector2 vector23 = uv[i];
             float single9 = Mathf.Lerp(item3, vector23.x, single8);
             Vector2 item4 = uv[i + 1];
             uv[i + 1] = new Vector2(single9, item4.y);
             Vector2 vector24 = uv[i + 2];
             uv[i + 2] = new Vector2(single9, vector24.y);
             single4 = vector3.x - item.x;
         }
         if (vector31.y < single2)
         {
             float single10 = 1f - Mathf.Abs(-single2 + item.y) / single5;
             item = new Vector3(item.x, Mathf.Max(item.y, single2), vector3.z);
             verts[i] = item;
             vector3 = new Vector3(vector3.x, Mathf.Max(vector3.y, single2), vector3.z);
             verts[i + 1] = vector3;
             item1 = new Vector3(item1.x, Mathf.Max(item1.y, single2), item1.z);
             verts[i + 2] = item1;
             vector31 = new Vector3(vector31.x, Mathf.Max(vector31.y, single2), vector31.z);
             verts[i + 3] = vector31;
             float item5 = uv[i + 3].y;
             Vector2 vector25 = uv[i];
             float single11 = Mathf.Lerp(item5, vector25.y, single10);
             Vector2 item6 = uv[i + 3];
             uv[i + 3] = new Vector2(item6.x, single11);
             Vector2 vector26 = uv[i + 2];
             uv[i + 2] = new Vector2(vector26.x, single11);
             single5 = Mathf.Abs(vector31.y - item.y);
         }
         if (item.y > single3)
         {
             float single12 = Mathf.Abs(single3 - item.y) / single5;
             item = new Vector3(item.x, Mathf.Min(single3, item.y), item.z);
             verts[i] = item;
             vector3 = new Vector3(vector3.x, Mathf.Min(single3, vector3.y), vector3.z);
             verts[i + 1] = vector3;
             item1 = new Vector3(item1.x, Mathf.Min(single3, item1.y), item1.z);
             verts[i + 2] = item1;
             vector31 = new Vector3(vector31.x, Mathf.Min(single3, vector31.y), vector31.z);
             verts[i + 3] = vector31;
             float item7 = uv[i].y;
             Vector2 vector27 = uv[i + 3];
             float single13 = Mathf.Lerp(item7, vector27.y, single12);
             Vector2 item8 = uv[i];
             uv[i] = new Vector2(item8.x, single13);
             Vector2 vector28 = uv[i + 1];
             uv[i + 1] = new Vector2(vector28.x, single13);
         }
     }
 }
		/// <summary>
		/// Splits the source text into tokens and preprocesses the
		/// tokens to determine render size required, etc.
		/// </summary>
		private void tokenize( string text )
		{

			try
			{

				//@Profiler.BeginSample( "Tokenize text" );

				if( this.ProcessMarkup )
					this.tokens = dfMarkupTokenizer.Tokenize( text );
				else
					this.tokens = dfPlainTextTokenizer.Tokenize( text );

				for( int i = 0; i < tokens.Count; i++ )
				{
					calculateTokenRenderSize( tokens[ i ] );
				}

			}
			finally
			{
				//@Profiler.EndSample();
			}

		}
Exemple #59
0
    void container_ControlCollectionChanged( dfControl container, dfControl child )
    {
        controls = new dfList<dfControl>( container.Controls );

        if( autoSelectOnStart && Application.isPlaying )
        {
            setSelectedIndex( controls.Count / 2 );
        }
    }
        public override void Release()
        {
            this.Reset();

            this.tokens = null;

            if( lines != null )
            {
                lines.Release();
                lines = null;
            }

            LineRenderInfo.ResetPool();

            this.BottomColor = (Color32?)null;

            objectPool.Enqueue( this );
        }