블로그 이미지
Every unexpected event is a path to learning for you. blueasa

카테고리

분류 전체보기 (2794)
Unity3D (852)
Programming (478)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (185)
협업 (11)
3DS Max (3)
Game (12)
Utility (68)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

Unity 2021.3.33f1

NGUI 2023.08.01

----

 

NGUI-UILabel의 Effect에서 Shadow와 Outline을 같이 적용하고 싶어서 찾아보고 올려둠.

UILabel에 세 곳에 소스 추가

public class UILabel : UIWidget
{
    ....
    
    [DoNotObfuscateNGUI] public enum Effect
    {
        None,
        Shadow,
        Outline,
        Outline8,
        ShadowAndOutline,	// Add
    }   
    
    ....
    
    /// <summary>
    /// How many quads there are per printed character.
    /// </summary>

    public int quadsPerCharacter
    {
        get
        {
            if (mEffectStyle == Effect.Shadow) return 2;
            else if (mEffectStyle == Effect.Outline) return 5;
            else if (mEffectStyle == Effect.Outline8) return 9;
            else if (mEffectStyle == Effect.ShadowAndOutline) return 9;	// Add
            return 1;
        }
    }

	....
    
    public void Fill (List<Vector3> verts, List<Vector2> uvs, List<Color> cols, List<Vector3> symbolVerts, List<Vector2> symbolUVs, List<Color> symbolCols)
	{
        ...
        // Apply an effect if one was requested
		if (effectStyle != Effect.None)
		{
			int end = verts.Count;
			var symEnd = (symbolVerts != null) ? symbolVerts.Count : 0;

			pos.x = mEffectDistance.x;
			pos.y = mEffectDistance.y;

			ApplyShadow(verts, uvs, cols, offset, end, pos.x, -pos.y);
			if (symbolVerts != null) ApplyShadow(symbolVerts, symbolUVs, symbolCols, symOffset, symEnd, pos.x, -pos.y);

            #region Add ShadowAndOutline
            if (effectStyle == Effect.ShadowAndOutline)
            {
                pos.y /= 2;
                pos.x = pos.y;

                offset = end;
                end = verts.Count;

                ApplyShadow(verts, uvs, cols, offset, end, -pos.x, pos.y);

                offset = end;
                end = verts.Count;

                ApplyShadow(verts, uvs, cols, offset, end, pos.x, pos.y);

                offset = end;
                end = verts.Count;

                ApplyShadow(verts, uvs, cols, offset, end, -pos.x, -pos.y);

                offset = end;
                end = verts.Count;

                ApplyShadow(verts, uvs, cols, offset, end, -pos.x, 0);

                offset = end;
                end = verts.Count;

                ApplyShadow(verts, uvs, cols, offset, end, pos.x, 0);

                offset = end;
                end = verts.Count;

                ApplyShadow(verts, uvs, cols, offset, end, 0, pos.y);

                offset = end;
                end = verts.Count;

                ApplyShadow(verts, uvs, cols, offset, end, 0, -pos.y);
            }
			#endregion

            if ((effectStyle == Effect.Outline) || (effectStyle == Effect.Outline8))
			{        
        ...
    }
	
}

 

 

[출처] https://gamedev.stackexchange.com/questions/151329/all-sides-shadow-outline-in-unity-ngui

 

All sides shadow outline in Unity NGUI

How can I make such exactly the same shadow using NGUI?

gamedev.stackexchange.com

 

반응형
Posted by blueasa
, |