添加字体材质和shader和so文件
parent
d41b4c227f
commit
79018ef837
|
|
@ -0,0 +1 @@
|
|||
/Users/a0729/gogs.git/find-object-bundle-builder/pipeline_Profile/profile_asset/shader
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f2d21e536af7c4b30a05068d2898340c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4818c3bee351345058d7556c41b38aca
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: TextScanEffect
|
||||
m_Shader: {fileID: 4800000, guid: 8062bfd40365348d883939295be03ceb, type: 3}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _GoldIntensity: 0.182
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _ScanAngle: -30
|
||||
- _ScanFalloff: 1.5
|
||||
- _ScanIntensity: 0.32
|
||||
- _ScanInterval: 0
|
||||
- _ScanNoise: 0.05
|
||||
- _ScanSpeed: 1
|
||||
- _ScanWidth: 0.08
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _SweepIntensity: 1.39
|
||||
- _SweepInterval: 4.5
|
||||
- _SweepSpeed: 0.89
|
||||
- _SweepWidth: 0.056
|
||||
- _UVSec: 0
|
||||
- _UseUIAlphaClip: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _GoldColor: {r: 1, g: 0.84, b: 0, a: 1}
|
||||
- _ScanColor: {r: 1, g: 0.87660354, b: 0.6117647, a: 0.43137255}
|
||||
- _SweepColor: {r: 1, g: 0.84, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3c74ce8d720804f46a5c70716dcd5aed
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
// TextScanEffect.shader
|
||||
// 文本扫光效果着色器,用于UI文本的动态扫光特效
|
||||
// 功能:在文本上创建一个从左到右(或自定义角度)移动的扫光效果
|
||||
// 优化:实现连续扫光,无间隔等待时间
|
||||
Shader "Custom/TextScanEffect"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Font Texture", 2D) = "white" {}
|
||||
[PerRendererData] _Color ("Text Color", Color) = (1,1,1,1)
|
||||
|
||||
// 扫光参数
|
||||
_ScanColor ("Scan Color", Color) = (1,0.8,0,1) // 扫光颜色
|
||||
_ScanWidth ("Scan Width", Range(0, 0.5)) = 0.15 // 扫光宽度
|
||||
_ScanSpeed ("Scan Speed", Range(0, 50)) = 1.5 // 扫光速度
|
||||
_ScanIntensity ("Scan Intensity", Range(0, 5)) = 2 // 扫光强度
|
||||
[HideInInspector] _ScanInterval ("Scan Interval", Range(0, 0.1)) = 0.0 // 隐藏间隔参数,默认为0实现连续扫光
|
||||
_ScanAngle ("Scan Angle", Range(-45, 45)) = 30 // 扫光角度
|
||||
|
||||
// 添加遮罩所需属性
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
}
|
||||
|
||||
// 添加模板测试配置
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
// 引入Unity UI所需的库
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
// 启用UI裁剪和Alpha裁剪功能
|
||||
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
|
||||
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 screenPos : TEXCOORD1;
|
||||
fixed4 color : COLOR;
|
||||
float4 worldPosition : TEXCOORD2; // 添加世界坐标用于遮罩裁剪
|
||||
};
|
||||
|
||||
// 着色器属性声明
|
||||
sampler2D _MainTex; // 字体纹理
|
||||
fixed4 _Color; // 文本颜色
|
||||
fixed4 _ScanColor; // 扫光颜色
|
||||
float _ScanWidth; // 扫光宽度
|
||||
float _ScanSpeed; // 扫光速度
|
||||
float _ScanIntensity; // 扫光强度
|
||||
float _ScanInterval; // 扫光间隔(已隐藏,保留变量以兼容旧版本)
|
||||
float _ScanAngle; // 扫光角度
|
||||
|
||||
// UI遮罩所需变量
|
||||
float4 _ClipRect; // 裁剪矩形
|
||||
|
||||
// 顶点着色器
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
// 转换顶点到裁剪空间
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
// 传递UV坐标
|
||||
o.uv = v.uv;
|
||||
// 计算屏幕空间位置(用于扫光效果)
|
||||
o.screenPos = ComputeScreenPos(o.vertex);
|
||||
// 计算颜色
|
||||
o.color = v.color * _Color;
|
||||
// 保存世界坐标用于UI遮罩裁剪
|
||||
o.worldPosition = v.vertex;
|
||||
return o;
|
||||
}
|
||||
|
||||
// 片段着色器
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
// 基础颜色计算 - 采样字体纹理并应用颜色
|
||||
fixed4 tex = tex2D(_MainTex, i.uv);
|
||||
fixed4 col = i.color;
|
||||
// 应用字体纹理的alpha通道
|
||||
col.a *= tex.a;
|
||||
|
||||
// 屏幕空间计算
|
||||
float2 screenUV = i.screenPos.xy / i.screenPos.w;
|
||||
|
||||
// 扫光方向计算
|
||||
float angle = radians(_ScanAngle);
|
||||
float2 dir = float2(cos(angle), sin(angle));
|
||||
|
||||
// 时间参数计算(实现真正连续的双重扫光)
|
||||
float speed = max(_ScanSpeed, 0.01); // 防止除零错误
|
||||
|
||||
// 计算三个错开的扫光时间,确保始终有扫光效果可见
|
||||
float time1 = fmod(_Time.y * speed * 0.5, 3.0); // 第一个扫光时间
|
||||
float time2 = fmod(_Time.y * speed * 0.5 + 1.0, 3.0); // 第二个扫光时间(错开1个单位)
|
||||
float time3 = fmod(_Time.y * speed * 0.5 + 2.0, 3.0); // 第二个扫光时间(错开1个单位)
|
||||
|
||||
// 扫描带位置计算
|
||||
float scanPos = dot(screenUV, dir);
|
||||
|
||||
// 计算三个扫光的位置
|
||||
// 扩大移动范围,确保扫光完全穿过屏幕
|
||||
float lightPos1 = time1 - 1.0; // 从-1.5移动到1.5
|
||||
float lightPos2 = time2 - 1.0; // 从-1.5移动到1.5
|
||||
float lightPos3 = time3 - 1.0; // 从-1.5移动到1.5
|
||||
|
||||
// 计算三个扫光到当前像素的距离
|
||||
float distance1 = abs(scanPos - lightPos1);
|
||||
float distance2 = abs(scanPos - lightPos2);
|
||||
float distance3 = abs(scanPos - lightPos3);
|
||||
|
||||
// 计算三个扫光的强度
|
||||
double width = max(_ScanWidth, 0.001);
|
||||
float scan1 = 1.0 - smoothstep(0, width, distance1);
|
||||
float scan2 = 1.0 - smoothstep(0, width, distance2);
|
||||
float scan3 = 1.0 - smoothstep(0, width, distance3);
|
||||
|
||||
// 合并三个扫光效果(取最大值)
|
||||
float scan = max(max(scan1, scan2), scan3);
|
||||
|
||||
// 将扫光效果叠加到原始颜色上
|
||||
// 使用alpha值确保透明区域不会显示扫光效果
|
||||
col.rgb += _ScanColor.rgb * scan * _ScanIntensity * col.a;
|
||||
|
||||
// 应用UI遮罩裁剪
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
col.a *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip(col.a - 0.001);
|
||||
#endif
|
||||
|
||||
// 使用saturate确保颜色值在0-1范围内
|
||||
return saturate(col); // 等同于clamp(col, 0, 1)
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8062bfd40365348d883939295be03ceb
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameFeatures.ProfilesFeature
|
||||
{
|
||||
[CreateAssetMenu(fileName = "NameFontStyle", menuName = "Custom/ProfileFeature/NameFontStyle", order = 0)]
|
||||
public class NameFontStyle : ScriptableObject
|
||||
{
|
||||
public List<NameFontStyleItem> datas;
|
||||
|
||||
public bool IsContainFont(int id)
|
||||
{
|
||||
return datas.FindIndex(item => item.id == id) >= 0;
|
||||
}
|
||||
|
||||
public NameFontStyleItem GetFontStyleItem(int id)
|
||||
{
|
||||
return datas.Find(item => item.id == id);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class NameFontStyleItem
|
||||
{
|
||||
public string name;
|
||||
public int id;
|
||||
public Color color = Color.white;
|
||||
public TextOutlineSetting outlineSetting;
|
||||
public TextGradientSetting gradientSetting;
|
||||
public Material material;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class TextOutlineSetting
|
||||
{
|
||||
public bool enable;
|
||||
public Color color;
|
||||
public Vector2 distance;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class TextGradientSetting
|
||||
{
|
||||
public bool enable;
|
||||
public Color topColor;
|
||||
public Color bottomColor;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 923f270435b1c4e2594a99bd1f0785e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 923f270435b1c4e2594a99bd1f0785e0, type: 3}
|
||||
m_Name: NameFontStyle
|
||||
m_EditorClassIdentifier:
|
||||
datas:
|
||||
- name: 3000
|
||||
id: 3000
|
||||
color: {r: 0.14117648, g: 0.08627451, b: 0.4, a: 0}
|
||||
outlineSetting:
|
||||
enable: 0
|
||||
color: {r: 0, g: 0, b: 0, a: 0}
|
||||
distance: {x: 0, y: 0}
|
||||
gradientSetting:
|
||||
enable: 0
|
||||
topColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
bottomColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
material: {fileID: 0}
|
||||
- name: 3001
|
||||
id: 3001
|
||||
color: {r: 0, g: 0, b: 0, a: 0}
|
||||
outlineSetting:
|
||||
enable: 1
|
||||
color: {r: 0.21176471, g: 0.039215688, b: 0, a: 1}
|
||||
distance: {x: 2, y: 2}
|
||||
gradientSetting:
|
||||
enable: 1
|
||||
topColor: {r: 1, g: 0.9490196, b: 0.21960784, a: 1}
|
||||
bottomColor: {r: 1, g: 0.78431374, b: 0, a: 1}
|
||||
material: {fileID: 2100000, guid: 3c74ce8d720804f46a5c70716dcd5aed, type: 2}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 46df4df504240450abf92868647806f0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue